Graphical Tic tac toe game using minimax algorithm
This package is written in two Python and Web versions. Both types have an attractive and interactive user interface, and the web version is flexible and customizable. In this project, the minimax algorithm is used in such a way that with every move you make on the screen, artificial intelligence predicts next moves and chooses the best move.
- A simple way to implement the MiniMax algorithm
- Customizable UI for web version
- Interactive UI/UX
- Web version has pure JavaScript (ES6+) with no libraries attached to it
- Ability to play in both X and O positions
The web version of this Tic tac toe game, has a beautiful graphical user interface and the ablity to change appearance and colors.
To use this version, you should have iceXO.css
and iceXO.js
added in your project.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>iceXO</title>
<link rel="stylesheet" href="./css/iceXO.css">
</head>
<body>
<main></main>
<script src="./js/iceXO.js"></script>
</body>
</html>
Then simply call the iceXO
object and pass the parent element to it (e.g .parent, #parent, div)
<script>
IceXO.play('main')
</script>
You can also customize it by passing settings
parameter to the object.
IceXO.play('main', {
boardColor: '#EEEEEE',
body: 'white',
fancyColor: '#32E0C4',
xColor: '#222831',
oColor: '#393E46',
gameOver: function (winner){
alert(`${winner || 'No one'} wins the game.`)
}
})
Thanks to Pygame, the Python version also has an interactive user interface.
To use the Python version, at first you should install libraries.
pip3 install -r requirements.txt
To play tic tac toe run the runner.py
file.