Every engine
03Engine

Scratch card, played-out rounds

A scratch card whose every card was made beforehand: what is under each panel comes with the draw; three alike win, a bonus panel multiplies.

Kind
one draw picks a whole round played out beforehand
Largest win
5,000x the stake
Name in the files
scratch (books)
Version
39350aa086f0

Download this engine as one file

What the player sets

  • feel: small wins often, balanced or rare big wins (the table of weights)

Every round also takes the return dial in basis points, 9600 to 9900, and a stake.

The round, in order

  1. the cards: 80,000 cards were made once by the rules below and are kept in one file (books: its name, its sha256, what each field is). A build loads the file and does not make the cards again; card i is the file's i-th entry, counted from 0
  2. how a card was made: first the prize it wins, or none, by rules.prizes (how many cards in 10,000 win each prize as made); then nine panels that say so: the winning prize exactly three times, no other prize more than twice, in a shuffled order; then a tenth panel with a multiplier by the weights in rules.bonus
  3. the card pays its prize times its multiplier, cut at 5,000 times the stake
  4. each card has a weight for the feel. Start: 1000 when the card pays under 200 times the stake, 200 when under 1,000 times, 40 above that (one card among so many must not carry the return). small wins often: the weight x 13 div 10 for a pay above 0 and up to 5 times the stake, x 6 div 10 for 20 times or more. rare big wins: x 7 div 10 for a pay above 0 and up to 2 times, x 16 div 10 for 20 times or more. balanced: unchanged. The weight of each winning card is that number times 1000
  5. every card that pays nothing has one and the same weight z, set for the dial: z = (S / (rtp / 10000) - W) / L rounded up to a whole number, at least 1, where S is the sum over the winning cards of weight x pay (pay in stakes), W the sum of their weights and L the number of losing cards. tables gives z and the total weight at the three dial points
  6. the order is: the winning cards as they come in the file, then the losing cards as they come in the file. r = int_below(total weight); the card picked is the first whose running weight is above r

The rounds: rain-books-scratch-v2.json.gz, 80,000 rounds as one JSON list in a gzip. The JSON text inside is 7,463,277 bytes, sha256 d38c9e186b02b1f82679b47e6652487fb923fb9cf057b1bc7c80c8c65a8801a6. What each field is, and the rules the rounds were made by, are in this engine’s file under books and rules.

int_below(m) is a whole number from 0 to m-1: limit = 2^64 - (2^64 mod m); take values until v < limit; return v mod m. shuffle: Fisher-Yates from the end, j = int_below(i+1). Words: HMAC-SHA256(key = seed, "STORM-DRBG|" || u64be(j)), cut into big-endian u64s.

What it pays

The picked card's pay (in hundredths of the stake), at most 5,000 times the stake. The return is the sum of weight x pay over the total weight. Because z is rounded up it is never above the dial, and it is within one millionth of it: tables gives each one exactly.

Tables

The tables the round uses at three points of the dial, each with its exact return. A multiple is kept in the files as a whole number times 10,000, rounded down (Storm’s multX1e4); here it is written out.

Dial at 96%

The weightslargest win 500x
FeelWinning roundsLosing roundsWeight of each losing roundTotal weightChance of a winExact return
balanced23,44756,553829,41870,344,276,15433.319271% (11719100000/35172138077)95.999993%
rare big wins23,44756,5531,064,12178,418,854,91323.259228% (2605660000/11202693559)95.999935%
small wins often23,44756,553730,42770,919,258,13141.753708% (29611420000/70919258131)95.999947%

Dial at 97.5%

The weightslargest win 500x
FeelWinning roundsLosing roundsWeight of each losing roundTotal weightChance of a winExact return
balanced23,44756,553810,28269,262,077,94633.839874% (11719100000/34631038973)97.499962%
rare big wins23,44756,5531,042,78877,212,409,76423.622653% (651415000/2757586063)97.499936%
small wins often23,44756,553711,13469,828,181,10242.406117% (14805710000/34914090551)97.499962%

Dial at 99%

The weightslargest win 500x
FeelWinning roundsLosing roundsWeight of each losing roundTotal weightChance of a winExact return
balanced23,44756,553791,72668,212,680,47834.360474% (11719100000/34106340239)98.999921%
rare big wins23,44756,5531,022,10176,042,497,85323.986087% (2605660000/10863213979)98.99997%
small wins often23,44756,553692,42668,770,187,57843.058513% (14805710000/34385093789)98.999948%

On Storm

In Storm’s core this engine is built from this page as written, with the settings and the largest win above, and is right when it reproduces the test rounds below. The rest of this part is about the templates Storm has live today, which is the way onto Storm until then.

Our reading against Storm’s templates: does not fit. 80,000 cards in a file, not a table of 64 rows, and the panels come with the draw.

On the templates it would take: a round picked from thousands played out beforehand: far over 64 rows, and the grid has to come with the draw.

Check a build against ours

36 whole rounds, each from a seed given in the file. A build is right when, from the same seed, settings, dial and actions, it makes the same draws in the same order and pays the same amount. The seed of a test round is sha256("rain-engine-vector|<engine>|<case>|<rtp_bps>|<i>"), given in hex in each vector.

small wins often, dial 9900
seed 486474f7a568f45e2eac0ae95cb919597dffec72515fc9ba31c9f0fe5655de9d
settings {"feel":"small wins often","mode":"books"}
draws int_below(68770187578) = 18122340660
pays 2x (payX10k 20000)
balanced, dial 9900
seed 36209c3984ed2d47820ef367aa6b2c546f7c14df9d49023d83c84fe8c5afcb40
settings {"feel":"balanced","mode":"books"}
draws int_below(68212680478) = 10360788954
pays 0.5x (payX10k 5000)

The rest are in this engine’s file, with the full result of each round. The reference build plays this engine and reproduces every one of them.