This repository holds code for the A.I. model we made for playing the board game of Go. We are developing the algorithms used to develop AlphaGo Zero, as a lite version. It also holds web application code for a Go-playing website where users can play against each other or play against the A.I.
It is still a work in progress.
Heroku did not turn out great due to slow deployment and not giving us enough memory to install the GPU version of TensorFlow. So, we are currently looking for other options.
.babelrc
, package.json
, and webpack.config.js
were needed
to get the frontend set up. Apparently, Heroku cannot process my frontend files without doing this.
Procfile
categorizes and lists the main commands to be run.requirements.txt
sets the Herokupip
to install the necessary packages. (tensorflow-cpu
, as opposed to the GPU version, is needed due to memory constraints of the slug size. Even the current slug size is not optimal, since it is over the soft limit, which affects booting time. Knoweldge of this came from the Heroku app build logs.)runtime.txt
specifies the version of Python to run.
Modifying settings.py
Heroku has some environmental variables set up. Local variables and deployment variables are distinguished in that file.
Inside of play_go_web_app/play_go_web_app
, create django_secrets.py
and create two string variables SECRET_CODE
and SECRET_HOST
to be used in settings.py
if deployment is your priority.
Otherwise, simply get rid of the import .django_secrets ...
statement in settings.py
and the corresponding variables and make the secret key an empty string. ALLOWED_HOSTS
can just be an empty list.
Note: Docker
is needed no matter if you run the Docker way or the local way. You need Docker at least for installing redis
, which enables web socket functionality.
If you plan on running docker-compose.yml
, create an.env
file on this project's directory and set SECRET_HOST
to whatever you desire (e.g., a website domain for deployment).
Navigate to the environment file location
on your terminal.
conda env create -f environment.yml
conda activate alphagolite
cd play_go_web_app
again
In settings.py
, in CHANNEL_LAYERS
, change 'sockets'
-> 'localhost'
On one terminal, perform:
python manage.py makemigrations
(also run this with every Django model change)
python manage.py migrate
(also run this with every Django model change)
python manage.py runserver
Install Node.js
.
On a separate terminal, perform:
cd frontend
npm install
(for getting package.json
dependencies)
On the other terminal, perform:
cd frontend
npm install
npm run dev
docker run -p 6379:6379 -d redis:5
File | Description |
---|---|
Frontend | Frontend displaying multiplayer, real-time gameplay, with abilities for users to create their own rooms or join a room. |
Backend | Backend with an API responsible for fetching information about rooms from a database. |
test_tf.py | the TensorFlow quickstart tutorial code (used for testing purposes on a Linux-based computer science machine found at my college) |
docker-compose.yml | runs Docker images for Django backend and React frontend for deployment/compatability purposes |
-
TechWithTim's Music Controller Web App Tutorial helped us immensely with starting this project's web app. His tutorial is on YouTube.
-
Django Channels Tutorial from the docs helped us build sockets for real-time communication across clients viewing or partiicpating in gameplay inside a Room.
-
Django Channels Deploying helped with debugging deployment issues with Heroku (if only I had seen this first, I would not have dealt with the many deployment errors I did on 5/29/2022.)
-
GymGo helped us with setting up the Go board game environment, taking care of implementation details such as valid moves, generating board symmetries, playing moves, and rendering board states.
-
Beginner’s Guide to Custom Environments in OpenAI’s Gym helped us integrate the
GymGo
repository into ouralgorithms
folder.