Vous avez hâte de dilapider votre argent ? Jouez à la roulette !
contrôles :
Un autre jeu du casino NumWorks est disponible ici !
Les jeux d’argents sont destructifs sur tous les plans, n’y jouez pas dans la vraie vie.
from math import * from random import * from kandinsky import * from ion import * from time import * C1=(0,)*3 C2=(200,0,0) C3=(0,200,0) n="??" money=15 colors=[2,1,0,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1,1,0,1,0,1,0,1,0,1,0,0,1,0,1,0,1,0,1] mises=[0,]*43 focus=5 ex_focus=0 move=False def draw_num(num): x=21+((num-1)//3)*25 y=2+((num-1)%3)*25 fill_rect(x-3,y-3,28,28,[(100,)*3,(0,200,200)][focus==num]) fill_rect(x,y,22,22,[C1,C2,C3][colors[num]]) draw_string("{:>2}".format(str(num)),x+1,y+2,(255,)*3,[C1,C2,C3][colors[num]]) for i in range(mises[num]): draw_money(x+randint(0,10),y+randint(0,10)) def draw_plateau(): fill_rect(0,0,19,76,(100,)*3) fill_rect(2,2,15,72,(0,200,0)) draw_string("0",5,29,(255,)*3,(0,200,0)) for i in range(12): for ii in range(3): draw_num(i*3+ii+1) def draw_money(x,y): fill_rect(x,y,12,12,(127,91,26)) fill_rect(x-1,y-1,12,12,(127,91,26)) fill_rect(x,y,10,10,(255,183,52)) def draw_my_money(): fill_rect(139,110,41,41,(255,)*3) for i in range(money): draw_money(140+randint(0,28),111+randint(0,28)) draw_string("{:^4}".format(str(money)),140,151,(255,183,52),(255,)*3) def draw_random_n(x,y): fill_rect(x+2,y+2,40,20,(255,)*3) t=0.1 while t<1: n=randint(0,36) draw_string(" {:>2} ".format(n),x+2,y+3,(0,)*3,(255,)*3) sleep(t) t*=1.3 fill_rect(x+2,y+2,40,20,(255,)*3) draw_string(" {:>2} ".format(n),x+2,y+3,(0,)*3,(255,)*3) return n def draw_n(x,y,focus=False): fill_rect(x,y,44,24,(255,)*3) if focus: fill_rect(x,y,44,24,(0,200,200)) else: fill_rect(x,y,44,24,(255,183,52)) draw_string(" {:>2} ".format(n),x+2,y+3,(0,)*3,(255,)*3) def draw_one_plaque(p_id): fill_rect([218,-5][(p_id%2)],76+(abs(p_id+1)//2)*48,102,50,[(100,)*3,(0,200,200)][focus==p_id]) fill_rect([221,0][(p_id%2)],79+(abs(p_id+1)//2)*48,[94,100][(p_id-1)%2],44,(0,0,140)) draw_string("{:^6}".format(["pair","impair","rouge","noir","manque","passe"][-1-p_id]),[20,240][(-p_id-1)%2],92+(abs(-1-p_id)//2)*48,(255,)*3,(0,0,140)) for p in range(mises[p_id]): draw_money([220,0][(p_id%2)]+randint(0,[95,100][(p_id-1)%2]-12),78+(abs(p_id+1)//2)*48+randint(0,34)) def draw_plaques(): for i in range(6): draw_one_plaque(-1-i) def draw_all(): fill_rect(95,76,125,146,(255,)*3) draw_plateau() draw_plaques() draw_my_money() draw_n(138,180,focus==0) draw_string([" + or - ","Press Ok"][focus==0],120,90,(255, 183, 52),(255,)*3) draw_all() draw_num(5) while money>0: while not(keydown(KEY_OK) and focus==0): ex_focus=focus if keydown(KEY_DOWN): focus=[0,2,3,-1,5,6,-1,8,9,-1,11,12,0,14,15,0,17,18,0,20,21,0,23,24,0,26,27,-2,29,30,-2,32,33,-2,35,36,-2,-6,-5,-6,-5,-4,-3][focus] elif keydown(KEY_UP): focus=[18,1,1,2,4,4,5,7,7,8,10,10,11,13,13,14,16,16,17,19,19,20,22,22,23,25,25,26,28,28,29,31,31,32,34,34,35,-4,-3,-2,-1,36,3][focus] elif keydown(KEY_RIGHT): focus=[-6,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,34,35,36,-6,0,-4,0,-2,0][focus] elif keydown(KEY_LEFT): focus=[-5,1,2,3,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,27,28,29,30,31,32,33,0,-5,0,-3,0,-1][focus] if ex_focus!=focus: if ex_focus==0 or focus==0: draw_string([" + or - ","Press Ok"][focus==0],120,90,(255, 183, 52),(255,)*3) if ex_focus<0: draw_one_plaque(ex_focus) if focus<0: draw_one_plaque(focus) if ex_focus>0: draw_num(ex_focus) if focus>0: draw_num(focus) if ex_focus==0 or focus==0: draw_n(138,180,focus==0) sleep(0.2) if (keydown(KEY_MINUS) or keydown(KEY_PLUS)) and focus!=0: if keydown(KEY_PLUS) and money>0: money+=-1 mises[focus]+=1 if keydown(KEY_MINUS) and mises[focus]>0: money+=1 mises[focus]+=-1 if focus>0: draw_num(focus) if focus<0: draw_one_plaque(focus) draw_my_money() sleep(0.1) n=draw_random_n(138,180) if n!=0: somme=36*mises[n] somme+=2*[mises[-1],mises[-2]][n%2] somme+=2*[mises[-4],mises[-3]][colors[n]] somme+=2*[mises[-5],mises[-6]][n>18] money+=somme mises=[0,]*43 draw_all() fill_rect(75,81,170,60,(192, 53, 53)) draw_string("Vous avez perdu !",75, 81,(255,)*3,(192,53,53)) draw_string(" C'est normal ",75,101,(255,)*3,(192,53,53)) draw_string(" dans un casino ",75,121,(255,)*3,(192,53,53))