Skip to content

XenonHan/tic-tac-toe-with-Q-learning

Repository files navigation

About

This is a simple tic tac toe program with Q-learining. You will play the game with an agent that you properly cannot win.

How to run the program

For the new version WITH GUI:

Dependicies

  1. future
  2. pillow
  3. ctypes (windows only)

To execute the program:

  1. Clone the program and go to the program directory.
  2. In the proram loacation, run "python3 ./game_launcher.py" or "py ./game_launcher.py" (windows) on command prompt

Preview

AI_win

draw

select

For the old command prompt version:

To execute the program:

  1. Clone the program and go to the program directory.
  2. Make sure the program main.py and checkpoint files are loacte in the same location
  3. In the proram loacation, run "python3 ./old_version.py" with command prompt

To play the Tic-Tac-Toe:

  1. After you execute the program, you would see a prompt to ask you to play first or second: "input 1 if you want to play first, otherwise input 2:"
  2. If you want to play first, input 1; If you want to play after the agent, input 2. OR input 3 to train the AI agent
  3. Input the grid number you wnat to input: the input must be integer from 0 to 8, 0 means the first grid and 8 mean the last grid. Counting from left to right, up to down.
  4. By checking the game board printing on the console, keep playing the game with agent until you win or loss or the game drawn.
  5. After you win/loss/draw, a prompt will be printed to tell you.

About

A simple tic tac toe grame with Q-learining.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages