A deterministic Scala bot that plays on the hanab.live interface. Basic structure and ideas were taken from Zamiell's example bot (Python). Fork of my more-developed bot (JavaScript), successor of the Rust rewrite.
It can play with Reactor 1.0 (3p only), Referential Sieve, or H-Group (up to level 10) conventions. Just like my other bots, it does not do any "learning" during the game.
A demo game using Reactor 1.0 conventions with the Critical Fours variant:
reactor1_c.mp4
- Supports all the basic variants (Black, Rainbow, White, Prism, Pink, Brown + blends).
- Takes notes during the game on what it thinks each player knows about their own hand.
- Can replay completed games on hanab.live and offer suggested actions.
- You'll need to have Scala and Coursier installed. There are instructions here.
- Clone the repository to your own computer. There are lots of tutorials online on using Git if you don't know how that works.
- Navigate to the cloned repository in a terminal.
- Fill out the login details for the bot in an .env file. See .env.template for an example.
- You'll need to create its account on hanab.live first.
- Run
scala-cli . --main-class scala_bot.main -- index=<index>to start the bot. - Debug logs will show up in the console, providing more information about what the bot thinks about every action.
hand <playerName> [observerName]will display the information on that player's hand from a particular perspective.- If no observer name is provided, the hand will be logged from the common knowledge perspective.
- Compiling a Scala program can be memory-intensive, so you may want to package an executable file that can be run elsewhere.
- Use
scala-cli --power package . --main-class scala_bot.main -o bot --assembly. - Add
--preamble=falseto create a jar instead (more portable).
- Use
Send a PM to the bot on hanab.live (/pm <HANABI_USERNAME> <message>) to interact with it.
/join [password]to join your current lobby. The bot will remain in your table until it is kicked with/leave./rejointo rejoin a game that has already started (e.g. if it crashed)./leaveto kick the bot from your table./settings [convention=Reactor,RefSieve,HGroup] [level=1-10]to modify the convention set./versionto get the current version of the bot./helpto get a link back to this page.
Some commands can be sent inside a room to affect all bots that have joined.
/leaveallto kick all bots from the table./setallto set the same settings for all bots at the table.
A replay from hanab.live or from a file (in JSON) can be simulated using scala-cli . --main-class scala_bot.replay -- <options>.
id=<id>indicates the ID of the hanab.live replay to load.file=<filePath>indicates the path to the JSON replay to load (relative from the root directory).index=<index>sets the index of the player the bot will simulate as (defaults to 0).convention=<conventionName>sets the convention set (defaults to Reactor 1.0).level=<level>sets the level of the convention set (defaults to 1, if applicable).
In a replay, the following commands are also supported (in addition to hand):
navigate <turn>to travel to a specific turn.- If it is the bot's turn, it will provide a suggestion on what it would do.
- Instead of a turn number,
+(next turn),++(next turn of the same player),-, and--can also be used.
The bot can play games with copies of itself using scala-cli . --main-class scala_bot.selfPlay [-- <options>]. Possible options:
games=<numGames>sets the number of games to play (defaults to 1).seed=<seed>sets the seed of the first game to be played (defaults to 0).- The seeding algorithm is different from the one used on hanab.live.
players=<numPlayers>sets the number of players.convention=<conventionName>sets the convention set (defaults to Reactor 1.0).level=<level>sets the level of the convention set (defaults to 1, if applicable).
The final score for each seed as well as how each game terminated are logged to the console. JSON replays of each game are saved to a seeds folder, which can be loaded into hanab.live for viewing.