A simple 2 player Snap card game built in Java and played in the command line.
Players take turns drawing cards. If two consecutive cards share the same symbols (e.g. two Kings or two 7s), the current player must type 'snap' within 2 seconds to win.
- Run the program.
- Choose to view instructions or start the game.
- Enter both players' names.
- The game automatically creates and shuffles the deck, then randomly selects who goes first.
- Players press ENTER to draw cards.
- If two consecutive cards match:
- Type 'snap' within 2 seconds to earn 1 point.
- Incorrect or late responses result in no points.
- The player earns 1 point for each correct Snap, and the highest score wins.
- f the deck runs out without a match, the round ends in a draw.
- After each game, enter 'y' to play again or 'n' to exit.
- Visit: https://github.com/annalin2000/snap-game
- Click the
<> Codebutton. - Select your preferred method (HTTPS, SSH, or GitHub CLI).
- Copy the repository URL.
- Open Terminal and navigate to your desired directory.
- Run:
git clone <repository URL>- Move into the project folder:
cd snap-game- Compile the program:
javac -d out src/main/Main.java- Run the game:
java -cp out main.MainFollow the on screen prompts to begin playing.
- Fork the repository:
- Clone your fork:
git clone https://github.com/<your-username>/snap-game.git
cd snap-game- Create a Branch
git checkout -b feature/your-feature-name- Commit and push your changes
git add .
git commit -m "Clear description of your change"
git push origin feature/your-feature-name- Open Pull Request
- Go to your fork on GitHub and click Compare & Pull Request.
- Explain clearly what you changed and why.
If you enjoyed the game or have suggestions for improvement, feel free to open an issue or submit a pull request.
Thanks for playing!