Skip to content

Latest commit

 

History

History
118 lines (107 loc) · 1.48 KB

README.md

File metadata and controls

118 lines (107 loc) · 1.48 KB

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.