icon

UseTopicwritingscode to get 5% OFF on your first order!

Python project

Im copying the description,

Introduction
The game of Yacht (also known as Yot, and commercially marketed as
Yahtzee) is a game played with 5 dice. It is quite similar to the poker dice
program that is presented in the textbook, but with a more sophisticated
scoring system that makes it much more interesting to play. You can read
about the game in excruciating detail in this wikipedia entry: Yahtzee.
Our game will implement the “classic rules” that ignore things like yacht
bonuses and jokers. In my opinion, this actually makes it a more strategic,
skill-oriented game that is quite fun to play.

Rules
The game is played with 5 dice and proceeds in a series of 13 rounds. In
each round, the player starts by rolling all 5 dice. The player can then
choose some dice to re-roll up to a total of 3 rolls. In this respect, it is
exactly like the dice poker in Chapter 12.
After any roll (1, 2 or 3) the player can choose to score the dice, which
ends the round. Scoring is done by selecting which category on the
scorecard to fill in. The key is to make good choices. The player must
choose a category for the round, even if the score for that category ends
up being 0. One category is filled in each of the 13 rounds.
The scoring categories and the points scored are as follows:
Category Description / Points Scored
ones 1 point for each 1 thrown
twos 2 points for each 2 thrown
threes 3 points for each 3 thrown
fours 4 points for each 4 thrown
fives 5 points for each 5 thrown
sixes 6 points for each 6 thrown
3 of a Kind 3 of the same number. Scores the sum of the dice.
4 of a Kind 4 of the same number. Scores the sum of the dice.
Full House A 3-of-a-kind and 2-of-a-kind. Scores 25 points
Category Description / Points Scored
Small Straight 4 numbers in a row (any order). Scores 30 points
Big Straight 5 numbers in a row (any order). Scores 40 points
Yacht 5 of a kind. Scores 50 points
Chance No pattern needed. Scores the sum of the dice.
Bonus: If the “upper total” (the sum of the first six categories) is 63 or
above, then an additional 35 points is awarded.
The goal is to maximize the total points.

Program Modules
Starter code for the project can by found on our class web page under
handouts/yacht. There are 5 files:
dice.py: This file is a complete implementation of a Dice class. It is
just like the one in Chapter 12, but with the scoring method
removed, since scoring in Yacht is quite different.
yachtscore.py: This file contains class outlines for the objects that
will be responsible for handling scoring. The main class is the
ScoreCard that keeps track of the scoring as the game progresses.
yachtapp.py: This is a minimal outline for the top-level class that
will actually “play” the game. This corresponds to the PokerApp in the
dice poker example. Note, as in the PokerApp, the actual user
interface is separated from the application logic. This file can be
used with either a text-based or a graphics-based interface.
yachttext.py: This is a complete implementation of a very primitive
text-based interface for the game. This is analogous to the
textpoker.py file in the Poker example.
yachgui.py: This is the bare outline of the graphical interface for
the final game. This, combined with yachtapp.py, produces a fullfledged
graphical Yacht game.
In addition to these files, you will undoubtedly also want to make use of
the button.py and cdieview.py files from the Poker app when you get around
to completing the GUI portion of the project.

Project Phases
The work of the project will be completed and delivered in 4 phases.
These phases represent the C, B, A, and A+ levels of the project. Your
work is due on the last day of the term (at noon), but you must do the
phases in order. For example, I won’t grade a phase 2 project if you
haven’t turned in a sucessful phase 1 project. That means you should get
started right away and turn in each phase as soon as possible.

Phase 1 (C level): Scorers
In this phase you are to write and test 5 scorer classes.
In the yachtscore.py file you will find a class for a ScoreCard as well as 5
classes that perform the different kinds of scoring that are needed. These
5 helper classes are the “scorers.” Each scorer has a constructor and a
single score(dice) method. The score method returns the number of points
that the dice would be awarded by this particular scorer.
Let’s take a concrete example. The top 6 categories in the score card (the
ones, twos, threes, etc.) are handled with the ValueScorer class. For the
ones catagory, we would create a ValueScorer for ones like this:
ones = ValueScorer(1)
Then, when we want to see how much some dice would score in that
category, we call the score method:
ones.score([1, 3, 4, 5, 1])
That should return 2 (the sum of the 1’s in the list).
Each of the scorer classes has a detailed docstring that explains the
scorer and also shows some interactive examples. You have completed
phase 1 when you have manually tested each of your scorer classes and
they work as indicated in the docstrings.

Phase 2 (B level): ScoreCard
In this phase you will write and test the ScoreCard class. Consult the
documentation in the yachtscore.py file to learn exactly what the various
methods of the class do.
It is important that you test the scorcard to make sure that it works
properly. The testing function at the bottom of the file should be filled in
to do this. The completee program for this phase should read dice rolls
from a file and fill the resulting scores into the scorecard. Each line of the
file consists of 5 dice values separated by spaces. The first set should be
scored into catagory 0, the next into category 1, etc. The program should
print out the updated scorecard each time a line of the file is read. You
can use the printScorecard function from the yachttext.py file to print the
scorecard.
In the starter code directory you can find a file called maxrolls.txt that
contains the roles that should give you the highest possible score for you
test. Try your test program using this file for the input.

Phase 3 (A level): YachtApp
In this phase you should complete the yachtapp.py file. Start by looking at
the interface methods that have been implemented in the yachtext.py file.
All of your user interaction must be handled by calling on these methods.
The YachtApp class will take care of creating and running the game. It will
need to store the interface, dice, and scorecard as instance variables.

Phase 4 (A+ level): YachtGui
Create a complete graphical game by completing yachtgui.py. The exact
form of the interface is up to you. I would suggest starting with the Poker
app as a model and adding a graphical scorecard below it. In addition to
the buttons on the original poker game, you will want a button for each
scoring category. After the 3rd roll or when the user clicks the score
button, they should then be prompted to click a category to score.
A nice interface will make sure that only the buttons that are currently
available are active.

Grading
Since this is a more substantial project and delivered in phases, it is
worth 30 points. Most of the points will be determined by what phases
you complete. Good style is still appreciated, and will get you to a higher
level of the grade you earn. So a working phase 2 is some flavor of B. A

You can leave a response, or trackback from your own site.

Leave a Reply

Powered by WordPress | Designed by: Premium WordPress Themes | Thanks to Themes Gallery, Bromoney and Wordpress Themes