Skip to content

Using reainforcement learning to learn a machine to play tic-tac-toe.

Notifications You must be signed in to change notification settings

gimse/TicTacToeAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tic-Tac-Toe AI

Using reinforcement learning to learn a machine to play the game.

Getting Started

Run the game.py to play

Example

Welcome to Tic Tac Toe!
The computer will go first.
The computer moved.
   |   |
   |   |  
   |   |
-----------
   |   |
   |   |  
   |   |
-----------
   |   |
 O |   |  
   |   |
What is your next move? (1-9)
8
You moved.
   |   |
   | X |  
   |   |
-----------
   |   |
   |   |  
   |   |
-----------
   |   |
 O |   |  
   |   |
The computer moved.
   |   |
 O | X |  
   |   |
-----------
   |   |
   |   |  
   |   |
-----------
   |   |
 O |   |  
   |   |
What is your next move? (1-9)
4
You moved.
   |   |
 O | X |  
   |   |
-----------
   |   |
 X |   |  
   |   |
-----------
   |   |
 O |   |  
   |   |
The computer moved.
   |   |
 O | X |  
   |   |
-----------
   |   |
 X | O |  
   |   |
-----------
   |   |
 O |   |  
   |   |
What is your next move? (1-9)
3
You moved.
   |   |
 O | X |  
   |   |
-----------
   |   |
 X | O |  
   |   |
-----------
   |   |
 O |   | X
   |   |
The computer moved.
   |   |
 O | X | O
   |   |
-----------
   |   |
 X | O |  
   |   |
-----------
   |   |
 O |   | X
   |   |
The computer has beaten you! You lose.
Do you want to play again? (yes or no)
n

Prerequisites

Numpy is required

Authors

  • Håkon Gimse - Initial work - Gimse

See also the list of contributors who participated in this project.

About

Using reainforcement learning to learn a machine to play tic-tac-toe.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages