Night Game
This is a text-mode baseball simulation. It plays one full game, pitch by pitch, with true player ratings hidden from the screens and the current MLB rules, and you manage one club from the bench.
The program is nightgame, and it takes these flags:
--seed Nsets the seed. The same seed plays the same game. Without it, the seed comes from the clock.--data DIRreads the data files fromDIR. Without it, the program usesdata/if that folder exists, and the data built into the program if not.--manage away|home|nonepicks your seat as manager in the live game: the visiting club, the home club, or neither, with the computer managing both. The default ishome. The club in your seat takes your orders from the bench line, described below. The computer manages the other club.--bellturns the terminal bell on for this game. It is off by default; theakey and the Options page turn it on for later games too, kept inbellin the config folder. The game sends only the bell character, and your terminal decides what that does: a tone, a flash, a mark on the tmux window, or nothing. It rings when the manager is wanted: the other club changes pitchers, your pitcher turns Tiring or Spent, a reliever you warmed is Ready, or the game ends. It rings at most once for each decision point and never while paused. With--manage noneit rings only at the end of the game.--nerd-fonts on|offturns the Nerd Font icons on or off, and keeps the choice for later games. They are off until you turn them on, because a terminal cannot tell the game which font it has. With them off, every screen uses standard symbols that any font draws and a screen reader can say. With them on, the title row shows an icon for the radio, the webcast and the dugout, and the run marks, the bell and the pause take Nerd Font icons. The bases and the outs keep their standard diamonds and dots either way. The choice is kept innerd-fonts, in$XDG_CONFIG_HOME/nightgame/or~/.config/nightgame/.--colors 24bit|256(or--colours) sets the colour depth of the radio screen, and keeps the choice for later games incoloursin the same folder. Without it, the game uses the last choice, and with none it asks the terminal, as Ghost Boat does:COLORTERMset totruecoloror24bit, aTERMthat names a 24-bit terminal,LC_TERMINALset toiTerm2, or a knownTERM_PROGRAMmeans 24-bit colour, and anything else means 256. SSH passesCOLORTERMalong only when both ends allow it, and mosh never does, so over either you may need--colors 24bitonce. In 256 colours, each theme colour becomes its nearest xterm colour, with two exceptions: text that would fall below 3:1 against the background takes the nearest colour that does not, and the two clubs and the alarms never share a colour. The HTML cards keep their full colours.--screen-readerplays the live game in plain lines of text, with no screen drawn, for your own screen reader. See “The screen-reader mode” below.--speakturns speech on for this game: the computer’s own voice says the call. See “Speech” below.--voice-speed Nand--voice-pitch Nset the voice’s speed and pitch, each a whole number from -100 to 100, 0 being the computer’s own. Each is kept for later games, invoice-speedandvoice-pitchin the config folder.--headlessprints the radio call and the box score of one game, instead of playing it on the radio screen. It always uses the standard symbols, as--cardsand--recordsdo, because it writes to a file or a pipe rather than a screen.--survey NplaysNgames from the seed (1 if--seedis not given) and prints the run environment they produced.--season-survey Nplays the last seasons of both clubs in each ofNgames from the seed (1 if--seedis not given), and prints their totals beside MLB’s.--cardsprints every player’s card for one game: both clubs’ lineups, benches, rotations and bullpens. A card shows the player’s details, the line from today’s game and the last season.--export DIRplays a game and writes it as five CSV files inDIR, in the form themlb-game-reportskill writes, so thatmlb-announcer-1930scan voice it.--records DIRplays a game and writes both clubs’ records intoDIR, which it creates if needed:clubs.csv,players.csv,batting.csvandpitching.csv, thenclub-<abbr>.md,club-<abbr>.gmiandcards-<abbr>.htmlfor each club. The.gmipage is the Markdown page in gemtext, for a Gemini capsule, with each table as aligned columns. The HTML page holds one baseball card for each player, front beside back, and prints at card size. It needs no network. Night Game replaces only its own earlier files: a file it did not write stops the run, and nothing is written. A.night-gamefile inDIRlists the CSV files it wrote.--theme NAMEpicks a theme by name, in any case, for this run. It sets the colours of the HTML cards and the starting theme of the radio screen. Without it, the radio screen wears the theme last kept withTor the Options page, inthemein the config folder. An unknown name exits with code 2 and lists the names.--helpprints the usage line.
Without --headless, --survey, --season-survey, --cards, --export or --records, the game plays live on the radio screen, pitch by pitch, one line of the call every 1.5 seconds. The game goes no faster than its call, and waits while the call is paused. The call reads as a scorebook log, and the design notes list the codes. The screen needs a terminal of 80×24 or larger. The title row shows the inning and the count, as in “game 7 · Top 1st · 1-0”, so the game reads at a glance from another pane. The call stands in its own window, and beside it are two more:
- Situation: the inning, the outs and the count, and the diamond with each runner named beside it.
- Matchup: the batter against the pitcher, facts only. The batter bats from the left (L), the right (R) or both sides (S), with today’s line and last season’s average, on-base and slugging. The pitcher throws left or right, with the pitches so far and today’s line. Beside the pitch count stands the pitching coach’s word for the pitcher: Fresh, Tiring or Spent. The webcast’s pitcher column shows it too.
On a small screen the windows give way in a set order: Matchup first, then Situation. All three fit at 80×24.
The keys are Ghost Boat’s, as in every game on Ghost OS, so a player who knows one knows the others. There are no vim keys: the arrow keys move, and letters are commands. The key bar at the foot shows the keys that work now; when they do not all fit, the least needed give way, and M lists every one. The keys:
Spacepauses and resumes.Enteracts on what is chosen: on the box score it opens the chosen player’s card. On the call, where nothing is chosen, it opens the bench line.:opens the bench line, where you type an order.Entersends it andEsccloses the line. The left and right arrows move along the line,HomeandEndjump to its ends,Backspacetakes back the letter before the cursor andDeletethe one under it, and the up and down arrows bring back the orders you gave before.Spaceandqtype their letters while the line is open.lopens the whole log over the screen: every line of the call heard so far, each with its time on the air, the newest at the foot. The arrow keys, Page Up, Page Down, Home and End scroll it, andlorEsccloses it.Mopens a menu of every action that works now, each with its key. The arrow keys choose, andEnter, the row’s number or a click does it.Esccloses it.?opens the help, which lists the orders and the keys. The up and down arrows scroll it,hopens the manual, andEscor?closes it.F1opens the manual: this README, in a window. The arrow keys, Page Up and Page Down scroll it,Tabsteps through its parts, andEsccloses it.Topens the theme menu over the screen. The arrow keys show each theme, Page Up and Page Down jump a group, andEnter, a number or a click keeps it, for later games too.Escorqputs the old one back.qopens the menu: carry on, stop the game here, or the Options page. After the game, its second row leaves Night Game.Escorqcloses the menu. The call waits while this menu, the Options page, theMmenu, the theme menu, the log or the manual is open. See “Options” below.aturns the terminal bell on or off, and keeps the choice for later games. While it is on, the title row shows the wordbell. In the bench line,atypes its letter.nturns the Nerd Font icons on or off on any page, says which on the hint line, and keeps the choice for later games, as--nerd-fontsdoes. In the bench line,ntypes its letter.sturns speech on or off, says which on the hint line, and keeps the choice for later games, inspeechin the config folder.F2orCtrl-Rsays the last thing again, when speech is on. Both work on any page and while an order is typed.+plays faster,-slower, and=goes back tox1.bshows the box score after the final out, or after the game is stopped, with a row chosen. The up and down arrows move the choice a row, and Page Up and Page Down a page. The left arrow moves it to the visiting club, and the right arrow to the home club.borEscgoes back to the call.- A card opens on its front.
fflips it to the back, which holds today’s line and last season, and back again.Esc,Enterorbgoes back to the box score from either side. ctakes the bench coach’s suggestion into the bench line, to edit and send. The coach suggests only once the call has said what led to the decision point, and acpressed before then takes the suggestion when it comes. With no suggestion standing, it does nothing.vswitches between the radio view and the webcast view.dopens the dugout from the call page, during the game or after it. For each club it shows the pitcher with the pitch count and the coach’s word, where the infield plays (normal, in, or at double-play depth), the bench with each player’s number and position, the bullpen with each reliever’s readiness (Cold, Warming or Ready) and the closer and setup relievers marked, and the players who have left the game. Your club comes first.dorEscgoes back to the call.B(Shift-B) confirms a pitching change. Any other key cancels it, andqcancels it and opens the menu.Ctrl-Cleaves at once.Escnever quits.
The bench line takes these orders. A name is the player’s family name, and #27 names a player by uniform number when two share a name. The game refuses an order that does not stand, and says why in a sentence.
pinch 7 Ortega: Ortega bats for the 7th place in the order. This is allowed only before a plate appearance.run 2 Vargas: Vargas runs for the runner on second.field Ibarra ss: Ibarra goes in at shortstop. The positions arec,1b,2b,3b,ss,lf,cf,rfanddh.warm Haldaneandsit Haldane: a reliever starts warming up, or sits down.bring Haldane: Haldane takes the mound, once you pressB.ibb: the batter is walked on purpose.steal 1: the runner on first goes on the next pitch.steal 2sends the runner on second.bunt: the batter lays down a sacrifice bunt on the next pitch.bunt hitbunts for a hit, andsqueezesends the runner on third as the batter bunts.hit and run(orhitrun): the runner on first goes on the next pitch, and the batter swings to protect the runner. It needs second base open.hold onandhold off: the runner is held, or let go.infield inandinfield normal: the infield comes in to cut off the runner on third, or goes back. It needs a runner on third and fewer than two out.depth dpanddepth normal: the infield plays at double-play depth, or goes back. It needs a runner on first and fewer than two out. Either depth stands until you change it or the runners no longer allow it, and every half starts at normal depth.
The bench line also takes the orders every game on Ghost OS shares, and a few of Night Game’s own. Each is answered on the hint line.
pausepauses the call, andpauseagain carries it on.time 4runs the call atx4. The rates are 1, 2, 4, 8 and 16.fasterandslowerstep the pace as+and-do.timesays the inning and how long the game has been on the air, and your own clock when it can be read.looksays the situation: the inning and the outs, the bases, the batter and the count, and the pitcher with the pitch count and the coach’s word.score(orrecords) says the score.log Bunt them over.writes your own line in the log. See “Your own log entries” below.logalone opens the whole log, asldoes;helpopens the help;manualopens the manual;againsays the last thing again, asF2does;hushcuts the voice short; andquitopens the menu, asqdoes.
The bench line’s grammar, with tested examples, is docs/design/bench-grammar.md.
Options
The q menu’s third row opens the Options page, as in Dog Watch: one row for each setting, with its value, and beside it a few lines on what it does. The settings are the theme, the Nerd Font icons, the bell, the colour depth (24-bit or 256), speech, and the voice’s speed and pitch.
- The up and down arrows choose a row, stopping at the ends.
HomeandEndjump to them. - The left and right arrows change the setting: they turn a switch, step the voice by ten between -100 and +100, or wear the theme before or after.
EnterorSpaceturns a switch, or steps the voice up by ten, round from +100 to -100. On the theme row it opens the theme menu, asTdoes.Escorqgoes back to the menu.F1opens the manual.
Each choice shows at once and is kept for later games, in the config folder ($XDG_CONFIG_HOME/nightgame/ or ~/.config/nightgame/), one small file for each: theme, nerd-fonts, bell, colours, speech, voice-speed and voice-pitch. These are the same files the flags and the keys keep, so they always agree. --bell, --theme and --speak are for one game and change no file. With speech on, the voice says the chosen row as it moves, as in “Voice pitch, minus 10. 7 of 7.” The screen-reader mode has no Options page: set the voice there with --voice-speed and --voice-pitch.
Your own log entries
log and your own words write a line of your own in the log, under the label MANAGER, where the call has got to: log Bunt them over. It shows on the call and in the whole log, and is never read out as part of the call. log with a number alone is not an entry: to log a number, add a word, as in log 3 up, 3 down.
Each entry is also kept in logbook.md in the data folder ($XDG_DATA_HOME/nightgame/ or ~/.local/share/nightgame/), plain Markdown that any editor reads. Each line is stamped with the date on your computer, the game and the inning, as in “2026-12-01 21:40 · game 7, CAL at MER · Top of the 3rd”. The file grows; nothing in it is ever rewritten.
Speech
Speech is off unless you ask for it: s turns it on and off, and --speak turns it on for one game. With it on, the computer’s own voice (spd-say on Linux, say on a Mac) says each line of the call as it is heard, with the outs and the score, each answer on the hint line, and what is chosen as the choice moves: the box score’s chosen row, the card open, and the chosen row of a menu, of the themes or of the Options page. It never reads the screen.
- Any key cuts the voice short.
F2orCtrl-Rsays the last thing again. - The call never runs faster than the voice: while the voice speaks, the call waits, for ten seconds at most at a stretch. With speech off, the call keeps its pace.
--voice-speedand--voice-pitchset the voice, as above, and so does the Options page.- Speech plays where the game runs. Over SSH it speaks on the server, so play on your own computer to hear it. A computer with no speech command says so once on the hint line, and the game stays silent.
The screen-reader mode
--screen-reader draws no screen. A full screen redraws, and a screen reader would read every character, so this mode prints lines of text only, for your own screen reader to read: each line of the call as it is heard, and a plain prompt for orders, Order:. Every line you type there is read as the bench line reads it, so every order above works, and a pitching change waits for a line holding a capital B. These work as well:
helpsays the orders.manualsays this README.againsays the last thing again.logsays the last five lines again, or as many as you give, as inlog 12.time,lookandscoresay the inning, the situation and the score.quitstops the game and ends the session. The end of input andCtrl-Cend it too.
Challenges, themes and documents
You make no challenges. The batter and the catcher challenge a ball-strike call by their own eye, and you watch.
The themes are Ghost OS’s shared palettes, the same looks under the same names in Ghost Boat, Dog Watch and Night Game. Night Game’s own, Under the Lights, comes first, then Ghost Boat’s house colours and the rest. They are built into the game; it no longer reads a themes file.
The colour reference, with every theme’s contrast figures and its look to players with colour-vision deficiencies, is docs/colour-reference.html. scripts/colour_reference.py generates it and docs/tokens.json from Ghost OS’s shared palettes.ron, read from the Ghost OS the build pins, so the reference cannot drift from the palettes the game wears; a test fails when either file is out of date.
An unknown option prints the usage line and exits with status 2. A data error exits with status 1.
The documents: the software design is docs/design/sdd.md (NG-SDD-001), the roadmap is docs/roadmap.md, the teaching notes are in docs/teaching/, and the mathematics behind the statistics, the pitch engine, the scorer and the random generator, with proofs, is in docs/math/. The design notes, with every survey and simplification, are docs/design-notes.md.
It is a sister project to Ghost Boat, and shares its workspace layout, its determinism rules and its British house spelling.