Skip to content

atenadadkhah/iceXO

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

78 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

iceXO - A Tic Tac Toe Game With AI


Graphical Tic tac toe game using minimax algorithm


About iceXO

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

Web version

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.`)
    }
})

iceXO web version

Python version

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.

iceXO python version