^This repository is an AI for https://cardgames.io/farkle/.
The AI named "You" is a userscript that users can install to play against the AI named "Bill" that is built-in to the website.
- Install a userscript manager, e.g. tampermonkey
- Click here to install the userscript from gh-pages
- Open https://cardgames.io/farkle/ to see it play
- Expected win rate against a perfect AI when you go first is 53.3% (from
cargo run --release -- exec
) - Against "Bill" from cardgames.io, 56.4%. So it is a bit stronger (by 3.1%)
JSON.parse(localStorage['farkleSolver.results'])
:{wins: 1260, loss: 974}
- Run
npm i
- Install wasm-pack
- Run
cargo install cargo-watch
- Run
npm start
- Install the userscript by opening
pkg/userscript.development.user.js
in your browser (by dragging on to the browser window) - Open https://cardgames.io/farkle/ to see it play, making sure only one of the userscripts (
farkle-development
,farkle-production
) is enabled
This project uses wasm-bindgen
to generate wasm files, which are imported by a userscript and run on a game on cardgames.io.
npm start
has three scripts:
wasm-pack
to compile rust to wasm, exporting topkg/
webpack
for theuserscript/
directory, exporting topkg/
http-server
of thepkg/
directory, so that the userscript can import the wasm and the cache files