Guest User

Untitled

a guest
Dec 23rd, 2011
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.75 KB | None | 0 0
  1. from API import *
  2. import random
  3.  
  4. # 0 => 1; 1 => 0
  5. def change(n):
  6.     if n == 1:
  7.         return 0
  8.     else:
  9.         return 1
  10.  
  11. # Generuje blok nahodnych cisel (stejne jako API).
  12. # Po vygenerovani urciteho poctu (fin) stejnych cisel konci.
  13. def ntice(fin):
  14.     cnt = 1
  15.     num = random.randint(0, 1)
  16.  
  17.     while True:
  18.         if random.randint(0, 1) == num:
  19.             cnt += 1
  20.         else:
  21.             cnt = 1
  22.             num = change(num)
  23.  
  24.         if cnt == fin:
  25.             return num
  26.  
  27. # Hraje Martingale
  28. def martingale(number, stake):
  29.     while True:
  30.         res = game.spin(number, stake)
  31.  
  32.         if res == number or res == 2:
  33.             return
  34.         else:
  35.             stake *= 2
  36.  
  37. for i in range(10000):
  38.     martingale(change(ntice(3)), 0.01)
  39.  
  40. if game.getBallance() < 50:
  41.     game.spin(random.randint(0, 1), game.getBallance())
  42.  
  43. game.exitGame()
Advertisement
Add Comment
Please, Sign In to add comment