Skip to content

Full-stack project involving creating A.I. model (largely inspired by AlphaGo) to play Go and an interface to play with other players and play against the A.I.

License

Notifications You must be signed in to change notification settings

joegenius98/AlphaGoLite

Repository files navigation

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.

Heroku-Specific Deployment

Modifying Frontend Structure

.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.

Adding New Files

  • Procfile categorizes and lists the main commands to be run.
  • requirements.txt sets the Heroku pip 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.

Local Development

How to Run

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.

Docker Way

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).

Local Way

Navigate to the environment file location on your terminal.

conda env create -f environment.yml

conda activate alphagolite

The backend:

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

The frontend

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

Redis

docker run -p 6379:6379 -d redis:5

Structure

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

Sources

About

Full-stack project involving creating A.I. model (largely inspired by AlphaGo) to play Go and an interface to play with other players and play against the A.I.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published