Program 5: Peg Rectangle Solitaire
Logistics
- Due Date: Friday, April 12th no later than 11:59 p.m.
- Partner Information: You may complete this assignment
individually or with exactly one partner. If you work with a partner,
you must both be enrolled in the same lab section or you
will both lose 10 points.
- Submission Instructions (working alone): Upload your solution,
entitled YourFirstName-YourLastName-Program5.py to the BrightSpace
Program 5 Dropbox.
- Submission Instructions (working with one lab mate): Upload your solution,
renamed to
YourFirstName-YourLastName-PartnerFirstName-PartnerLastName-Program5.py
to the BrightSpace Program 5 Dropbox.
Note: If you work with a partner, only one person needs to submit a
solution. If you both submit a solution, the submission that will be
graded is the one from the partner whose last name comes alphabetically
first.
- Deadline Reminder:
Once the submission deadline passes, BrightSpace will no
longer accept your Python submission and you will no longer
be able to earn credit. Thus, if you are not able to fully complete
the assignment, submit whatever you have before the deadline so that
partial credit can be earned.
Learning Outcomes
- Utilize NumPy arrays to solve a problem.
- Utilize object-oriented programming to solve a problem.
Peg Rectangle Solitaire
- Cracker Barrel restaurants typically set out a free table game
called Peg
Triangle Solitaire.
- For this assignment, you will implement a similar game
that we shall call Peg Rectangle Solitaire. In Peg Rectangle
Solitaire, the user can specify how many rows [1-9] and how many
columns [1-9] the board should have.
- In Peg Rectangle Solitaire, pegs can jump over an adjacent peg
into an empty space. The jumping peg, the adjacent peg and the empty
space must be in a straight line as in Peg Triangle Solitaire.
The potential direction for a peg to jump is
north, northeast, east, southeast, south, southwest, west or northwest.
- When a jump is made the adjacent peg (the peg that was jumped over)
is removed.
- The game is over when there is at most one peg left or when the
user indicates that they no longer want to play.
- When no more than 1 peg remains when the game ends,
the message You're a genius! should appear
as in this sample transcript.
- When 2 pegs remain, the message You're pretty smart.
should appear as in this sample transcript.
- When 3 pegs remain, the message You're just average. should appear
as in this sample transcript.
- When 4 or more pegs remain, the non-politically correct message
You're just plain dumb. should appear as in this
sample transcript.
Assignment
- Using program5.py as a starting point,
supply the missing methods such that interaction with a user
could produce the transcripts above.
Grading - 100 points
- 10 points. The game_won method is correct. (All or nothing.)
- 10 points. The final_message method is correct.
(3 points off for each incorrect case up to 10 points.)
- 40 points. The legal_move method returns True correctly.
(5 points off for not identifying a legal jump in each of
the eight directions.)
- 20 points. The legal_move method returns False correctly.
(10 points off for each type of illegal jump that is identified
as a legal one up to 20 points.)
- 10 points. The make_move method is correct. (All of nothing.)
- 10 points - The methods you write are properly commented,
easy to understand and do not contain unnecessary code.
(3 points for each type of improvement up to 10 points.)