Skip to content

Tannababy/cardGame-Snap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

25 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿƒ Snap Card Game - Java Console Edition

A simple two-player console-based version of the classic card game Snap, built in Java.

When two consecutively dealt cards match in value, players must race to type "snap" within 2 seconds to win. The first player to do so correctly is declared the winner โ€” but hesitate too long, and the chance is lost!

โœจ Features

  • Two-player alternating turns

  • ๐Ÿ”€ Fully shuffled deck logic

  • โณ Reaction-based SNAP logic with a 2-second timer

  • Simple and readable CLI interface

  • Modular code structure (Card, Deck, Player, CardGame, Snap)

๐ŸŽฎ How to Play

  • Press Enter to deal a card on your turn.

  • If the current card value matches the previous one, a SNAP opportunity is triggered.

  • Each player is prompted in turn to type snap within 2 seconds.

  • If the first player is too slow or types incorrectly, the second player gets a chance.

  • If both players fail to snap correctly in time, the game continues.

  • The game ends when a player wins by snapping correctly or when the deck runs out.

๐Ÿš€ How to Run

  1. Clone or download the project
     git clone git@github.com:Tannababy/naughts-crosses-game.git
  2. Open project in IDE. eg. InteliJ IDEA
  3. Navigate into project directory
     cd cardGame-Snap
  4. Compile the Code: Use the Java compiler to compile all your .java files.
     javac -d out $(find src/main/java/snap.cardGame "*.java")
  5. Run game
    java -cp out snap.cardGame.App

๐Ÿ™Œ๐Ÿพ Acknowledgments

A learning project to practice object-oriented programming, game logic, and console I/O handling in Java.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages