• API
• FAQ
• Tools
• Archive
daily pastebin goal
62%
SHARE
TWEET

# Untitled

a guest Jun 13th, 2018 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. SPOTS = ([:red]*18)+([:black]*18)+([:green]*2)
2. TAB_MAX = 500
3. TAB_MIN = 10
4.
5. @pot = 0
6. @bet = TAB_MIN
7. @turn = 0
8. @averages = []
9.
10. def spin
11.   loop do
12.     if @bet > TAB_MAX
13.       @averages.push @turn
14.       puts "Turn: #{@turn}"
15.       @pot = 0
16.       @bet = 0
17.       @turn = 0
18.       break
19.     end
20.     @turn += 1
21.     puts "Bet: #{@bet}"
22.     if SPOTS.rand == :red
23.       puts "Winner"
24.       @pot += @bet
25.       puts "Pot: #{@pot}"
26.       @bet = 10
27.     else
28.       puts "Loser"
29.       @pot -= @bet
30.       puts "Pot: #{@pot}"
31.       @bet = @bet*2
32.     end
33.   end
34. end
35.
36. def total_average
37.   @averages.sum/@averages.length
38. end
39.
40. def odds
41.   (10..100).step(3) do |i|
42.     o = i*max_loss_odds
43.     break if o > 100
44.     puts "#{i} - #{o.round(2)}%"
45.   end
46. end
47.
48. def max_loss_odds
49.   odds = 52.63
50.   max_losses.times do |i|
51.     odds = odds*0.5263
52.   end
53.   odds
54. end
55.
56. def max_losses
57.   turn = 0
58.   total_lost = 0
59.   while total_lost < TAB_MAX
60.     turn += 1
61.     total_lost += TAB_MIN*turn
62.   end
63.   turn-1
64. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

Top