Sylhet Engineering College, Sylhet
Department of Computer Science & Engineering
4th Year 1st Semester Final Exam-2024
Course: CSE 704 (Artificial Intelligence Sessional)
Build an AI Agent for Ultimate Tic-Tac-Toe
Mode: Human vs AI
Language: Any (C / C++ / Java / Python, etc.)
Problem Statement
In this lab project, you are required to design and implement an AI agent that plays Ultimate
Tic-Tac-Toe against a human player. The program must follow all game rules and alternate
turns between the human player and the AI agent until the game ends.
Game Overview (Very Important)
● The game consists of 9 small Tic-Tac-Toe boards arranged in a 3×3 large board.
● Winning a small board follows the normal rules of Tic-Tac-Toe.
● Winning the game requires winning 3 small boards in a row on the large board.
Move Rule
● The cell number played by a player determines the small board where the next player must
play.
● If that board is already full or won, the next player may choose any available board. (You
can also search for the game rules on the Internet for reference)
Program Flow
1. Display the full board.
2. Ask the human for a move (board number + cell number).
3. Validate the move according to the rules.
4. Update the board.
5. The AI computes and plays its move.
6. Repeat until a win/draw.
After every human move, the AI must respond immediately with its own move.
AI Requirements
● Use the Minimax algorithm
● Alpha–Beta pruning is recommended
● Depth-limited search is allowed
State Representation (Suggested)
● board[9][9] → game cells
● smallBoardStatus[9] → win/draw/ongoing
● nextBoard → board where the next move must be played
Output Requirements
● Display the board after each move
● Show AI’s chosen move
● Print final result:
○ Human wins
○ AI wins
○ Draw
Submission
Students must submit:
1. Source code
2. Short explanation of:
○ State representation
○ Algorithm used
3. Sample run (input/output)