Skip to content

TERNION-1121/Tic-Tac-Toe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 

Repository files navigation

❌ Tic-Tac-Toe ⭕


This program is a Tic-Tac-Toe boardgame, which can be played in the terminal/console window; made in C.

image

Modes available to play:

  1. Human v/s Human.
  2. Human v/s A.I.

func main()

It comprises of various other functions, which control the various parts of the game. Although the two main ones being:

  • func human_vs_human()
  • func human_vs_ai()

human_vs_human()

It allows two humans to play against each other, each time the turn alternating.

image image image

Upon game over, it stops the game.

image


human_vs_ai()

Initially, it offers a choice to the user.

image

Upon choice, The game starts accordingly.

If the AI has to make the first move, it makes a random move using the func random_pos().

Otherwise, it makes use of the minimax algorithm to find the best possible move. The A.I. move is determined upon the use of the functions minimax() and find_best_move().


P.S. You can't win against the A.I. 😉, it's either a draw, or a win for the computer.. Enjoy!

You are free to contribute for this repository!