{"id":20960314,"url":"https://github.com/instance01/bootlegalphazero","last_synced_at":"2025-09-02T16:36:45.167Z","repository":{"id":68070187,"uuid":"258579896","full_name":"instance01/BootlegAlphaZero","owner":"instance01","description":"AlphaZero written in C++, for research. Includes some tangential goodies such as imitation learning, Python implementations and a plethora of experiments.","archived":false,"fork":false,"pushed_at":"2020-08-12T16:47:59.000Z","size":85558,"stargazers_count":4,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-20T00:35:50.676Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/instance01.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-24T17:34:34.000Z","updated_at":"2022-10-10T00:13:28.000Z","dependencies_parsed_at":"2023-07-02T18:00:09.214Z","dependency_job_id":null,"html_url":"https://github.com/instance01/BootlegAlphaZero","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/instance01%2FBootlegAlphaZero","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/instance01%2FBootlegAlphaZero/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/instance01%2FBootlegAlphaZero/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/instance01%2FBootlegAlphaZero/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/instance01","download_url":"https://codeload.github.com/instance01/BootlegAlphaZero/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243358211,"owners_count":20277991,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-19T01:58:22.325Z","updated_at":"2025-03-13T06:42:47.456Z","avatar_url":"https://github.com/instance01.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"This is a bootleg version of AlphaZero written in C++17, purely using only the PyTorch C++ Frontend. It also includes some work leading up to it such as MCTS, imitation learning and a Python implementation (which I stopped working with due to performance). I tried a kind of bridge whereas the C++ code is the main program which only calls gym routines in Python using the Python C API, but unfortunately that turned out to be too slow. Thus, I went for a pure C++ version and included a few environments from [openai/gym](https://github.com/openai/gym/) rewritten in C++ (see the envs folder).\n\nBelow is the result of training 10 times on MountainCar using bootleg AlphaZero with parameter configuration 127. More current configurations can be seen [here](https://github.com/instance01/BootlegAlphaZero/blob/master/alphazero/cpp_impl/results.md).\n\u003cimg src=\".github/cpp_mtcar_127.png\" /\u003e \n\nQuite the variance, and takes ages to learn (roughly 6 hours to be more precise). Needs more work.\n\n## Setup with Docker\n\nThese are instructions for the C++ version.\n\n1. Go to `alphazero/contrib` and build the Docker image: `sudo docker build -t grab0 -f Dockerfile .`.\n2. Go to `alphazero/cpp_impl` and run the Docker image: `sudo docker run -v $(pwd):/app --privileged -it grab0 bash`.\n3. In the Docker image execute `setup` to compile.\n4. BootlegAlphaZero can be run as `./GRAB0 \u003cgame\u003e \u003cparameters\u003e`, e.g. `./GRAB0 mtcar 133`. All parameters are listed in `simulations.json`.\n\n## Setup without Docker\n\nThis is for Debian Buster. This could be automated at some point.\n\n1. Go to `alphazero/contrib`.\n2. Run `printf \"deb http://httpredir.debian.org/debian buster-backports main non-free\\ndeb-src http://httpredir.debian.org/debian buster-backports main non-free\" \u003e /etc/apt/sources.list.d/backports.list`.\n3. Run `apt-get update --allow-releaseinfo-change \u0026\u0026 apt-get install -t buster-backports -y g++ vim gdb cmake python3-dev wget unzip git libprotobuf-dev libprotobuf17 protobuf-compiler nlohmann-json3-dev`.\n4. Run `pip3 install pytest numpy cython torch gym gym-minigrid git+https://github.com/instance01/gym-mini-envs.git`.\n5. Go to `alphazero/cpp_impl`.\n6. Run `cmake . \u0026\u0026 cmake --build .`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finstance01%2Fbootlegalphazero","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finstance01%2Fbootlegalphazero","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finstance01%2Fbootlegalphazero/lists"}