Skip to content

yribeiro/gpt4-tictactoe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GPT4 TicTacToe

Play TicTacToe against ChatGPT!

Installation

Clone the repository into a local directory and cd into it:

git clone [email protected]:yribeiro/gpt4-tictactoe.git
cd ./gpt4-tictactoe

Create a python virtual environment using:

python3 -m venv .venv

Install the necessary requirements from requirements.txt file:

pip3 install -r requirements.txt

Getting Started

The application requires a valid OpenAPI key to be root folder of the repository.

Create an .env file in the root repository.

touch ./.env

Enter the following contents:

OPENAI_API_KEY=<ENTER_YOUR_KEY>

Launch the TicTacToe WebApp

Activate the virtual environment using

source ./.venv/bin/activate

Launch the server using the streamlit commands:

streamlit run main.py

Your default browser should open up to the default app page.

Beat ChatGPT

Enter X and hit Enter to start playing:

Enter your first move from the choices:

[(1, 1), (1, 2), (1, 3), (2, 1), (2, 2), (2, 3), (3, 1), (3, 2), (3, 3)]

E.g. 2, 2 and hit Enter

ChatGPT will response and the board will get drawn.

Continue entering moves, till the game is over.

Hit Ctrl+F5 to refresh the app and start a new game!

Feature Roadmap

  • Allow ChatGPT to start first
  • Generate image using DallE for the tic tac toe board representation
  • Allow user to select style for the board image
  • Refactor to include Controller that can be extended for Console and WebApp interaction
  • Generate text to voice functionality to allow ChatGPT to describe it's move
  • Allow user to select voice type for ChatGPT
  • Allow user to play in console mode

About

Repository showcasing how to build a tictactoe bot using chatgpt and other AI tools.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages