P-LensOpen the app

Pachinko

Japanese pachinko, explained

Pachinko is played on an upright board with small steel balls, in Japan's pachinko parlors. This page explains the machine for readers who have never sat at one, then the two numbers players keep about it, the spin rate and the border, and how P-Lens works with them.

The machine

An upright board of pins

A pachinko machine is an upright cabinet with a glass front. Behind the glass is a board studded with brass pins, a little like a vertical pinball table without flippers. The player turns a handle, and the machine fires small steel balls, 11 mm across, up the side of the board, one after another, at a strength set by how far the handle is turned. The balls fall back down through the pins.

Most balls fall to the bottom and are lost. A few land in pockets that pay balls back. The one that matters is the start pocket (スタートチャッカー, usually called ヘソ, the navel), in the middle of the board. A ball that enters it pays back a few balls and, more importantly, starts a draw.

The draw is shown on a screen in the centre of the board as spinning digital reels, usually three numbers or symbols. Whether the draw is a win was decided by the machine's random number generator the moment the ball entered; the reels, and the animation around them, take some seconds to say so. Balls that enter while a draw is still showing are held as queued draws (保留), up to four of them, and shown one after another.

One draw is one spin (回転). The player's whole aim at the board is to get balls into the start pocket: the more spins a given number of balls buys, the better the machine is playing for them.

The jackpot

The jackpot and its rounds

When the reels stop on a winning combination, that is a jackpot (大当り, oh-ah-ta-ri). A jackpot opens a large gate on the board, the attacker (アタッカー), and the player fires balls into it. Each ball that enters pays a fixed number of prize balls. The gate closes after a set number of balls have entered, or a time limit passes; that is one round (ラウンド, R). A jackpot is so many rounds, ten for example.

The figures differ from machine to machine. In the test machine P-Lens keeps among its fixtures, a ball entering the attacker pays 15 balls and a round closes after 10 balls: 150 balls paid for 10 fired in, a gain of 140 balls a round. The engine's analysis of that machine gives exactly 140 (expected.json).

確変, ST and 時短

What happens after a jackpot is where machines differ most. Many jackpots lead into a mode that is better than ordinary play, for a while or until the next jackpot:

  • 確変 (ka-ku-hen, probability variation): the chance of a jackpot is raised. In the classic form it stays raised until the next jackpot, so jackpots come in a chain.
  • ST (special time): the raised chance lasts a fixed number of spins. If no jackpot comes in that many, play goes back to ordinary.
  • 時短 (ji-tahn, time-saving): the chance of a jackpot is the ordinary one, but the spins go fast, and an electric support (電サポ, den-sa-po) opens a second start pocket often, so balls are hardly lost while it lasts.

Spec sheets and players often call the good mode after a jackpot a RUSH, which may be an ST, a 確変 or a 時短 underneath. How likely a jackpot is to lead into the good mode (the allotment, 振分) and how likely the mode is to continue (the continuation rate, 継続率) decide much of a machine's character. Machines also have newer features, such as 遊タイム (yu-tai-mu), a 時短 that starts after a long run of ordinary spins with no jackpot.

A jackpot pays balls, and those balls are the player's to keep playing or to exchange. While playing them, the player is no longer renting balls with cash; that difference turns out to matter, as the next sections show.

Rental and exchange

Renting balls, and the exchange rate

Balls are rented at the machine. The price is capped by regulation at 4 yen a ball, plus consumption tax, and most parlors' 4-yen corners rent 250 balls for 1,000 yen (some rent fewer, such as 240). Parlors also have lower-rate corners, most often 1 yen a ball, where the same play costs a quarter as much.

At the end, the balls left are counted and exchanged for prizes at the parlor's counter, at the price they were rented at. Special prizes are then sold for cash at a separate prize exchange shop, and that is where the discount is. The exchange rate is stated as the balls it takes to get 100 yen at the shop. At 25 balls per 100 yen, a ball comes back as what it was rented for (equal exchange, 等価). At 28 balls per 100 yen, a ball rented for 4 yen comes back as about 3.57 yen. Each parlor's rate is its own.

Balls can also be left with the parlor on deposit (貯玉, cho-dah-ma) and played on another day. The parlor, the counter and deposits are covered on their own page, Japan's pachinko parlors, with the law that shapes them.

The numbers

The spin rate and the border

A pachinko machine's chance of a jackpot on any one spin is fixed by its design: 1 in 319.7, say, printed on the spec sheet. What is not fixed is how many spins a player gets for their money. That depends on how the pins in front of the start pocket are set on that cabinet, on the day, and it is the one figure players can measure for themselves.

