Skip to content

chriskokc/card-game

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Snap Card Game

Project idea

  • This project is built in Java using the concept of OOP.

Flowchart

Snap Game for Single User

singleUserGamePlay

How to play the Game

  • 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.

Game Start

singleUserGamePlay_gameStart

Winning condition

singleUserGamePlay_winningState

Upgrade to two players Snap

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.

twoUsersGamePlay_winningState

Timer for Snap opportunity

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.

twoUsersGamePlay_timerWinningSnap

twoUsersGamePlay_timerMissSnap

About

Snap Card Game

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages