Skip to content

effekt-community/ultimate-tictactoe

 
 

Repository files navigation

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

Ultimate Tic-Tac-Toe Game

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.

Must-have

  • 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.

Can-have

  • 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.

Will-not-have

  • Integration with social media platforms.
  • In-game hints and move suggestions.
  • Complex animations or 3D graphics.

Effects and handlers

  • Event handlers for user interactions (e.g., making a move, restarting the game).
  • Effects for updating the UI based on game state changes.

FFI and libraries

  • 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

Project Structure

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

Running The Project

To run the project, you need to have Effekt installed on your machine. You can find instructions on how to install Effekt here

For Development

effekt src/main.effekt --backend js --includes .

Running Tests

effekt src/test.effekt --backend js --includes .

Game Controls

  • Numbers 1-9: Select board/cell position
  • 'h': Display help and game rules
  • 'b': Show board position guide
  • 'q': Quit game

Features

AI Implementation

  • Minimax algorithm with alpha-beta pruning
  • Position evaluation heuristics
  • Three difficulty levels
  • Strategic decision making prioritizing:
    1. Winning moves
    2. Blocking opponent wins
    3. Strategic side moves

User Interface

  • Color-coded game elements
  • Clear game state visualization
  • Interactive help system
  • Board position guide
  • Game mode selection menu

Resources

About

Ultimate Tic-Tac-Toe Game written in Effekt Language, originally dzianis-sudkou/effekt_ultimate_tictac

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Nix 100.0%