A deterministic NodeJS bot that plays on the hanab.live interface. Basic structure and ideas were taken from Zamiell's example bot (Python). You can play with it by inviting any of the will-bot
's to your table.
It can play with H-Group and Playful Sieve conventions. The goal of the bot is to play with humans, so it can handle suboptimal play within reason. However, it still expects that the conventions are followed (in terms of focus, chop, etc.) and does not perform any "learning" during a game.
A demo game at H-Group level 3:
A game played at H-Group level 5 can be seen here.
If you're interested in understanding how the bot works, I've written some documentation.
npm install
to install required dependencies.HANABI_HOSTNAME
.HANABI_USERNAME
and HANABI_PASSWORD
for the bot to log in.
npm start
to start the bot.
HANABI_USERNAME2
) and use npm start -- index=2
. See .env.template
for an example.hand <playerName> [observerIndex]
will display the information on that player's hand from a particular perspective.
state <attribute>
will display the internal value of the state's attribute (i.e. state[attribute]
).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
./rejoin
to rejoin a game that has already started (e.g. if it crashed)./leave
to kick the bot from your table./create <name> <maxPlayers> <password>
to have the bot create a table. The name can't have spaces./start
to have the bot start the game (only works if it is the table leader)./settings [conventions=HGroup,PlayfulSieve] [level]
to set the bot's conventions. To view the current settings, provide no parameters. The bot remembers its settings between games, but plays with H-Group conventions at level 1 on first boot.
/restart
and /remake
to have the bot perform the corresponding room actions after the game has finished (only works if it is the table leader).Some commands can be sent inside a room to affect all bots that have joined.
/setall [conventions=HGroup, PlayfulSieve] [level]
to set conventions and level for all bots./leaveall
to kick all bots from the table.A replay from hanab.live or from a file (in JSON) can be simulated using npm run replay [-- <options>]
. Possible options:
id=<id>
indicates the ID of the hanab.live replay to loadfile=<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=<HGroup, PlayfulSieve>
sets the conventions for the bot (defaults to HGroup)level=<level>
sets the HGroup level for the bot (defaults to 1)In a replay, the following commands are also supported (in addition to hand
and state
):
navigate <turn>
to travel to a specific turn.
+
(next turn), ++
(next turn of the same player), -
, and --
can also be used.The bot can play games with copies of itself using npm run self-play [-- <options>]
. Possible options:
players=<numPlayers>
sets the number of players (defaults to 2, max of 6 players)games=<numGames>
sets the number of games to play (defaults to 10)seed=<seed>
sets the seed of the first game to be played (defaults to 0)
variant=<variantName>
sets the variant to be played for all games (defaults to No Variant)convention=<HGroup, PlayfulSieve>
sets the conventions for the bot (defaults to HGroup)level=<level>
sets the HGroup level for the bot (defaults to 1)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.
Feel free to report any issues here!