P-LensOpen the app

Overview

A book for your own pachinko and pachislot

P-Lens is a free, open-source bookkeeping app for a player's own pachinko and pachislot results in Japan. It records what each play cost, what was left, what is on deposit at which parlor and what was exchanged at the counter, and keeps it all as plain-text hledger journals on the player's own device.

The app

Free, open, and on your device

  • Free and open source. The source is on GitHub under GPL-3.0-or-later.
  • An app from the browser. P-Lens is opened at app.p-lens.jp and installed from there to the home screen. It is not in the app stores.
  • Offline. Everything needed to record and read a book is kept on the device, so it works without a connection.
  • No login, no ads. There is no account to make, and no advertising in the app.
  • In Japanese. The app's screens are in Japanese, as are the parlors, machines and terms it deals with.

The book

What it records

One play at one machine is one entry. An entry can be as short as the cash spent and what came back, and as full as the following:

  • Cash spent on renting balls or tokens.
  • Balls and tokens, counted per parlor and per rental rate. A ball at one parlor is not a ball at another, so each is a unit of its own.
  • Deposits (貯玉, cho-dah-ma): the balls or tokens left with a parlor to play another day, as a balance at that parlor, valued at that parlor's exchange rate.
  • Prizes received at the parlor's counter in exchange for balls or tokens.
  • Play time.
  • Theoretical value (期待値, ki-tai-chi; players call it 仕事量, shi-go-to-ryoh): the cumulative theoretical gain or loss of the plays actually done, under their calculation conditions. It is kept beside the result, never mixed into it.

From these the app draws a calendar of each day's result and theoretical value, breakdowns by machine, parlor, weekday, tag or month, and each parlor's deposits valued on any day.

The P-Lens calendar for October 2026, in Japanese. At the top, the month's result (実収支), +¥34,500, and its theoretical value (期待値), +¥24,072. Each day of the month shows that day's result in green or red, with its theoretical value under it.
The calendar: each day's result, and its theoretical value under it.
The P-Lens deposits screen (貯玉・貯メダル), in Japanese, valued on October 12, 2026: ¥184,906 in all. 723豚の帽子亭店 (a fictional parlor; read Shi-chi-nissan Buta-no-boh-shi-tei, “723, the Pig's Hat Tavern”) holds 4,850 tokens at the 20-yen rate and 5,200 balls at the 4-yen rate; マレハン東京皇国第8支店 (a fictional parlor; read Ma-re-han Toh-kyoh Koh-ko-ku Dai-ha-chi Shi-ten, “Marehan, Tokyo Empire, Branch No. 8”) holds 1,200 tokens and 13,870 balls. Each balance shows the parlor's exchange rate and its value in yen.
Deposits, by parlor and rate, valued at each parlor's exchange rate.

The file

A book in plain text

The book of record is a set of hledger journal files, kept in the browser's storage on the device. P-Lens runs hledger itself in the browser, compiled to WebAssembly, and every change is read by hledger before it is kept. Nothing the book adds up to is stored apart from it.

The files are the same ones hledger reads on a computer. A book can be exported as journal files, CSV or a zip, and backed up to Google Drive or to a file. If P-Lens went away, the journals would still read with hledger -f main.journal.

A journal file open in P-Lens, transactions/2026.journal, in Japanese. Opening balances of deposits at マレハン東京皇国第8支店 and 723豚の帽子亭店, then plays, each a dated hledger transaction with postings such as 収益:遊技 (play revenue), 純資産:特殊景品 (special prizes), 資産:現金 (cash), and the virtual postings (統計:期待値) for theoretical value and (統計:時間) for play time in seconds.
The book itself: hledger journal text, shown read-only in the app.

Theoretical value

The numbers behind each play

For each machine the app works from a calculation condition (算出条件): the machine's figures, as typed in or as worked out on the device from the machine's specification by an exact calculation in Rust and WebAssembly. Machines and their calculation conditions come from a catalog every user shares and adds to.

  • Pachinko. The spin rate per 1,000 yen, measured while playing, or worked out afterwards from play time and the money in and out, gives the theoretical value and the break-even spin rate (ボーダー, boh-dah) at the parlor's rental and exchange rates.
  • Pachislot. The figures on the data counter, and small wins counted while playing, give how likely each setting level is, by Bayesian inference, and the theoretical value that follows.
  • The grounds. How a calculation condition was derived is built on the device as a proof tree by Trealla Prolog, and shown checked against the engine's answer.

A play can be followed live at the machine, each reading recalculating the figures, and becomes an entry in the book when it is recorded.

Sync and sharing

Between your devices, and with friends

A book can be kept in step between a phone and a computer, and shared with other players: to edit, to view, or only to receive their plays without seeing the book. Several books can be added up into one view, by book or by player.

Friends playing on the same day can also follow each other's machines live, joining by a QR code. That view is for the day at hand and writes nothing in anyone's book.

Everything that crosses devices is encrypted on the device before it leaves, and travels through a relay over the Nostr protocol. The relay passes it on; it cannot read the books or plays it carries.

Other apps

Bringing a record in, and taking it out

Past results can be imported from pRecord, ぱち簿, MAXBET, Myパチ収支表, マネクルSP and パチフォリオ, and exported in each one's own format. Any other app's records, or a spreadsheet of one's own, come in as a CSV in a general format, choosing what each column is.

Japan's rules

A book that ends at the prize counter

In Japan, you cannot cash out at the pachinko parlor. Balls and tokens are exchanged for prizes at the parlor's counter, and P-Lens records exactly that: its book ends at the counter, with prizes, and has no step that turns balls into cash.The page on Japan's pachinko parlors explains how a visit works and what the law says.

Cost

What it costs

Everything in P-Lens is free. Sync between devices and people goes through a relay server the project runs, and sync alone may become paid at some point. A relay can also be run by oneself, with one's own build of the app; then sync stays free, on one's own server.

Technology

How it is built

hledger compiled to WebAssembly keeps the books, calculation engines written in Rust work out the numbers, Trealla Prolog builds the proofs, SolidJS draws the screens, and Nostr carries what crosses devices. The source is on GitHub.

The engineering notes go into each part, with the code:

P-Lens Engineering Notes