Skip to content

Latest commit

 

History

History
38 lines (28 loc) · 1.55 KB

README.md

File metadata and controls

38 lines (28 loc) · 1.55 KB

Tic-tac-toe

Purpose

The objective is to create a game that plays Tic-tac-toe optimally against the player no matter if the player starts first or second.

Tic-tac-toe Wikipedia

Rules

  • The player can choose if he starts first or second.
  • The game should display the current state.
  • The game should display who is the winner.
  • The program should play optimally against the opponent.

About the program

The program uses the algorithm Min-Max with Alpha-Beta pruning to play the game. When the game is started the user chooses if he wants to play first or second. According to that the program adapts and chooses the best move.

To run the program

  • Build it using make
  • Run ./main

Output

  • Initially the program asks the user if he wants to start first.
  • Displays current state.
  • Displays who won the game or 'Draw' in case of draw.

Output - initial

Output-initial

Output - current state - part 1

Output-current-state-1

Output - current state - part 2

Output-current-state-2

Output when the AI won

Output-AI-won

Output - draw

Output-Draw