modscode / Gallery / pachincode
pachincode
A pachinko machine that fills up with balls while Claude writes: jackpots, right strike, kakuhen.
What it does
- Draws a pane, a band above the prompt, toasts
- Adds /pachinko
- Hooks prompt.submit, session.append, session.start, turn.complete and 2 more
- Keeps its own state between turns
- Starts processes
Good points
- No network calls
- Written in TypeScript
- Has a desktop-specific branch
- Handles errors
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 pachincode by Dean (pane, band, toast), as modscode read it from the mod's code:
// https://modscode.com/gallery/xd3an-pachincode/
// 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: "PachinCode" })
on('ui.render', { component: 'Pane', requestId: 'my-pane' }, async ($, e) => {
const { Box, Text, Button } = $.ui.resolve(e)
const points = '…'
const jackpots = '…'
const bar = '…'
const power = '…'
const ammo = '…'
const holds = '…'
return (
<Box flexDirection="column">
<Box justifyContent="space-between">
<Text color="#ffd700" bold>
{"PachinPoints "}
{points}
</Text>
<Text color="#9aa0a6">
{"大當たり "}
{jackpots}
</Text>
</Box>
<Text wrap="truncate">
<Text color="#ffd700">
{"◉ 自動發射中 "}
</Text>
<Text color="#ff4d4d">
{"力 "}
{bar}
{" "}
{power}
{"% "}
右打ち
</Text>
<Text color="#e6e6e6">
{" 玉 "}
{ammo}
</Text>
<Text color="#ff4d4d">
{" 保留 "}
{holds}
</Text>
<Text color="#ff3b3b">
{" "}
確変中 1/9.9
</Text>
</Text>
<Box gap={1}>
<Button hotkey="s" variant="primary" label="停止" />
<Button hotkey="f" label="發射" />
<Button hotkey="a" label="力−" />
<Button hotkey="d" label="力+" />
<Button hotkey="l" label="左打" />
<Button hotkey="r" label="右打" />
</Box>
<Text wrap="truncate" color="#ffd700">
按「自動發射」或「發射」打珠;力−/力+調力道,左打/右打切換。
</Text>
</Box>
)
})
// the band above the prompt; what else goes there is drawn under it
on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
const { Box, Client } = $.ui.resolve(e)
return (
<Box flexDirection="column">
<Client module="./surfaces/glow.tsx" height={1} />
{await next(e)}
</Box>
)
})
on('session.start', async ($, e, next) => {
await $.ui.toast(`プレミアム大當たり!7-7-7 右打ち ▶▶▶`)
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 430–518 · Pane
on('ui.render', { component: 'Pane', requestId: PANE }, async ($, e) => {
const m = await read($, machine)
const lamps = await read($, hud)
const ammo = Math.max(0, m.granted - m.tally.fired)
if (e.surface !== 'terminal' && e.surface !== 'desktop') {
const { Text } = $.ui.resolve(e)
return <Text dimColor>PachinCode 的機台畫面只在終端機與桌面版顯示。PachinPoints {m.points}</Text>
}
const turned = await read($, handle)
let screen
if (e.surface === 'desktop') {
// No cell grid here: the machine is an image, redrawn on every bump of `frame`.
const { Svg } = $.ui.resolve(e)
await read($, frame)
live.desktopIdle = 0
if (game.geometry === null) game.geometry = buildGeometry(DESKTOP_COLS, DESKTOP_ROWS)
screen = <Svg key="screen" source={paintSvg(game)} alt="PachinCode 柏青哥機台" />
} else {
const { Box, Raster, Client } = $.ui.resolve(e)
const cols = Math.max(32, Math.min(200, e.props.bodyColumns))
const rows = Math.max(16, Math.min(80, (e.viewport?.rows ?? 30) - 7))
if (game.geometry === null || game.geometry.cols !== cols || game.geometry.rows !== rows) {
game.geometry = buildGeometry(cols, rows)
}
live.isMounted = true
screen = (
<Box width={cols} height={rows}>
<Raster key="screen" columns={cols} rows={rows} cells={paint(game)} />
{/* An invisible layer over the machine takes the mouse and Space. */}
<Box position="absolute" top={0} left={0}>
<Client key="pad" module="./surfaces/pad.tsx" props={{ columns: cols, rows }} width={cols} height={rows} />
</Box>
</Box>
)
}
const { Box, Text, Button } = $.ui.resolve(e)
const isRight = turned.power >= 80
const bar = '▰'.repeat(Math.round(turned.power / 10)) + '▱'.repeat(10 - Math.round(turned.power / 10))
const holds = '●'.repeat(lamps.holds) + '○'.repeat(Math.max(0, 4 - lamps.holds))
return (
<Box flexDirection="column">
<Box justifyContent="space-between">
<Text color="#ffd700" bold>
PachinPoints {m.points}
</Text>
<Text color="#9aa0a6">大當たり {m.tally.jackpots}</Text>
</Box>
{screen}
<Text wrap="truncate">
<Text color={turned.isAuto ? '#ffd700' : '#9aa0a6'} bold={turned.isAuto}>
{turned.isAuto ? '◉ 自動發射中 ' : '○ 停止 '}
</Text>
<Text color={isRight ? '#ff4d4d' : '#00e5ff'}>
力 {bar} {turned.power}% {isRight ? '右打ち' : '左打ち'}
</Text>
<Text color="#e6e6e6"> 玉 {ammo}</Text>
<Text color={lamps.holds === 4 ? '#ff4d4d' : '#ff9f1a'}> 保留 {holds}</Text>
<Text color={m.isKakuhen ? '#ff3b3b' : '#9aa0a6'}> {m.isKakuhen ? '確変中 1/9.9' : '1/99'}</Text>
</Text>
<Box gap={1}>
<Button
key="auto"
hotkey="s"
variant="primary"
label={turned.isAuto ? '停止' : '自動發射'}
onPress={() => setHandle($, now => ({ ...now, isAuto: !now.isAuto }))}
/>
<Button
key="shot"
hotkey="f"
label="發射"
onPress={() => press(1)}
/>
<Button key="less" hotkey="a" label="力−" onPress={() => setHandle($, now => ({ ...now, power: Math.max(0, now.power - 5) }))} />
<Button key="more" hotkey="d" label="力+" onPress={() => setHandle($, now => ({ ...now, power: Math.min(100, now.power + 5) }))} />
<Button key="left" hotkey="l" label="左打" onPress={() => setHandle($, now => ({ ...now, power: 30 }))} />
<Button key="right" hotkey="r" label="右打" onPress={() => setHandle($, now => ({ ...now, power: 95 }))} />
</Box>
<Text wrap="truncate" color={lamps.message ? '#ffd700' : undefined} dimColor={!lamps.message}>
{lamps.message ||
(e.surface === 'desktop'
? '按「自動發射」或「發射」打珠;力−/力+調力道,左打/右打切換。'
: '在機台上按住滑鼠發射;點一下機台後 Space 發射、←→ 力道。也可以 ctrl+x tab 後按 S/F/A/D/L/R')}
</Text>
</Box>
)
})hooks/register.tsx lines 520–538 · Band
on('ui.render', { component: 'AbovePrompt' }, async ($, e, next) => {
const m = await read($, machine)
if (e.props.hasSurvey || !m.isEnabled) {
return next(e)
}
const glow: GlowProps | undefined = m.tally.isFever
? { mode: 'fever', text: '右打ち中 ▶▶▶ RIGHT STRIKE 這段回覆會鍍金' }
: m.isKakuhen && e.props.isWorking
? { mode: 'kakuhen', text: '確変中 大當たり機率 ×10 (1/9.9)' }
: m.isKakuhenNext && !e.props.isWorking
? { mode: 'next', text: '次回確変 下一個問題大當たり機率 ×10,繼續連莊!' }
: undefined
if (glow === undefined || (e.surface !== 'terminal' && e.surface !== 'desktop')) {
return next(e)
}
const { Client } = $.ui.resolve(e)
return <Client key="glow" module="./surfaces/glow.tsx" props={glow} width={e.props.bodyColumns} height={1} />
})Licence text (MIT)
MIT License Copyright (c) 2026 XD3an 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
runs programswrites filesenv varsremembers
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 61ee4f0e918b 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.23 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, with its own branch for the desktop |
| 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.hooks/register.tsx:111 powershell.exe (a shell or interpreter) |
| 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 XD3an/PachinCode/plugin install pachincode@pachincodeThis installs the marketplace's latest commit, which may not be the one read here (61ee4f0e918b). 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 "xd3an-pachincode" with its code and make me a pane like itSearch them from Claude: the MCP connector
Similar designs
-
Open a file first: /crit-tui file <path>Reopen this one in the crit browser view.Ask Claude…
-
Ask Claude…Temper Run◈ TemperIntentUntitled runAcceptance criteria (what must be true) · 3 of 3 metNo criteria found in intent.md.✔ Walk through✔ Walk through✔ Walk throughand 3 more. Open the pane in a wider terminal.Phase · DiscussFix login · paused● build● build● build✓ done ● you are here ○ upcoming ↺ redo14:32Teach meTimeline, oldest firstCheckCheckCheckOpen findings · 3#a1b2c3d high: ResumeFixAccept with reasonExplain#a1b2c3d high: ResumeFixAccept with reasonExplain#a1b2c3d high: ResumeFixAccept with reasonExplainMore actions. Press the number shown.K build K PlanK build K PlanK build K Plan0 Fewer actions 0 Show or hide the other actions.8 Close the game 8 A small game for the wait.
-
Ask Claude…Agents●●●✻ AgentsEditNo agents yet. They show here while they run.Agent──Fix login────────● build ········━━━━━━━━········2h 10m● build ········━━━━━━━━········2h 10m● build ········━━━━━━━━········2h 10m✗ Grepclick an agent to open it · click "done" to hide finished ones
-
Ask Claude…Pick a look for builddraw your own with /familiar draw. esc closes●●●●●●●●●clawd 3●●●●●●●●●clawd 3●●●●●●●●●clawd 3
-
Ask Claude…────────Clear doneClaude⋯└─ buildCancelCancelCancel└─ buildCancelCancelCancel└─ buildCancelCancelCancel
-
What it does
- Draws a pane, a band above the prompt
- Adds /lingo
- Hooks prompt.edit, prompt.submit, session.start
- Keeps its own state between turns