The spin rate (回転率, kai-ten-ri-tsu) is the number of spins per 1,000 yen of balls. At a 4-yen corner renting 250 balls for 1,000 yen, that is the spins per 250 balls, and players use the same measure when they are playing their own balls rather than rented ones.

The border (ボーダー, boh-dah, border line) is the spin rate at which the theoretical value of play is zero, for given exchange conditions. Above it, a spin wins back on average more balls, exchanged, than it cost; below it, fewer. The exchange rate moves it: the fewer yen a ball exchanges for, the more spins per 1,000 yen it takes for the balls a spin wins to pay for the spin.

P-Lens works the border out from two figures of the machine. From core/pachinko/theoretical-value.ts:

/**
 * Balls a regular-game spin wins on average. The one place a theoretical
 * value starts from, for typed-in figures and simulated ones alike.
 */
export const ballsPerSpin = (figures: Figures): number => figures.payoutPerRound / figures.roundChanceOneIn

/** Spins per ¥1,000 at which the balls a spin wins, exchanged, repay what it costs. */
export const borderOf = (figures: Figures, ballValue: number): number => 1000 / (ballsPerSpin(figures) * ballValue)

roundChanceOneIn is the 1R トータル確率, one round won per so many ordinary spins over the long run, jackpots, modes and all; payoutPerRound is the 1R 平均出玉, the balls one round gains. Their quotient is the balls an ordinary spin wins on average. The border is the spin rate at which those balls, at ballValue yen each, come to 1,000 yen.

A worked example

Take a machine, invented for the arithmetic, that wins one round per 10 spins over the long run, at 140 balls a round: 14 balls a spin on average. At a 4-yen corner renting 250 balls for 1,000 yen:

ExchangeBorder (spins per ¥1,000)
Equal exchange, 25 balls per ¥100 (¥4.00 a ball)17.9
28 balls per ¥100 (about ¥3.57 a ball)20.0

At 28 balls per 100 yen, a spin wins 14 × 3.57 = 50 yen in cash on average, and 20 spins per 1,000 yen is what makes a spin cost 50 yen. A player measuring 22 spins per 1,000 yen at that parlor is playing above the border, by 50 − 1,000 ÷ 22 ≈ 4.5 yen a spin; one measuring 18 is playing below it, by about 5.6 yen a spin.

Balls won in the play change the arithmetic. A rented ball costs 4 yen; a ball the player already holds costs what it would have exchanged for. Played entirely with their own balls, a player's border at 28 balls per 100 yen comes down to the equal-exchange figure, 17.9 in the example. P-Lens counts each ball played at what it cost, so the border it shows for a play moves with the share of own balls in it.

In P-Lens

Theoretical value in the book

P-Lens is a bookkeeping app for a player's own pachinko and pachislot results. Beside the cash and balls each play moved, it can keep the play's theoretical value.

Theoretical value (仕事量, shi-go-to-ryoh, as players call it) is, in P-Lens: for the plays actually done, the cumulative theoretical gain or loss that occurred under their calculation conditions. A calculation condition (算出条件) is a machine's figures, the two above, together with the play's own terms: its spin rate, the parlor's rental and exchange, and the share of own balls. For a pachinko play, the theoretical value is the spins played times what each was worth: what a spin wins on average, exchanged, less what it cost.

The app also has a calculator, 期待値算出, that works out the expected value of a play not yet made, from spins and terms the player types in (ValueSheet.tsx). Both figures are labelled 期待値 (ki-tai-chi) in the app. The one kept in the book is the first: it belongs to plays that took place.

How a play gets one

  • Measured. Followed live at the machine, a play's spins and balls are counted as it goes, and the spin rate and theoretical value are recalculated with each reading.
  • Inferred. A play recorded afterwards, from its hours and the cash in and out, has no measured spin rate. P-Lens plays the machine out by Monte Carlo simulation, two million times (inference.ts), and takes the middle of the spin rates and theoretical values that agree with what the play is known to have done. An inferred value is kept on an account of its own, 統計:期待値:推定, so it is never mistaken for a measured one.
/** How many times a machine is played out to weigh one play typed in by hand. */
export const TRIALS_BY_HAND = 2_000_000

Kept beside the result, never in it

The book is a set of hledger journals. A theoretical value is a posting in the play's entry, written in parentheses: a virtual posting, which hledger adds up when asked about its account and which takes no part in the entry's balance. From core/theoretical/theoretical.ts:

/**
 * The theoretical value of a play, as a posting.
 *
 * Neither money nor a promise of money, so never a real posting: a virtual one
 * on an account with no type. hledger sums it when asked about
 * `統計:期待値` and leaves it out of every balanced report, which is what
 * keeps it apart from what was actually won or lost.
 */
