Note
This is a community-maintained fork of a MIT-licensed student project in the Effective Programming with Effects course in winter semester 2024/2025. Be warned that this is not an officially endorsed project, the code in this repository may be not idiomatic Effekt.
The original repository is https://github.com/dzianis-sudkou/effekt_ultimate_tictac
An advanced version of the classic Tic-Tac-Toe game with a twist. The game consists of a 3x3 grid of Tic-Tac-Toe boards, where each move determines the board on which the opponent must play next. This implementation features an advanced AI opponent and a polished terminal interface.
- A 3x3 grid of Tic-Tac-Toe boards.
- Standard Tic-Tac-Toe rules apply to each individual board.
- A move in one of the small boards determines the next board to play in.
- Win conditions for both individual boards and the overall game.
- A user-friendly terminal graphical interface.
- Basic game Logic for a single-player mode.
- Computer opponent logic with different difficulty levels:
- Easy: Basic strategy
- Medium: 3-move lookahead
- Hard: 5-move lookahead with advanced evaluation
- Customizable themes and board designs.
- Replay functionality to review past games.
- Integration with social media platforms.
- In-game hints and move suggestions.
- Complex animations or 3D graphics.
- Event handlers for user interactions (e.g., making a move, restarting the game).
- Effects for updating the UI based on game state changes.
- Terminal output library for rendering the game interface with ANSI colors
- Current implementation uses:
- Official List library for board representation
- Official String library for text processing
- Official Console library for user input
- TTY library for terminal manipulation
src/
├── main.effekt # Entry point and game initialization
├── game.effekt # Core game logic and flow control
├── lib.effekt # Common utilities, types, and effects
├── opponent.effekt # AI implementation with minimax algorithm
├── render.effekt # Terminal UI rendering
├── generate.effekt # Board generation and management
└── test.effekt # Comprehensive test suite
To run the project, you need to have Effekt installed on your machine. You can find instructions on how to install Effekt here
effekt src/main.effekt --backend js --includes .
effekt src/test.effekt --backend js --includes .
- Numbers 1-9: Select board/cell position
- 'h': Display help and game rules
- 'b': Show board position guide
- 'q': Quit game
- Minimax algorithm with alpha-beta pruning
- Position evaluation heuristics
- Three difficulty levels
- Strategic decision making prioritizing:
- Winning moves
- Blocking opponent wins
- Strategic side moves
- Color-coded game elements
- Clear game state visualization
- Interactive help system
- Board position guide
- Game mode selection menu