https://github.com/grimmerk/alphago-zero-tictactoe-js
A game framework based on AlphaZero/TensorFlow.js runs in browser to demonstrate tic-tac-toe AI game. Use a pre-trained model or train from scratch. Ported from suragnair/alpha-zero-general (Python)
https://github.com/grimmerk/alphago-zero-tictactoe-js
alphazero browser cnn create-react-app deep-learning game javascript monte-carlo-tree-search neural-network numjs reactjs reinforcement-learning semantic-ui skip-resnet-implementation tic-tac-toe tictactoe
Last synced: 3 months ago
JSON representation
A game framework based on AlphaZero/TensorFlow.js runs in browser to demonstrate tic-tac-toe AI game. Use a pre-trained model or train from scratch. Ported from suragnair/alpha-zero-general (Python)
- Host: GitHub
- URL: https://github.com/grimmerk/alphago-zero-tictactoe-js
- Owner: grimmer0125
- License: mit
- Created: 2018-04-22T06:01:44.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T02:49:57.000Z (almost 3 years ago)
- Last Synced: 2024-04-28T04:58:14.340Z (over 1 year ago)
- Topics: alphazero, browser, cnn, create-react-app, deep-learning, game, javascript, monte-carlo-tree-search, neural-network, numjs, reactjs, reinforcement-learning, semantic-ui, skip-resnet-implementation, tic-tac-toe, tictactoe
- Language: JavaScript
- Homepage:
- Size: 5.07 MB
- Stars: 39
- Watchers: 6
- Forks: 6
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AlphaGo Zero Tictactoe JS
Try it: https://grimmer.io/alphago-zero-tictactoe-js/. Google DeepMind AlphaGo uses enhancement learning and the algorithm is a composite of
1. Policy Network
2. Value Network
3. Monte Carlo tree search (MCTS)## Installation
```
npm install
```### Dev
```
npm start // build and launch its live dev web server.
```After `npm start`, you can also use `VS Code` with `Debugger for Chrome` extension to debug.
### TypeScript Support and Vite
This project has been migrated to TypeScript and now uses Vite! You can:
```
npm run dev # Start Vite development server
npm run start # Alias for npm run dev
npm run build # Build production bundle
npm run preview # Preview production build
npm run typecheck # Run TypeScript check without emitting files
npm run ts:watch # Watch for TypeScript errors in real-time
```See [TYPESCRIPT.md](TYPESCRIPT.md) for more details on the TypeScript conversion.
### Deployment
```
npm run deploy
```## Features and done itmes of todo list
1. Ported the algorithms from [alpha-zero-general](https://github.com/suragnair/alpha-zero-general). Although its name is `alpha-zero-general`, it is based on AlphaGo Zero algorithm.
2. Import pretrained models from [alpha-zero-general](https://github.com/suragnair/alpha-zero-general) and run alphago game algorithms on Browsers.
`alpha-zero-general` is a project to supply general game AI training frameworks. You can extend that project and add yourself game rule codes and train AI model
by using Python.## TODO
1. ~~Fix bugs to train models by this JavaScript version project. It may be a TensorFlow.js bug. Maybe waitting for native TensorFlow Node.js binding is better than WebGL solution.~~
2. ~~Add UI.~~
3. Clean up. (50%)
4. Use service worker for cpu heavy loading part.
5. ~~Use TypeScript instead~~ (Done! See [TYPESCRIPT.md](TYPESCRIPT.md))## AlphaZero
To overcome some API limitation (Tensorflow.js export/save model/weights), so this JavaScript repo borrows one of the features of AlphaZero, **always accept trained model after each iteration without comparing to previous version**