Skip to content
CoobykPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

166 Commits

Folders and files

Repository files navigation

Goonchess

A client-side chess variant maker. Build a board, paint terrain, design piece movement, place the starting army, then play it — all in the browser.

Deployable to Cloudflare Workers with GitHub Actions.

Features

  • Play view — full rules engine with legal-move hints, hover previews, check and checkmate detection, castling, promotion, en passant, undo and move history. A piece may promote into a choice of pieces, and the player picks. The same position three times is a draw, counted with the same rule chess uses: the pieces, the side to move, the castles still possible and the en passant right all have to match — and in Three-Check, the checks banked as well. The board wears the brown of Lichess, #f0d9b5 and #b58863, in light and in dark mode alike.
  • Random pieces — any piece can be marked random. After every move it is given a new kind, drawn at random from the kinds of the variant, and it wears the colours of a rainbow so you can see at a glance that it is not what it seems. The pieces stay visible the whole time.
  • Random Chess — a whole mode built on that: every piece but the king is random, so the board is reshuffled after every move. It sits in the New menu, next to Only Horses.
  • Piece composer — draw a piece instead of settling for a letter. The six chess pieces are stacked on top of each other: a knight with a bishop's crown on its head, a queen wearing a king's crown, an amazon with a knight's head. A collection of premade pieces — the plain shapes and the classic combinations — is there to start from, and every one of them can be pulled apart, moved, resized and restacked. The drawing travels with the piece: it is on the board, in the guide to the rules and in the share link.
  • Opponent bot — play against a bot in any variant. It searches with the same rules engine the game uses, so it understands custom pieces, portals and blasts; three strengths, from a casual opponent to a deep search. The search runs in a worker, so the board stays responsive while it thinks. The bot can take a fixed side or a random one that is rolled for every new game, and two bots can play each other, each with its own strength, while you watch. Under the hood it is a real engine: negamax with alpha-beta, a table of the positions it has already looked at, a narrow-window re-search, killer and history move ordering, a capture-only horizon and a late-move reduction — about twice the speed and a full ply deeper than before, at the same thinking time.
  • Analysis — three modes. Off, which is nothing. Engine, which looks at the position on the board and says what it thinks: a score for the first army, with a bar to the left of the board showing the same thing. And Computer, which looks at the whole game and draws a graph of how it went, in dithered pixels — the graph is drawn by the Dither Kit, the same engine behind its area charts and sparklines. The threat visualiser lives in the same card.
  • Puzzles — positions taken from games the bot played against itself, each with a capture that cannot be taken back. The panel counts the ones you solve and lives in the Learn page, next to the guide to the rules.
  • Chess clocks — time per side with an increment, from 1+0 to 15+10. The clock starts with the first move, and the bot never uses more than a third of its time. In a shared game the room owns the clock: the time control travels with the link, both sides see the same countdown, and a flag falls on its own even when nobody is connected.
  • Replay and export — step through any game again, and write it out as a picture, an animated GIF or a video (MP4 where the browser can record it). Positions also export as PNG, as PGN with algebraic notation, and as FEN, which imports back into the Maker.
  • Keyboard play — the arrow keys move a cursor over the board, Enter plays, and every move is announced for screen readers.
  • Learn — /learn renders a human-readable guide from the current variant: starting board, terrain key, armies, win conditions, movement and capture patterns, flags, effects, promotions and the active display settings.
  • Built-in variants — Classic Chess, Mini Chess, Only Horses (every piece is a horse and every horse jumps), Bomb Queen (a queen that steps one square in any direction and detonates on every capture), Chaos Lab (portals, walls, uncapturable gems and bombers) and blank boards to start from.
  • Chess variants — eight of them, each a real ruleset rather than a setup: Chess960 (the home rank is dealt at random, and the New game menu deals a fresh one every time), King of the Hill (walk your king onto one of the four centre squares to win), Three-Check (every check is banked; the third one wins), Antichess (captures are forced, the king is an ordinary piece, there is no check and no castling, and being left with nothing — or with no move — wins the game), Horde (thirty-six pawns against a full army: checkmate wins for the horde, wiping it out wins for the army), Racing Kings (no pawns, both armies run the same way at the eighth rank, checks are illegal for both sides, and White's arrival gives Black one reply to answer it), Atomic (a capture detonates: the square and its neighbours go up — kings among them — so exploding the enemy king wins and no king ever takes anything), and Crazyhouse (everything you capture changes sides into yours and can be dropped back onto an empty square instead of moving). They are in the Library menu and the New game menu like any other variant, they search with the same engine, and a share link carries the whole ruleset.
  • Sound — a bundled CC0 sound set for moves, captures, checks, promotions, explosions and game endings, with a mute toggle. It comes in packs: real wooden pieces, chiptune 8-bit blips, and a meme pack with vine booms and exclamation stings. The speaker button in the header switches packs — adding your own is a folder of files and one line of code.
  • Threat visualizer — an optional overlay with arrows from each attacker to the piece it can capture, plus attacked-square coverage and rings for hanging or defended pieces, for the side to move or both armies at once.
  • Win confetti — a canvas volley in the winner's colours, skipped when the visitor prefers reduced motion.
  • Turn view — for two players sharing a screen: leave the board alone, flip it 180° after every turn, or rotate only the pieces so they face the player whose turn it is.
  • Animated moves — a piece glides to the square it landed on instead of teleporting. A capture fades out as the mover arrives, a swap sends both pieces on their way, a portal swallows the piece and spits it out at the other end, and an explosion only fires once the mover has landed.
  • Maker view with four tabs and a live board preview:
    • Board — size from 3×3 to 16×16 and terrain brushes: open, wall, void, two-way portals and one-way portals. The squares keep the same colours everywhere; the theme decides which pair they wear.
    • Pieces — click a movement grid to design leapers and sliders, give a piece a separate capture pattern, and set restrictions: jump, must capture, uncapturable, royal, moves once, mirror for the opposing team, rolls a die to pick its pattern, plus first-move-only patterns (pawn double steps).
    • Setup — drag pieces from the palette onto the board, erase, mirror and copy a side; setup validation warns about missing royal pieces.
    • Rules — variant name and description, team names/colors/forward direction, and win conditions: checkmate, capture the royal, elimination and a point target.
  • Undo and redo — every change in the Maker can be taken back, so a mis-click is never the end of an idea.
  • Special effects — swap positions on capture, exploding with a radius (the blast wipes out every enemy piece inside it, spares the mover's own team, and plays a shockwave animation on the board), and spawning another piece type.
  • Built-in Shadcn UI — Radix primitives, dark-first theme with a light mode.
  • Real URLs — / plays, /maker builds, /learn explains the rules, and every maker tab has its own address (/maker/pieces, /maker/rules, ...). Back/forward and direct links work; Cloudflare serves the SPA fallback for deep links.
  • Library, links and JSON — the Library menu holds every built-in variant and the ones you have saved, and opens them straight into a game; save named variants locally, share an encoded link, or import/export the raw JSON.
  • Short share links — a variant is packed into a compact array form (index references instead of random ids, a bitfield for flags, only non-empty squares stored) and deflated into a URL-safe code, so a full 8×8 set fits in roughly 500 characters instead of several thousand. Links use the #v2= hash; older #v= links still load.

Dev

npm install
npm run dev
npm run build

Cloudflare deployment

Every push to main builds and deploys the Worker to goonchess.com with GitHub Actions. Configure these once:

  • Repository secret CLOUDFLARE_API_TOKEN with permission to deploy Workers
  • Worker secret CAPTCHA_SECRET, the key that signs the online-game proof of work: npx wrangler secret put CAPTCHA_SECRET

Without CAPTCHA_SECRET the site still plays offline, but creating an online game returns 503. The Durable Object and its storage are created by the migration in wrangler.toml on the first deploy; there is nothing to set up by hand. The workflow can also be started manually from the Actions tab.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages