A terminal-based implementation of the Twixt board game built in C. This project simulates a two-player strategy game where players create links between points to form a winning path across the board.
- Two players: Red and Blue
- Played on a 24 × 24 grid
- Players take turns placing pieces
- Automatic links are formed between valid positions
- Links cannot intersect (core rule of Twixt)
- 🔴 Red wins by connecting TOP → BOTTOM
- 🔵 Blue wins by connecting LEFT → RIGHT
- Turn-based two-player system
- Real-time board updates
- Input validation for moves
- Automatic link creation
- Knight-move based linking (like chess)
- Prevents crossing links using geometry
- Highlights linked nodes
- Graph traversal using DFS
- Detects continuous path for victory
- Efficient checking using visited matrix
- Grid-based board display
- Colored output for players
- Highlighted linked connections
-
Language: C
-
Concepts Used:
- Graph traversal (DFS)
- Linked Lists
- Geometry (line intersection)
- Modular programming
- Dynamic memory allocation
Twixt/
│── Board_withmain.c / .h # Game loop & board logic
│── Links.c / .h # Link creation & intersection logic
│── Win_Win.c / .h # Win detection (DFS traversal)
│── Makefile # Build configuration
- The board is initialized with empty cells
- Each move updates the board and stores history
- Valid links are created based on knight-move distance
- Link intersections are prevented using cross-product logic
- Win condition is checked using DFS traversal across links
make./twixt- Run the program
- Enter moves in format:
row column
Example:
5 12
- Players alternate turns automatically
- Implements real Twixt game rules
- Uses geometry to prevent illegal links
- Applies graph theory (DFS) for win detection
- Efficient memory usage with linked structures
- Improve UI with better visuals
- Multiplayer over network
- Save/load game feature
This project is open-source and available under the MIT License.