| ParlorNet Turn-based game server for any computer, old or new | |
| Clients | Protocols | Browsers | Telnet programs | Docs | Source |
The bot is a player anyone can invite to a table, so a player who is alone on a server can still play every game. It plays one simple strategy per game: good enough to beat a player who moves at random, easy enough to beat with some thought.
The bot is a program of its own (bot/), a client of the core like the web or telnet server extensions. It reaches the core on the extension channel (TLS 1.3) with its own key, named bot, and signs in with a bot name alone:
Why the extension channel and not the public port: there the bot needs no password or authenticator secret, so it holds no credential but its key; the key is enrolled, rotated and revoked like every server extension's (python -m parlord.frontends), and rotating it ends the bot's sessions; and the core can tie the bot names to that one key, so no person can sign in as a bot even on a server with sign-in none.
In the container. The bot is in the admin menus' Adapters list (bot, no port) and on by default. deploy/start.py enrols its key at the first start (/data/frontends/bot.key) and starts it with the others; a change takes effect when the container restarts. Under the opt-in user per process, it runs as pn-bot (uid 10050) and reads only its own key.
On its own, against any ParlorNet server whose operator gave you a key named bot:
python -m parlord.frontends --keys /data/frontends add bot # on the server python3.13 -m bot --core HOST:6590 --key bot.key # where the bot runs
Options: --names (the bot names to play as, default all four), --cap (tables at once for each name, default 20), --think (seconds before each turn, default 0.5,2), --pace (least seconds between two requests on one connection, default 0.12), --poll (seconds between looks for invitations, default 2), --gridwords-secs (Grid Words search time a turn, default 1).
The bot rebuilds the game's state from its view and runs the game's own rules code (each plugin is a set of pure functions, bot/rules.py) to look ahead. The server stays the judge: every move goes through MOV, and Grid Words plays are checked with CHK first.
| Game | Strategy |
|---|---|
| Reversi | A corner if one is free; never a square next to an empty corner unless nothing else is left; otherwise the move that flips the most discs. |
| Backgammon | Every way to play the roll is tried and the positions scored: checkers hit, points made (more in its home board), blots left within reach of the other side, checkers borne off, its pip count. It never doubles; it takes a double when its pip count is at most about 12% behind the doubler's, else it drops. |
| Checkers | Every whole turn is tried (captures are compulsory and run to their end): the most pieces taken, then the least the other side can take back, then crowning, then keeping its back row. It accepts a draw offer when it is not ahead. |
| Five in a Row | A winning point; else a point that blocks the other player's win; else the point that best builds its own lines and blocks theirs (an open three of theirs weighs nearly as much as an open four of its own). |
| Dots and Boxes | A line that closes a box when there is one; else a line that draws no box's third side; else the line that hands over the fewest boxes. |
| Mancala | A move that earns another turn (kalah); then the move that gains its store the most (a capture counts in full) less what the other side could capture straight after; then the move that keeps the most seeds on its own side. It plays only the moves the server lists, so oware's must-feed rule holds. |
| Naval Combat | The fleet placed at random by the server. Shooting: next to its hits on a ship not yet sunk, along the line once two hits line up; otherwise at random on a checkerboard of the squares not yet fired at (in batnav, not beside a sunk ship). |
| Grid Words | The highest-scoring play it finds in about a second: every row and column from each square that can reach a tile on the board, rack letters placed left to right, a branch dropped as soon as no word in the list starts that way or a cross word would not be in the list; each play is scored by the game's rules (a blank costs a little) and confirmed with CHK. With nothing found it exchanges its rack but blanks and S while the bag holds 7 tiles, else passes. |
| Cannon Fire | It aims at the nearest tank still standing, trying angles every 5 degrees and powers every 5 with the game's own flight and blast rules, and fires the shot that hurts other tanks most and itself least, with a small random error (up to 2 degrees, 3 points of power) so it can be beaten. It never drives. |
| Rummy Tile Classic | It plays from its own rack only and never rearranges the table: the combination of runs and groups (a joker filling a gap) that puts down the most tiles, before its first meld only once they reach 30 points; after the first meld it also lays tiles off onto the table's sets. Then END, which draws when it played nothing. |
The bot shows up in these lists while it runs. The core counts it as online for as long as its process is connected, as docs/accounts.md explains under "Who is online".
The container has a 320 MB limit, raised from 256 MB for the bot. Measured in python:3.13-slim (arm64) with a core and a random player at every game: the bot idles at 29 MB resident (17 MB anonymous, 12 MB shared library and file pages); after 30 games, ten at a time, Grid Words among them, it holds 36 MB (24 MB anonymous). Most of that is the floor of any Python process that speaks TLS here: Python alone is 8 MB, and importing asyncio (with ssl and OpenSSL) brings it to 24 MB, as in the core and every server extension. The bot's own data is small: the word list's 1.5 MB, and at most about 2.5 MB during a Grid Words search (it remembers at most 20,000 prefixes and keeps only its best few plays).
tests/test_bot.py: no person signs in as a bot under any sign-in method, and the bot's key signs in as nothing else; each strategy beats a random player (seeded, both seats); a whole game of every game against a random player over a real server, with the bot's greeting and last words and no move refused; three bots at a table of four (Rummy Tile Classic, Cannon Fire); the invitations from the web, telnet and the native protocol; it never joins uninvited, follows the people out of an open table, and leaves when a turn clock ends the game; its memory.
| These pages cover every ParlorNet server. | Source code | ParlorNet is free software. |