@radajakub/plyui
v0.5.0
Published
React components that draw plybench games: a board per game, the tree of a set of games, and an LLM call.
Maintainers
Readme
plyui
Published on npm as @radajakub/plyui (the name plyui is too close to an existing package).
React components that draw plybench games, shared by the plybench website and plyweb (the job tracker), so a game looks the same in both.
- Boards (
GameBoard): the game as it stood after some of its moves, for every plybench game: tic-tac-toe and its variants, Magic Square and Story Magic Square, Nim and its variants and Story Nim, Connect Four, Breakthrough, Monty Hall and the bandit. Any other game is shown as its observation's text. - Tree (
GameTree,buildTree): a set of games as one seat played them. Each node is what the seat saw when it moved, each edge a move or what followed it (chance, the opponent). An edge is as thick as its share of the node's games and says its count, its wins and, for a bandit, its win chance. One game is one path;highlightmarks one game in many.
Data
Every component takes plybench's own data and fetches nothing (src/view.ts): a GameView is one game as played, in plybench's names: its
game config (bandit:p=3/4;1/4;1/2,shift=1), its moves in order (seat, observation, move), the observation it ended in, its result for seat i,
and the instance's params. Each site converts its data to it: plyweb from plybench's trace (plybench-trace --json), the website from its
database.
Use
The components use Tailwind classes and the colour tokens both sites define: background, foreground, card, muted,
muted-foreground, border, accent. A site's stylesheet scans the package so its classes are generated:
@import "tailwindcss";
@source "../node_modules/@radajakub/plyui/dist";import { GameBoard, GameTree } from "@radajakub/plyui";
<GameBoard view={game} at={3} /> // after 3 moves; at = game.steps.length: the end
<GameTree games={games} seat="i" highlight={games[0]} />Develop
npm install, then npm test (the parsers and the tree, in Node), npm run typecheck, npm run build (dist/, ESM and types), and
npm run format. React is a peer dependency.
Release
Fill in CHANGELOG.md under [Unreleased], commit, then from the ply folder:
make release REPO=plyui VERSION=0.3.0 DRY_RUN=1 # the plan only
make release REPO=plyui VERSION=0.3.0 # release, then update and deploy the website and plywebIt runs this repository's make release VERSION=0.3.0: checks, sets the version, dates the changelog, commits, tags v0.3.0 and
pushes. The tag's Release workflow publishes to npm through trusted publishing (set on npmjs.com for this repository and
release.yml; no token). Then the plybench website and plyweb get the new version, are checked, committed, pushed and deployed.
