π Landing Page: https://tuckerbrewer12.github.io/FourtyTwo/
A real-time multiplayer implementation of 42, the classic Texas domino trick-and-trump game invented in 1885.
Quick start:
pip install flask flask-socketio eventlet && python server/fourty_two_socketio_server.pyβ openhttp://localhost:5000
42 is a domino game for four players divided into two teams (players 1 & 3 vs. players 2 & 4). It is played with a standard double-six domino set (28 dominoes). Each hand consists of a bidding phase and a trick-taking phase, similar to the card game Spades.
[5|0] = 5 points, [5|5] = 10 points, [6|4] = 10 points, [5|4] = 0 (not divisible by 5)The static landing page in docs/ is automatically deployed to GitHub Pages via the workflow at .github/workflows/pages.yml. Every push to main redeploys the landing page.
To enable GitHub Pages in your fork:
main will deploy the siteThe landing page is 100% static HTML/CSS/JS β no build step required.
FourtyTwo/
βββ docs/ # β Static GitHub Pages landing page
β βββ index.html
βββ .github/workflows/
β βββ pages.yml # β Auto-deploy docs/ to GitHub Pages
β
βββ domino.py # Domino class: comparison, value, suit logic
βββ domino_set.py # DominoesSet: full 28-domino set, shuffle & deal
βββ player.py # Player class: hand management, move validation
βββ fourty_two_game.py # FourtyTwo game engine: bidding, trick play, scoring
βββ console_game.py # Interactive CLI game runner
β
βββ server/
β βββ fourty_two_socketio_server.py # Flask-SocketIO real-time multiplayer server
β βββ templates/
β βββ index.html # Game SPA frontend
β
βββ test_domino.py # Unit tests for Domino
βββ test_domino_set.py # Unit tests for DominoesSet
βββ test_player.py # Unit tests for Player
βββ test_fourty_two.py # Unit tests for FourtyTwo game logic
βββ test_fourty_two_server.py # Integration tests for Flask API
βββ test_stress.py # Stress / concurrency tests
pip install flask flask-socketio
python console_game.py
cd server
python fourty_two_server.py
The server starts on http://localhost:5000.
All endpoints accept and return JSON.
| Method | Endpoint | Description |
|---|---|---|
| POST | /start |
Start a new game |
| POST | /join |
Join the game (returns your player number 1β4) |
| POST | /shuffle |
Deal dominoes (requires all 4 players joined) |
| POST | /bid |
Submit a bid {player_num, bid, marks} |
| GET | /get_high_bid |
Get the current highest bid |
| POST | /set_trump |
Set trump suit {trump: 0β6} |
| POST | /play |
Play a domino {player_num, move: [a, b]} |
| POST | /get_hand |
Get a playerβs hand {player_num} |
| POST | /get_trick |
Get the dominoes in the current trick |
| POST | /get_winner |
Evaluate the completed trick and update scores |
| GET | /health |
Health check |
curl -X POST http://localhost:5000/start
curl -X POST http://localhost:5000/join -H "Content-Type: application/json" -d '{"name": "Alice"}'
# Returns: {"ok": true, "player_num": 1, "name": "Alice", "players": 1}
python -m unittest discover -v
Tests are written with Pythonβs built-in unittest framework.
Dominofrom domino import Domino
d = Domino([5, 3])
d.value() # 0 (8 is not divisible by 5)
d.contains(5) # True
d.high_side() # 5
d.low_side() # 3
str(d) # "[5|3]"
FourtyTwofrom fourty_two_game import FourtyTwo
game = FourtyTwo()
game.join() # Player 1 joins
game.shuffle() # Deal dominoes
game.bid(1, 32) # Player 1 bids 32
game.set_trump(5) # Trump is 5s
game.play(1, Domino([5,3])) # Player 1 plays [5|3]
winner = game.get_trick_winner()
game.set_winner(winner)