Attachment 1
Attachment 1
Attachment 1
Peter Basl
For each of the games below, implement it using OOP concepts. You should have at least 1 class but
encouraged to think of more than one appropriate class to implement & manage the game. You
should use any of Python’s GUI frameworks to implement a GUI for the game in the form of a
desktop, web, or mobile application. A text-based game will earn reduced marks. The requirements
here focus on a text-based game so as not to limit your design creativity for the GUI. Feel free to
challenge yourself to exceeding the requirements mentioned.
TIC-TAC-TOE
When the program starts, it displays an empty playing board like that (doesn’t have to be
identical)
| |
__ | __ | __
| |
__ | __ | __
| |
| |
Player A (x):
Below the playing board, it shows the player with the next turn and the playing symbol (x or o).
The player is expected to enter the row and column where the move is going to happen e.g., 1 2
When the player makes a valid move and presses ‘Enter’, the playing board is populated
accordingly & shown again.
| x |
__ | __ | __
| |
__ | __ | __
| |
| |
Player B (o):
If the player enters an invalid value (outside range or an already filled cell); the game displays an
appropriate error message and asks for a new entry.
The game goes on till a winner is detected or till no more moves are possible.
With each move, the program should keep a log of the moves & the board layout in a file.
SFWRTECH 3PR3 - OOP Final Project by Dr. Peter Basl
HANGMAN
This is the popular word guessing game. Use one of Python’s random text generation modules to
generate the random words. The word should be at least 6 characters in length; with no maximum
limit.
The screen should be similar (does not have to be identical) to that (for example for the word
“programming”:
-----------
Guess a letter:
When the player makes a guess (with a single character) and presses enter; the program should
either populate the empty spaces that had this character in them or display some indicator that
one life is lost. Then ask the player to make a new guess. The life indicator can be as simple as “4
more guesses remaining”. Feel free to make it fancier if you have the time.
If the player guesses the word right before the lives end; the game should give a score (figure out
a scoring system) and give the player, the chance to play again with a new word.
The program should keep a game log by saving all guesses and game progress to a file.
SFWRTECH 3PR3 - OOP Final Project by Dr. Peter Basl
BATTLESHIP
Use a square board with 10 rows & 10 columns.
When the program starts, it should randomly position those ships provided that no ships intersect
or touch (not even diagonally). The ships can be rotated i.e., horizontal or vertical.
It then displays a playing board like this (does not have to be identical):
------
------
------
------
------
------
Enter a target:
The player enters the hit co-ordinates as 2 integers. The game should validate this entry. It can’t
be outside the co-ordinates nor a point that was hit before. Use actual row/column indices; not
array ones i.e., do not start from 0.
When the player enters valid co-ordinates, the game should display a new board with the target
marked as a hit (x) or miss (o), then asks for another hit.
The game finishes when there are no more possible moves or when winning condition (all 6 ships
are hit) is detected.
With each move, the program keeps a log of the game progress by saving the game layout
(showing the actual ships) together with the moves in a file.
SFWRTECH 3PR3 - OOP Final Project by Dr. Peter Basl
BLACKJACK
The game starts with the player having 50 credits.
When the program starts; it randomly gives 2 cards to the player (face up) and 2 cards to the
dealer (1 with face down – marked as X - & the other face up). The cards can be shown with their
respective values (no need to display card suit). Aces, Jacks, Queens and Kings can be shown as 1,
11, 12 & 13 or by showing them as A, J, Q, & K.
The game layout at start can be similar to (but does not have to be identical):
1 7 X 9
Make a bet:
When a bet is entered; credit value should be updated. The game board displayed again & the
player is asked whether to draw a card or hold. Every time a new card is drawn, the game board is
updated and displayed again.
After each card, the player total is calculated. If the total exceeds 21, the player is bust which
means player loses the bet and the round ends.
When the player chooses to hold, the game now draws random cards to the dealer. If the new
card makes the dealer total less than 17; it draws another card.
When the dealer total hits 17 or more but still less than or equal to 21; all cards are shown, and
the game should decide who is the winner (the one closest to 21). If the player wins, double the
bet is added to the credit. If itis a tie, the bet is added to the credit. If the dealer wins, the bet
is lost.
If the dealer total exceeds 21, then the player is automatically declared a winner.
After each round, the player is given the choice to continue or not. The game automatically ends
though if the player credit reaches 0.
The game should keep a complete log for scores in a text file.
SFWRTECH 3PR3 - OOP Final Project by Dr. Peter Basl
Submission
Criterion Out of
Use of OOP 8
Game logic 10
Overall functionality 7
Log keeping 5
GUI 10
Reflection Document 5
Complete submission 5