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

  1. Run the game binary.
  2. Select game mode (single-player or local two-player).
  3. Players alternate revealing cards from their decks.
  4. If two consecutive cards match by rank, call Snap as fast as possible.
  5. Fastest valid call wins the pile.
  6. Game ends when one player runs out of cards.

Controls

  • S: Player 1 calls Snap
  • P: 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 point
  • internal/game/ - Core game loop and turn handling
  • internal/deck/ - Deck creation, shuffle, and draw logic
  • internal/card/ - Card type and matching rules
  • internal/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