A Tic-Tac-Toe RL agent that learns from human play over the internet.
Make sure that you have Docker and Docker Compose V2 installed before proceeding. All commands below should be run from the root directory of the project.
docker compose build
docker compose up -d
At this point, the system is running.
The frontend is available at http://localhost/
.
The Agent REST API is available at http://localhost/api/agent/
.
The Playdata REST API is available at http://localhost/api/playdata
.
PGAdmin (for interacting with the Postgres database) is available at http://localhost:8081/
.
docker compose down
docker compose rm
To reproduce the RL agent performance evaluation, you must:
- Create a Python virtual environment and install the requirements located in
api/requirements.txt
. - Install
jupyter
andmatplotlib
and run a Jupyter Notebook server by runningjupyter-notebook
. - Ensure the system running, such that the Postgres database is accessible from the host system on port
5432
. - Run the
api/agent-api/agent_performance.ipynb
Jupyter Notebook to evaluate the RL agent's performance when trained on the data available in the Postgres database.
Located in api/agent-api/
.
This is a Flask REST API that the frontend uses to get the agent's moves for Tic-Tac-Toe.
Located in api/playdata-api/
.
This is a Flask REST API that the frontend uses to submit Tic-Tac-Toe game data for training.
Located in api/tictactoe/
.
This is a library containing the core logic for the Tic-Tac-Toe RL agent. It is used by both the Agent and Playdata APIs.
Located in frontend/
.
This is a Next.js (a React framework) frontend that is compiled to static HTML. It contains a simple Tic-Tac-Toe UI.
Configured in postgres.sql
.
Postgres is used to store the recorded game data for training.
Configured in logstash.conf
.
Logstash consumes game data from the Kafka topic and stores it in Postgres.
Configured in nginx.conf
.
Nginx is used as a reverse proxy to expose the frontend, Agent API, and Playdata API over the same HTTP endpoint.