modscode / Gallery / blackjack
blackjack
A blackjack table in a side pane to play while Claude works
What it does
- Draws a pane, toasts
- Adds /blackjack
- Hooks classic.SessionStart, session.start, turn.complete, turn.start and 1 more
- Keeps its own state between turns
Good points
- No network calls
- Starts no processes
- Written in TypeScript
- Has a desktop-specific branch
Code to start from
Two kinds: a starter modscode writes from the design above, and the lines of the mod's own code that draw it.
Starter (register.tsx)
import type { Register } from 'claude-code'
// Drawn like blackjack by michaeldavodovski (pane, band, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/michaeldavodovski-blackjack/
// Written by modscode from that reading, not copied from the mod: use it as you like.
// Each value below stands for one the mod works out at run time; put in your own.
export const register: Register = on => {
// the pane: open it with $.ui.open({ id: 'my-pane', title: "Blackjack" })
on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
const { Box, Text, Svg, Button } = $.ui.resolve(e)
const run = '…'
const run2 = '…'
const run3 = '…'
const run4 = '…'
const run5 = '…'
const run6 = '…'
const run7 = '…'
const run8 = '…'
const run9 = '…'
const bankroll = '…'
const wagerOf = '…'
const ruleSvg = '…'
const RESULT = '…'
const row = '…'
const row2 = '…'
const row3 = '…'
const source = '…'
const hotkey = '…'
const centered = '…'
const text = '…'
const betFor = '…'
const keysHint = '…'
const label = '…'
return (
<Box flexDirection="column">
<Box flexDirection="column" alignItems="center" marginBottom={1}>
<Box flexDirection="column">
<Box flexDirection="row">
<Text bold>
{run}
</Text>
<Text bold>
{run2}
</Text>
<Text bold>
{run3}
</Text>
</Box>
<Box flexDirection="row">
<Text bold>
{run4}
</Text>
<Text bold>
{run5}
</Text>
<Text bold>
{run6}
</Text>
</Box>
<Box flexDirection="row">
<Text bold>
{run7}
</Text>
<Text bold>
{run8}
</Text>
<Text bold>
{run9}
</Text>
</Box>
</Box>
<Text bold>
CCC
</Text>
<Text dimColor>
Claude Code Casino
</Text>
</Box>
<Box flexDirection="row" justifyContent="space-between">
<Text bold>
{"Bank "}
{bankroll}
</Text>
<Text>
Bet
{" "}
{wagerOf}
</Text>
</Box>
<Box marginTop={1}>
<Svg source={`${ruleSvg}`} alt="Divider" height={1} />
</Box>
<Box flexDirection="column" marginY={1}>
<Box flexDirection="row" justifyContent="space-between">
<Text dimColor>
{"Dealer "}
soft 0
</Text>
<Text dimColor>
{"stands on "}
17
</Text>
</Box>
<Box flexDirection="row" flexWrap="wrap" columnGap={1}>
<Text>
{" ?? "}
</Text>
<Text>
{" ?? "}
</Text>
<Text>
{" ?? "}
</Text>
</Box>
<Box marginTop={1}>
<Text dimColor>
{"You "}
soft 0
</Text>
</Box>
<Box flexDirection="row" flexWrap="wrap" columnGap={1}>
<Text>
{" ?? "}
</Text>
<Text>
{" ?? "}
</Text>
<Text>
{" ?? "}
</Text>
</Box>
</Box>
<Box flexDirection="column" marginBottom={1}>
<Box height={1} justifyContent="center">
<Text dimColor>
Dealer plays...
</Text>
<Text bold color="success">
{RESULT}
</Text>
</Box>
<Box flexDirection="column" alignItems="center" height={3}>
<Text bold>
{row}
</Text>
<Text bold>
{row2}
</Text>
<Text bold>
{row3}
</Text>
<Svg source={`${source}`} alt="A rain cloud" />
</Box>
</Box>
<Box flexDirection="column" rowGap={1}>
<Box flexDirection="column">
<Button plain label=" " />
<Button hotkey={`${hotkey}`} label={`${centered}`} variant="primary" autoFocus />
<Button plain label=" " />
</Box>
<Box flexDirection="column">
<Button plain label=" " />
<Button hotkey={`${hotkey}`} label={`${centered}`} variant="primary" autoFocus />
<Button plain label=" " />
</Box>
<Box flexDirection="column">
<Button plain label=" " />
<Button hotkey={`${hotkey}`} label={`${centered}`} variant="primary" autoFocus />
<Button plain label=" " />
</Box>
</Box>
<Box flexDirection="column" rowGap={1}>
<Text>
Out of chips.
</Text>
<Box flexDirection="column">
<Button plain label=" " />
<Button hotkey={`${hotkey}`} label={`${centered}`} variant="primary" autoFocus />
<Button plain label=" " />
</Box>
</Box>
<Box flexDirection="column" rowGap={1}>
<Box flexDirection="row" alignItems="center" columnGap={1}>
<Box>
<Button plain label={` ${text} `} />
</Box>
<Box>
<Button plain label={` ${text} `} />
</Box>
<Box flexDirection="column" justifyContent="center" alignItems="center" paddingX={2}>
<Text bold>
{betFor}
</Text>
</Box>
<Box>
<Button plain label={` ${text} `} />
</Box>
<Box>
<Button plain label={` ${text} `} />
</Box>
</Box>
<Box flexDirection="column">
<Text dimColor>
Bet change step
</Text>
<Box flexDirection="row" justifyContent="space-between">
<Box>
<Button plain label={` ${text} `} />
</Box>
<Box>
<Button plain label={` ${text} `} />
</Box>
<Box>
<Button plain label={` ${text} `} />
</Box>
</Box>
</Box>
<Box flexDirection="column">
<Button plain label=" " />
<Button hotkey={`${hotkey}`} label={`${centered}`} variant="primary" autoFocus />
<Button plain label=" " />
</Box>
</Box>
<Box flexDirection="column" marginTop={1}>
<Box flexDirection="column" height={2}>
<Text dimColor>
Claude is working...
</Text>
<Text color="success">
Claude is done.
</Text>
<Text bold>
Get back to work!
</Text>
</Box>
<Text dimColor>
{keysHint}
</Text>
<Box flexDirection="row" columnGap={2}>
<Button plain hotkey="1" label="Min" autoFocus />
<Button plain hotkey="2" label={`${label}`} autoFocus />
<Button plain hotkey="3" label={`${label}`} autoFocus />
<Button plain hotkey="4" label="Max" autoFocus />
</Box>
<Box flexDirection="row" columnGap={2}>
<Button plain hotkey="5" label="smaller step" autoFocus />
<Button plain hotkey="6" label="bigger step" autoFocus />
</Box>
<Text dimColor>
ctrl+x tab to use keys
</Text>
</Box>
</Box>
)
})
on('session.start', async ($, e, next) => {
await $.ui.toast(`Blackjack: could not save the bank`)
await $.ui.toast(`Blackjack: run /blackjack to open the table`)
return next(e)
})
}
The mod's own code
Shown under the mod's licence (MIT); its text is below. Keep the notice if you copy these lines.
hooks/register.tsx lines 399–558 · Pane
on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
isFullscreen = e.viewport?.isFullscreen ?? isFullscreen
const { Box, Button, Text } = $.ui.resolve(e)
const table = await read($, game)
const status = await read($, claude)
const net = netOf(table)
// Minus and plus carry the amount they move the bet by, so the row that
// picks it explains itself.
const less = `-${stepOf(table)}`
const more = `+${stepOf(table)}`
// The dealer's cards start turning before anything is saved, so a save
// that fails cannot leave the table waiting on them. A move that stakes
// or restores chips (`isFresh`) first takes up the bank as saved.
const play = (move: (table: Game) => Game, isFresh = false) => async () => {
if (isFresh) {
await refresh($)
}
let before = table
const after = await update($, game, now => {
before = now
return move(now)
})
if (isRevealing(after)) {
reveal($)
} else if (isFxRunning(after)) {
animate($)
}
await save($, before, after)
}
// While the dealer's cards turn, the table shows the hand as it stood:
// no result yet, and the bank as it was before it.
const isTurning = isRevealing(table)
const isBetting = !table.isPlaying && !isBroke(table) && !isTurning
const faceUp = table.isPlaying ? 1 : table.dealerShown
const dealerUp = table.dealer.slice(0, faceUp)
const isHoleDown = faceUp === 1 && table.dealer.length > 1
const frame =
table.outcome !== null && !isTurning
? frameOf(table.outcome, table.fx)
: null
const hand = (cards: readonly number[], isHoleHidden: boolean) => (
<Box flexDirection="row" flexWrap="wrap" columnGap={1}>
{cards.map((card, i) =>
isHoleHidden && i === 1 ? (
<Text backgroundColor={theme.back} color={theme.backInk}>
{' ?? '}
</Text>
) : (
<Text
backgroundColor={theme.card}
color={isRed(card) ? theme.redInk : theme.ink}
bold
>
{` ${rankOf(card)}${suitOf(card)} `}
</Text>
),
)}
</Box>
)
const columns = e.props.bodyColumns
const isDocked = e.props.placement === 'dock'
const isTerminal = e.surface === 'terminal'
// The bet row: Min and minus on one side of the bet, plus and Max on
// the other, each a chip two cells wider than its label.
// Minus and plus are as wide as their longest label (`-100`), so the
// row does not shift when the step changes.
const stepCells = String(Math.max(...STEPS)).length + 1
const betColumns = Math.max(
4,
columns - 5 - (stepCells + 2) - (stepCells + 2) - 5 - 4,
)
// A chip is a one-row filled Button with nothing but its label drawn: a
// terminal Button that has a hotkey draws brackets or the key too, so
// the chips' keys are the row of `1: Min` Buttons under the table.
// Art made of characters, for a surface whose font is not fixed-width:
// one image set in a fixed-width font. The terminal draws the rows as text.
const picture = (rows: readonly (readonly Run[])[], alt: string) => {
if (e.surface === 'terminal') {
return null
}
const { Svg } = $.ui.resolve(e)
const image = asciiSvg(rows)
return (
<Svg
source={image.source}
alt={alt}
width={image.width}
height={image.height}
/>
)
}
// A thin rule across the pane, where the surface can draw one.
const divider = () => {
if (e.surface === 'terminal') {
return null
}
const { Svg } = $.ui.resolve(e)
return (
<Box marginTop={1}>
<Svg source={ruleSvg(IMAGE_INK)} alt="Divider" height={1} />
</Box>
)
}
const chip = (
key: string,
label: string,
tone: { fill: string; lit: string },
move: (table: Game) => Game,
cells?: number,
) => {
if (isTerminal) {
const text = cells === undefined ? label : centered(label, cells)
return (
<Box
key={`${key}-fill`}
backgroundColor={tone.fill}
hover={{ backgroundColor: tone.lit }}
>
<Button key={key} plain label={` ${text} `} onPress={play(move)} />
</Box>
)
}
// Off the terminal a button is as wide as its label, so one whose
// label changes sits in a slot that fits its longest.
const button = (
<Button
key={key}
label={label}
variant={tone === theme.chosen ? 'primary' : 'secondary'}
onPress={play(move)}
/>
)
return cells === undefined ? (
button
) : (
<Box key={`${key}-slot`} minWidth={cells + 2} justifyContent="center">
{button}
</Box>
)
}
// One entry of the key legend, which is also what the key presses: a
// plain Button draws as `1: Min`, its hotkey in the accent color.Licence text (MIT)
MIT License Copyright (c) 2026 michaeldavodovski Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
What its code calls
remembers
The design, read from code
Drawn from the mod's source at the commit read, not from a run: a list is drawn three times, a condition takes its first branch that draws in the desktop app, and a value only the run time knows is shown as a made-up sample (dotted underline) or left out. Colours and type are this site's.
What its code shows
Read from the source at commit 954b6bdb6551 on 2026-10-06. The first group decides whether a mod is listed; the rest is for you to weigh. A later commit is not read until the next crawl.
| Decides the listing: code you can check | |
|---|---|
| Entry read | Every module hooks/hooks.json names was read.hooks/register.tsx |
| Parses | Every file parses as TypeScript or JavaScript.3 files parsed |
| All its code is in the mod | Every import is a file of the mod or the engine's own module; no packages, no require.all its code is in the mod |
| Readable | No minified lines, no eval or new Function, no import of a computed path, no encoded blobs.no minified code, no eval, no encoded blobs |
| Calls in the open | Network and programs are reached as $.http.fetch and $.process.run in place, never passed around.every call outside goes through $ in the open |
| For you to weigh before installing | |
| Where it draws | The terminal, the desktop app, both, or nothing (hooks only: a guard or a prompt rewriter), as its code says. Shown, never a reason to leave a mod out.draws in the terminal and the desktop app, the same in both |
| Install line | Whether its repository's own .claude-plugin/marketplace.json lists it, so it installs from that marketplace with the lines on its page.listed in its repository's .claude-plugin/marketplace.json: installs from there |
| Programs on Windows | Whether every program it starts through $.process exists on Windows (tail, date, open, osascript, /usr/… do not).runs no program a Windows PC lacks |
| Network | Whether every fetch names its https host in the code.no network |
| Programs | Whether every program it starts is named in the code and is not a shell, an interpreter or a network tool.starts no programs |
| Reads and sends | Whether it both reads files or environment variables and reaches the network.reaches no network |
| Keys in the source | Whether the source holds what looks like an API key or a private key.no keys in the source |
| Licence | An open licence (MIT, Apache-2.0, BSD, ISC, Unlicense, 0BSD, CC0) with its text lets modscode show its code; otherwise the code is linked.MIT |
This is a reading of the code text, not a security review: it does not run the mod, and it cannot see what a program the mod starts does. The check before installing is yours. How mods are chosen
Install it
Check it yourself before you install it. Mods run unsandboxed, with your permissions, and modscode does not vouch for what this code does. Read the code below (or run claude plugin validate . in its folder), weigh what it reaches, and install the commit you read.
Its repository is its marketplace. Add that marketplace (in the terminal with these commands, or in the desktop app's plugin settings) and install the mod from it:
/plugin marketplace add michaeldavodovski/claude-code-blackjack/plugin install blackjack@claude-code-blackjackThis installs the marketplace's latest commit, which may not be the one read here (954b6bdb6551). Compare them before you install.
Ask Claude about it
With the modscode connector added, Claude can read this design, what its code reaches and its code, and build on them. Ask it like this:
Read the modscode design "michaeldavodovski-blackjack" with its code and make me a pane like itSearch them from Claude: the MCP connector
Similar designs
-
Ask Claude…Fix loginRemoveCopy markdownacme/app · mainCopy linkCopy markdownbuild2h 10mbuild2h 10mbuild2h 10mHosted on uploads.sh, not committed to the repo.They will appear in a comment on the pull request once opened.
-
What it does
- Draws a band above the prompt, a pane
- Adds /progress
- Watches tool calls and can refuse them
- Hooks classic.SessionStart, prompt.compose, prompt.submit, session.start and 2 more
-
Ask Claude…Skins0 Your promptadd rate limiting to the hub api0 Tool rows: finished, running, failedYour prompt Spinner0 Folded group of reads and searches●main · note 3 · note 3 · note 30 Edit diff cardDesktop only; the terminal keeps Claude Code's diff.0 Shell output cardDesktop only.0 Code block cardDesktop only; the terminal keeps Claude Code's markdown.0 TableAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentCopyAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentCopyAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentAccentCopy0 SpinnerAccent SpinnerSpinnerSpinner… 2h 10m0 Band above the prompt: normal, then nudging to compact█████░░░ 42% build█████░░░ 42% build█████░░░ 42% buildContext is 42% full0 Compact now0 Band above a questionTable BashBashBash0 Turn footer (terminal)3 build in 2h 10m · Grep · +3 −3
-
spending-effort-with-jev: no TypeSafe API key, so effort tips are off. Set it in /plugin.⚠ effort: long run, fuzzy spec → have Claude interview you, then go maxAsk Claude…
-
✦ explain as pick how Claude answers×3 ● build3 ● build3 ● build▸ VideoAsk Claude…
-
Ask Claude…Clawd's shopLevel 3 · Fix loginTinkerer1 coin per 12.4 tokens Claude writes, 100 per level, 25 per badgeTake everything offContextbuildLevel 3buildLevel 3buildLevel 3ContextbuildLevel 3buildLevel 3buildLevel 3ContextbuildLevel 3buildLevel 3buildLevel 3