3 ms·
I cannot decipher the runes you write, but your magic looks to be more powerful than mine so you are probably right. (i.e., my Python script may have errors; it
by cbsks 2y ago
I cannot decipher the runes you write, but your magic looks to be more powerful than mine so you are probably right. (i.e., my Python script may have errors; it was pretty hacked together)
- xelxebar 2y agoFor anyone interested, here's a more pedagogical breakdown of the code: ⊢cards←52↑26⍴1 ⍝ We encode a red-black sequence in a bitfield 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ⊢rem←⌽⍳≢cards ⍝ Remaining card count after corresponding play 51 50 49 48 47 46 45 44 43 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 ⊢sgn←¯1+2×cards ⍝ Contribution to re-black delta 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1 ¯1 ⊢del←+⍀sgn ⍝ Delta between count of red vs. black cards 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 ⊢rat←0⍪¯1↓del÷rem ⍝ Our ratio is r-b delta as fraction of remaining cards after play 0 0.01960784314 0.04 0.0612244898 0.08333333333 0.1063829787 0.1304347826 0.1555555556 0.1818181818 0.2093023256 0.2380952381 0.2682926829 0.3 0.3333333333 0.3684210526 0.4054054054 0.4444444444 0.4857142857 0.5294117647 0.5757575758 0.625 0.6774193548 0.7333333333 0.7931034483 0.8571428571 0.9259259259 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ⊢pay←1-sgn×rat ⍝ Payout ratio: sgn×rat is negative on win and positive on loss 1 0.9803921569 0.96 0.9387755102 0.9166666667 0.8936170213 0.8695652174 0.8444444444 0.8181818182 0.7906976744 0.7619047619 0.7317073171 0.7 0.6666666667 0.6315789474 0.5945945946 0.5555555556 0.5142857143 0.4705882353 0.4242424242 0.375 0.3225806452 0.2666666667 0.2068965517 0.1428571429 0.07407407407 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ⊢tot←×⍀pay ⍝ Total stake is product scan over individual payout ratios 1 0.9803921569 0.9411764706 0.8835534214 0.8099239696 0.7237618452 0.6293581262 0.5314579733 0.4348292508 0.3438184774 0.2619569352 0.1916758062 0.1341730644 0.08944870957 0.05649392183 0.03359098055 0.01866165586 0.009597423014 0.00451643436 0.001916063062 0.0007185236481 0.000231781822 0.00006180848586 0.00001278796259 0.000001826851799 1.353223555E¯7 2.706447109E¯7 5.412894219E¯7 0.000001082578844 0.000002165157688 0.000004330315375 0.00000866063075 0.0000173212615 0.000034642523 0.000069285046 0.000138570092 0.000277140184 0.000554280368 0.001108560736 0.002217121472 0.004434242944 0.008868485888 0.01773697178 0.03547394355 0.0709478871 0.1418957742 0.2837915484 0.5675830968 1.135166194 2.270332387 4.540664775 9.081329549 ⊢min←⌊⌿rat ⍝ Minimum stake 1.353223554704754E¯7 ⊢start←⌈÷min ⍝ Minimum starting amount is ceil of inverse min stake 7389762 ⊢fin←⊃⌽tot ⍝ Final stake is last element of totals 9.081329549 ⌊fin×start ⍝ Gross winnings are floor of start times final stake ratio 67108864