export const theoreticalValuePosting = (value: Decimal): Posting => ({
  account: ACCOUNTS.theoreticalValue,
  amount: { quantity: value, commodity: YEN },
  kind: "virtual",
})

An entry with one, from the design document's example (ARCHITECTURE.md):

2026-09-05 マレハン東京皇国第8支店 | 流星 123番台  ; play-id: …, parlor-id: malehan-tokyokoukoku, game-kind: pachinko, machine: 流星, cabinet-number: 123
    資産:現金                         -12000 JPY
    費用:貸玉差額                       1290 JPY
    費用:遊技                           3000 "玉(4円・マレハン東京皇国第8支店)" @ 3.57 JPY
    資産:貯玉:マレハン東京皇国第8支店:4円        4800 "玉(4円・マレハン東京皇国第8支店)"
    収益:遊技                          -4800 "玉(4円・マレハン東京皇国第8支店)"
    (統計:期待値)                       5500 JPY

The first five postings are what happened: cash spent, balls rented and played, balls left on deposit at マレハン東京皇国第8支店 (a fictional parlor; read Ma-re-han Toh-kyoh Koh-ko-ku Dai-ha-chi Shi-ten, “Marehan, Tokyo Empire, Branch No. 8”). They balance. The last line, (統計:期待値), is the play's theoretical value, 5,500 yen, alongside them. The calendar and the breakdowns show results and theoretical values side by side. The article Beyond money: hledger as an aggregation engine goes through the virtual posting and its account. Why balls are a unit of their own, per parlor and rate, is in Law shapes the ledger: modeling Japanese pachinko.

Machine data

A machine as components

The two figures a theoretical value needs can be typed in, or worked out on the device from the machine's specification, by an exact calculation in Rust compiled to WebAssembly. A specification is not one record per kind of machine. Each mode is an entity, and what kind of mode it is follows from the components it has. The doc comment on the type, from crates/pachinko-domain/src/spec.rs:

/// A machine as an ECS world, in the words pachinko uses: its entities — the
/// regular game and the modes a jackpot can lead to — each made of whichever
/// components it has, and the resources the whole machine shares.
///
/// A feature is a component: a mode is a 時短 because it has `rapid`, a
/// 遊タイム is a `relief_drive` on the regular game. A machine the model grows
/// to cover gains a component, not a new shape. Nothing here is a state
/// machine; the engine queries the components and derives one.
#[derive(Clone, Debug, PartialEq, Default)]
pub struct Spec {
    /// Every entity, in the order it was made: the order its states take.
    pub entities: Vec<ModeId>,
    pub components: Components,
    pub resources: Resources,
}

The modes from earlier on this page are components of their own (the same file):

    /// How a jackpot won there is allotted.
    pub allotment: BTreeMap<ModeId, Vec<Allotment>>,
    /// An ST: so many spins at a raised chance.
    pub special_time: BTreeMap<ModeId, SpecialTime>,
    /// A 時短: so many spins at the regular game's chance, played fast and
    /// with tulip support.
    pub rapid: BTreeMap<ModeId, Rapid>,
    /// 残保留: the draws still queued when a mode's spins run out, made at
    /// the regular game's chance.
    pub leftover_queue: BTreeMap<ModeId, LeftoverQueue>,
    /// A RUSH as many spec sheets summarise it: a continuation rate given directly.
    pub rushing: BTreeMap<ModeId, Rushing>,
    /// Until the next jackpot, which is certain: a 確変 loop.
    pub until_hit: BTreeSet<ModeId>,

The whole specification of the test machine mentioned above, made-up/spec.json: an ordinary game winning one in 100, half its jackpots leading to a RUSH that continues 80% of the time, ten rounds a jackpot. Its numbers belong to no machine in any parlor, and are kinder than any.

{
  "v": 1,
  "entities": ["regular", "RUSH"],
  "components": {
    "regularGame": {
      "regular": { "chance": { "type": "ratio", "numerator": 1, "denominatorHundredths": 10000 } }
    },
    "label": { "RUSH": "RUSH" },
    "allotment": {
      "regular": [
        { "shareBasisPoints": 5000, "rounds": 10, "next": { "type": "regular" } },
        { "shareBasisPoints": 5000, "rounds": 10, "next": { "type": "mode", "mode": "RUSH" } }
      ],
      "RUSH": [{ "shareBasisPoints": 10000, "rounds": 10, "next": { "type": "mode", "mode": "RUSH" } }]
    },
    "rushing": { "RUSH": { "continuationRate": { "type": "percent", "basisPoints": 8000 } } },
    "onMiss": { "RUSH": { "type": "regular" } }
  },
  "resources": { "payout": { "prizeBalls": 15, "count": 10 } }
}

Further

Further reading