Snap Go
Snap Go
A Go implementation of the classic Snap card game, focused on clean game-state management, deterministic turn handling, and an easy-to-run terminal experience.
Repository: github.com/RikkiJJames/Snap-Go
Features
- Playable terminal card game loop with clear prompts and round progression.
- Single-player mode (against computer logic) and optional local two-player mode.
- Configurable reaction timing and difficulty behavior for CPU calls.
- Structured project layout for cards, deck, players, and game engine logic.
- Lightweight dependency footprint using the Go standard library.
How to Play
- Run the game binary.
- Select game mode (single-player or local two-player).
- Players alternate revealing cards from their decks.
- If two consecutive cards match by rank, call Snap as fast as possible.
- Fastest valid call wins the pile.
- Game ends when one player runs out of cards.
Controls
S: Player 1 calls SnapP: Player 2 calls Snap (two-player mode)Q: Quit the current game session
Requirements
- Go 1.21+ (or newer)
- Terminal environment (Windows, Linux, or macOS)
Run Instructions
go run ./cmd/snap-go
Build Instructions
go build -o snap-go ./cmd/snap-go
./snap-go
Suggested Project Structure
cmd/snap-go/main.go- Application entry pointinternal/game/- Core game loop and turn handlinginternal/deck/- Deck creation, shuffle, and draw logicinternal/card/- Card type and matching rulesinternal/player/- Player state and snap action handling
Engineering Notes
- The game loop is designed to keep state transitions explicit and testable.
- Card matching logic is isolated so rules can be extended later.
- Input handling is separated from game rules to support future UI changes.
Future Improvements
- Add automated tests for shuffle fairness and snap resolution edge cases.
- Add configurable keyboard bindings and accessibility-friendly prompts.
- Support online multiplayer with a simple TCP/WebSocket adapter