- This project is built in Java using the concept of OOP.
- The Snap game starts by asking user to press
y
to start. - By pressing
ENTER
, the user takes their turn to draw a card from a deck of 52 cards. - The game continues until two cards have the same symbol.
- At this condition, user wins the games.
To allow two players to play Snap, the program has been improved by creating an abstract class Player
. HumanPlayer
and ComputerPlayer
inherit from Player
and they can have different implementation for the getResponse()
method. HumanPlayer
is allowed to press ENTER
to draw a card in their turn, while ComputerPlayer
was set to draw card automatically. The winning state is determined when snap occurs in their turn.
To make the entire card game more exciting, a timer has been created. When there is a snap opportunity for HumanPlayer
, they have 2 seconds to submit the word "snap" in order to win. If they do not type it in time, they will miss the chance to win.