Skip to content

To build a tic-tac-toe program that allows the user to play against the computer, with the computer always forcing the user to win.

Notifications You must be signed in to change notification settings

haimng/TicTacToe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

Goal

To build a tic-tac-toe program that allows the user to play against the computer, with the computer always forcing the user to win.

Solution

Using Minimax algorithm that calculates all possible moves from the current move, for each move find next possible moves until the end of game, and then assign score for each move based on the game's result. Finally, picking the moves with scores so that the computer always lose.

Reference: https://en.wikipedia.org/wiki/Minimax

How to run?

php TicTacToe.php

About

To build a tic-tac-toe program that allows the user to play against the computer, with the computer always forcing the user to win.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages