def Calc_Roulette(self): parms = { "Parent": self, "Name": self.Name + "Roulette", "rc": "Curve_Roulette_Calc", "Name": "Roulette", "Type": "Curve_Roulette", "t1": self.t1, "t2": self.t2, "NPoints": self.NPoints, "nlaps": 1, "Roulette_A": self.Roulette_A, "Roulette_B": self.Roulette_B, "r0": [0, 0], "Print": 0, "Mesh_Last": True, "CalcGeo": True, "Point_Size": 3, "Reparametrization": False, "Evolute_Numerical": False, "Evolute_Anal": False, "Closed": False, } from Roulette import Roulette self.Roulette = Roulette(parms) self.Roulette.Parent = self self.Roulette.Calc(self.ts) self.Roulette.Category = "Roulette"
def __init__(self, master): self.__players = [] self.__budget = 1000 self.__vez = 0 self.__nroPassaVez = 0 self.__tipoJogo = str() self.__nroSorteado = int() self.__nroJogadores = int() self.__roulette = Roulette() self.widgets()
def main(): casino = Casino(100000) jeu1 = Roulette("my wheel", casino) jeu2 = MachineASous("bandit manchot", casino) joueur = Joueur("Clement", 1000) joueur.entrer_casino(casino) joueur.jouer()
class CrossController(): def __init__(self, bagsController): self.bagsController = bagsController self.roulette = Roulette(self.bagsController.bags, self.bagsController.bagParams.numOfBags) self.bagMixer = BagMixer(self.bagsController) def CrossBags(self): idxOfBagsForRepro = self.roulette.DrawBagsIdxForRepr() self.bagMixer.MixBags(idxOfBagsForRepro)
def choose_game(self, userInput): output = "" if userInput == "1": self.status = 1 lottery = [12, 24, 35, 55, 22] self.powerball = PowerBall(1000, lottery) output = self.powerball.start() elif userInput == "2": self.status = 2 self.roulette = Roulette() output = self.roulette.start() elif userInput == "3": self.status = 3 elif userInput == "4": self.status = 4 elif userInput == "5": self.status = 5 elif userInput == "6": self.status = 6 else: output = "Please enter a single digit of your choice." return output
class Homepage(): def __init__(self): self.status = 0 # the game's initial status is 0, 0 means the game is still on the homepage self.response = "" self.sign = False def getSign(self): return self.sign def setSign(self): self.sign = True def input(self, string): #if self.status === 0, choose Service if self.status == 0: if string >= "1" and string <= "6": self.response = self.choose_game(string) else: self.response = "Improper input." elif self.status == 1: self.response = self.powerball.input(string) if self.powerball.getquit() == True: self.status = 0 self.response = self.homepage() elif self.status == 2: self.response = self.roulette.input(string) if self.roulette.getquit() == True: self.status = 0 self.response = self.homepage() if self.roulette.getquit() == True: self.status = 0 self.response = self.homepage() else: self.response = "Error!!!" return self.response def welcome_narratives(self): response = "Welcome to the Golden Nugget Casino!\n" response = response + "WHERE FRIENDSHIP IS THE LARGEST JACKPOT!\n\n" response = response + "May we all be winners -> complete assignemnts, pass this course, get straight As, and an internship & job.\n" response = response + "Speaking of internships and jobs, we have an expert team here at Golden Nugget to assist with your career needs:\n" response = response + "-10 Bitpoints for resume review or cover letter review\n" response = response + "-100 bitpoints for writing your cover letter\n" response = response + "-250 bitpoints for internship/job referral\n\n" response = response + "Casino Services Menu:\n" response = response + "1. Powerball\n" response = response + "2. Roulette\n" response = response + "3. Deal or No Deal\n" response = response + "4. Career Assisstance # direct transfer with memo\n" response = response + "5. About Us\n" response = response + "6. Career with Golden Nugget Casino\n\n" response = response + "Note: You can choose the menu by enter a single digit that is corresponding to the menu." return response def homepage(self): response = "1. Powerball\n" response = response + "2. Roulette\n" response = response + "3. Deal or No Deal\n" response = response + "4. Career Assisstance # direct transfer with memo\n" response = response + "5. About Us\n" response = response + "6. Career with Golden Nugget Casino\n\n" response = response + "Note: You can choose the menu by enter a single digit that is corresponding to the menu." return response def choose_game(self, userInput): output = "" if userInput == "1": self.status = 1 lottery = [12, 24, 35, 55, 22] self.powerball = PowerBall(1000, lottery) output = self.powerball.start() elif userInput == "2": self.status = 2 self.roulette = Roulette() output = self.roulette.start() elif userInput == "3": self.status = 3 elif userInput == "4": self.status = 4 elif userInput == "5": self.status = 5 elif userInput == "6": self.status = 6 else: output = "Please enter a single digit of your choice." return output
population = np.random.randint(2, size=(N,L)) #random population generation for iteration in range(iterations): tries.append(iteration) #stroring number of iterations decoded_values = decode(population, x_1, x_2, l1, l2) #decoding values of x1 and x2 fitness_values = [] #calculating fitness values [fitness_values.append(fitness(decoded_values[0][i],decoded_values[0][i])) for i in range(N)] P = [f/sum(fitness_values) for f in fitness_values] #probability of selection cum_prob = np.cumsum(P).tolist() #cumulative probability n = round((N/2)*2*Pc) #number of individuals participating in crossover Parents = Roulette(population,P,N,n) #parents selection using Roulette selection Children = crossover(Parents,n) #Children from crossover Children_new = mutation(Children,Pm,L) #new chidren after mutation f_values = [] #calculating value of original function and storing [f_values.append((1.0/fitness_values[i])-1.0) for i in range(N)] min_values.append(min(f_values)) #storing minimum value of function for iteration population = Children_new #redefining parameters N = len(Children_new) print('Minimum value of function is ',min(min_values)) #printing result, i.e., minimum value of the function
def __init__(self, bagsController): self.bagsController = bagsController self.roulette = Roulette(self.bagsController.bags, self.bagsController.bagParams.numOfBags) self.bagMixer = BagMixer(self.bagsController)
class Curve(HTML, CGI, CS, Curve_Init, Curve_Calc, Curve_Parms, Curve_SVG, Curve_ArcLength, Curve_Draw, Curve_Colors, Curve_Connections, Curve_Print, Curve_Write, Curve_Samples, Curve_Oids): Type = "Curve" CSS_Class = "Curve" BasePath = "curves" Indent = " " Parent = None __Animation__ = None #Curve info will be printed, if self.Print set to >0 Print = 0 #Curve will be calculated, if self.CalcGeo set CalcGeo = False #Curve will be reparametrisized if self.Reparametrization set Reparametrization = False #Accompanying Coord System #Draw World/Accompanying Coordinate Systems WCS = False ACS = False #Draw osculating circle and/or vector. Osculating_Circle = False Osculating_Vector = False #Draw last mesh point Mesh_Last = False #Drawing color Color = "blue" Point_Size = 2 Last_Point_Size = 5 #Default resolution Resolution = [800, 800] #Global curve parameters a = 1.0 b = 1.0 c = 0.0 #Phasing parameter phi = 0.0 t1 = 0.0 t2 = 1.0 dt = 1.0 NPoints = 100 NFrames = 100 rc = "" ts = [] R = [] dR = [] d2R = [] T = [] N = [] #Curve (Arc) Lengths S = [] dS = [] Closed = False #Curve length. If defined will be used to calculate curve lengths. S_rc = "" Curve_Lengths = True Integration_Method = 1 #1: Trapezoids, 2: Simpson #Numerical Involute will be calculated, if set Involute_Numerical = False #Numeric Involute points Involute_R = None #Numerical Evolute will be calculated, if set Evolute_Numerical = False #Numeric Curvature centers Evolute_R = None #Do we have an Analytical Evolute? Evolute_Anal = False Evolute_Analytical = None Evolute_rc = "" Determinant = [] Kappa = [] Rho = [] Phi = [] #Generate Roulette Roulette = False Roulette_rc = "" Parent_rc = "" Roulette_Direction = 1.0 Roulette_A = 1.0 Roulette_B = 1.0 ##! ##! Creator. ##! def __init__(self, vals={}): self.Hash2Obj(vals) self.SetParms() self.Type = self.__class__.__name__ def __str__(self): return self.Name ##! ##! Sets eps parms. ##! def SetParms(self, vals={}): self.CS_SetParms(vals) self.R = Mesh(self.Name) ##! ##! Get n skew necessary for rolling circles to become right. ##! def Curve_Rolling_Skew(self): return 0 ##! ##! Returns color for named entity types. ##! def GetColor(self, type=""): animation = self.Animation() scheme = animation.BackGround_Color() if (type == ""): return scheme return self.Color_Schemes[scheme][type] ##! ##! Returns Animation object for controlling the process. ##! def Animation(self): global __Animation__ # Needed to modify global copy of __Animation__ if (not __Animation__): parms = { "Curve_Parms_Path": self.Curve_Parms_Path(), "Name": self.Type, "FileName": self.Type, "Resolution": self.Resolution, "pmin": self.Curve_Min(), "pmax": self.Curve_Max(), } __Animation__ = Animation(self.Curve_Min(), self.Curve_Max(), parms) __Animation__.Curve_Parms_Path = self.Curve_Parms_Path() __Animation__.Initialize() __Animation__.Resolution = self.Resolution return __Animation__ ##! ##! Returns Canvas object, stored in self.Animation ##! def Canvas(self): return self.Animation().Canvas() ##! ##! Applies command line options and arguments to Curve object. ##! def CLI_Apply(self): self.CLI2Obj() self.eps = float(self.eps) ##! ##! Generate roulette as a curve ##! def Calc_Roulette(self): parms = { "Parent": self, "Name": self.Name + "Roulette", "rc": "Curve_Roulette_Calc", "Name": "Roulette", "Type": "Curve_Roulette", "t1": self.t1, "t2": self.t2, "NPoints": self.NPoints, "nlaps": 1, "Roulette_A": self.Roulette_A, "Roulette_B": self.Roulette_B, "r0": [0, 0], "Print": 0, "Mesh_Last": True, "CalcGeo": True, "Point_Size": 3, "Reparametrization": False, "Evolute_Numerical": False, "Evolute_Anal": False, "Closed": False, } from Roulette import Roulette self.Roulette = Roulette(parms) self.Roulette.Parent = self self.Roulette.Calc(self.ts) self.Roulette.Category = "Roulette" ##! ##! Return analyutical evolute parameters ##! def Calc_Evolute_Analytical_Parms(self): return { "Parent": self, "rc": self.Evolute_rc, "Name": "Analytical_Evolute", "Type": self.Name + "_Analytical", "t1": self.t1, "t2": self.t2, "NPoints": self.NPoints, "nlaps": 1, "phi": self.phi, "a": self.a, "b": self.b, "r0": [0, 0], "Print": 0, "Mesh_Last": True, "Point_Size": 3, "CalcGeo": False, "Reparametrization": False, "Evolute_Anal": False, } ##! ##! Create analytical evolute as a curve object. ##! def Calc_Evolute_Analytical_Obj(self): return Curve(self.Calc_Evolute_Analytical_Parms()) ##! ##! Generate roulette as a curve ##! def Calc_Evolute_Analytical(self): self.Evolute_Analytical = self.Calc_Evolute_Analytical_Obj() self.Evolute_Analytical.Calc(self.ts) self.Evolute_Analytical.Parent = self self.Evolute_Analytical.Category = "Analytical_Evolute" self.Evolute_Analytical.R.Name = "Analytical_Evolute"
import sys sys.path.append('./libs') from Roulette import Roulette roulette=Roulette() myColours1="hyugu" roulette.choiseColor(myColours1) roulette.choiseColor(myColours1)
-Strategies: Object with the configurations and definitions of all strategies we use -Graphing: File with common Plotting functions and the complete saving route ''' from Roulette import Roulette from Strategies import Strategies from graphing import letsGraph import matplotlib.pyplot as plt # Global Configs save = {"mode": True, "route": "graphs/" } # If mode is False, the graph won't be sabed # Main if __name__ == '__main__': roulette = Roulette() opt = -1 while (opt != 0): # Menu print('ROULETTE SIMULATOR') print('Welcome. Do you want to play?') print() inputMsg = 'Please choose a strategy: (number from 1 to 8)\n' inputMsg += '1: Bet to a single number\n2: Bet to a color\n3: Bet AS Sofovich\n4: Bet Martingale (Classic and Modified)\n' inputMsg += '5: Bet D\'Alambert\n6: Bet Fibonacci (Bet fixed to 1)\n7: Bet AS SantE (Original Strategy)\n8: Don\'t Play \n\n0: Exit Game\n' while(opt not in [0, 1, 2, 3, 4, 5, 6, 7, 8]): opt = int(float(input(inputMsg))) print() # Exit Game if (opt == 0):
def __init__(self, currency='$'): self.__currency = currency self.__roulette = Roulette(50) self.__player = Player()
class ZCasino: def __init__(self, currency='$'): self.__currency = currency self.__roulette = Roulette(50) self.__player = Player() def get_currency(self): return self.__currency def set_currency(self, value): self.__currency = value def del_currency(self): del self.__currency currency = property(get_currency, set_currency, del_currency, 'The currency used by ZCasino') def __welcome_player(self): self.__player.name = input('Welcome my dear player. May I know your name, please? ') self.__player.budget = int(input('How much money do you have? ')) def __next_round(self): bet = -1 while (bet < 0 or bet > self.__player.budget): try: bet = int(input( 'How much money do you want to place as bet? (Enter 0 to quit the game) (Your budget is %d) ' % self.__player.budget)) except ValueError: print('You did not type a number. Please try again') bet = -1 continue if (bet < 0): print('You cannot place a negative money amount. Please try again.') if (bet > self.__player.budget): print('You do not have enough money. Please try again.') bet = self.__player.take_from_budget(bet) if (bet > 0): player_number = -1 while (player_number < 0 or player_number >= self.__roulette.max_number): try: player_number = int( input('What is the number you want to bet? (from 0 to %d) ' % (self.__roulette.max_number - 1))) except ValueError: print('You didn\'t type a number. Please try again') player_number = -1 continue if (player_number < 0): print('You cannot bet a negative number. Please try again.') if (player_number >= self.__roulette.max_number): print('This number is too big for the roulette. Please try again.') value = self.__roulette.next_number() winning_amount = 0 if (value == player_number): winning_amount = bet * 4 print('You chose the exact number. You gained', winning_amount, self.__currency) elif (value % 2 == player_number % 2): winning_amount = math.ceil(bet * 1.5) print('Your number and roulette number have the same color. You gained', winning_amount, self.__currency) else: print('Sorry. You gained nothing. Please try again.') self.__player.add_to_budget(winning_amount) return True else: print('You chose to quit the game. Thank you and see you again.') return False def start(self): self.__welcome_player() while (self.__next_round()): pass return
class ZCasino: def __init__(self, currency='$'): self.__currency = currency self.__roulette = Roulette(50) self.__player = Player() def get_currency(self): return self.__currency def set_currency(self, value): self.__currency = value def del_currency(self): del self.__currency currency = property(get_currency, set_currency, del_currency, 'The currency used by ZCasino') def __welcome_player(self): self.__player.name = input( 'Welcome my dear player. May I know your name, please? ') self.__player.budget = int(input('How much money do you have? ')) def __next_round(self): bet = -1 while (bet < 0 or bet > self.__player.budget): try: bet = int( input( 'How much money do you want to place as bet? (Enter 0 to quit the game) (Your budget is %d) ' % self.__player.budget)) except ValueError: print('You did not type a number. Please try again') bet = -1 continue if (bet < 0): print( 'You cannot place a negative money amount. Please try again.' ) if (bet > self.__player.budget): print('You do not have enough money. Please try again.') bet = self.__player.take_from_budget(bet) if (bet > 0): player_number = -1 while (player_number < 0 or player_number >= self.__roulette.max_number): try: player_number = int( input( 'What is the number you want to bet? (from 0 to %d) ' % (self.__roulette.max_number - 1))) except ValueError: print('You didn\'t type a number. Please try again') player_number = -1 continue if (player_number < 0): print( 'You cannot bet a negative number. Please try again.') if (player_number >= self.__roulette.max_number): print( 'This number is too big for the roulette. Please try again.' ) value = self.__roulette.next_number() winning_amount = 0 if (value == player_number): winning_amount = bet * 4 print('You chose the exact number. You gained', winning_amount, self.__currency) elif (value % 2 == player_number % 2): winning_amount = math.ceil(bet * 1.5) print( 'Your number and roulette number have the same color. You gained', winning_amount, self.__currency) else: print('Sorry. You gained nothing. Please try again.') self.__player.add_to_budget(winning_amount) return True else: print('You chose to quit the game. Thank you and see you again.') return False def start(self): self.__welcome_player() while (self.__next_round()): pass return
from Casino import Casino from Joueur import Joueur from MachineASous import MachineASous from Roulette import Roulette casino = Casino(100000) jeu1 = Roulette("my wheel", casino) jeu2 = MachineASous("bandit manchot", casino) joueur = Joueur("Clement", 1000) joueur.entrer_casino(casino) joueur.jouer()
class Cassino: def __init__(self, master): self.__players = [] self.__budget = 1000 self.__vez = 0 self.__nroPassaVez = 0 self.__tipoJogo = str() self.__nroSorteado = int() self.__nroJogadores = int() self.__roulette = Roulette() self.widgets() def widgets(self): # Tipo de jogo self.__root = root.geometry("800x600+200+200") self.__b1 = tk.Button(root, text="AMERICANO", width=8, height=2, command=lambda:self.setTipoJogo("AMERICANO")) self.__b1.place(x=100,y=200) self.__b2 = tk.Button(root, text="EUROPEU", width=8, height=2, command=lambda:self.setTipoJogo("EUROPEU")) self.__b2.place(x=100,y=250) self.__b3 = tk.Button(root, text="FRANCÊS", width=8, height=2, command=lambda:self.setTipoJogo("FRANCES")) self.__b3.place(x=100,y=300) self.__lb1 = tk.Label(root) self.__lb1.configure(text="{}".format(self.getTipoJogo()), width=13, height=1, font="Times 25 bold", fg="black", bg="red") self.__lb1.place(x=200,y=250) # Budget cassino (no método de pagamento colocar isso tbm pra atualizar) self.__lb2 = tk.Label(root) self.__lb2.configure(text="{}".format(self.__budget), width=7, height=1, font="Times 25 bold", fg="black", bg="red") self.__lb2.place(x=630,y=5) # Iniciar o jogo, sair do hub principal e ir pro game self.__b4 = tk.Button(root, text="INICIAR", width=8, height=2,command=lambda: self.changeWindow()) self.__b4.place(x=650,y=550) # Nro de jogadores self.__b5 = tk.Button(root, text="1", width=3, height=2,command=lambda: self.setNroJogadores(1)) self.__b5.place(x=430,y=250) self.__b5 = tk.Button(root, text="2", width=3, height=2,command=lambda: self.setNroJogadores(2)) self.__b5.place(x=430,y=300) self.__lb3 = tk.Label(root) self.__lb3.configure(text="{}".format(self.getNrojogadores()), width=7, height=1, font="Times 25 bold", fg="black", bg="red") self.__lb3.place(x=530,y=250) def changeWindow(self): if self.__tipoJogo == 'EUROPEU': self.europeu() elif self.__tipoJogo == 'FRANCES': self.frances() elif self.__tipoJogo == 'AMERICANO': self.americano() def setTipoJogo(self,tipo): self.__tipoJogo = tipo self.__roulette.setType_Roulette(tipo) self.__lb1.configure(text="{}".format(self.getTipoJogo()), width=13, height=1, font="Times 25 bold", fg="black", bg="red") self.__lb1.place(x=200,y=250) def getTipoJogo(self): return self.__tipoJogo def setNroJogadores(self,nro): self.__nroJogadores = nro self.__lb3.configure(text="{}".format(self.getNrojogadores()), width=7, height=1, font="Times 25 bold", fg="black", bg="red") self.__lb3.place(x=530,y=250) def getNrojogadores(self): return self.__nroJogadores def criarPlayers(self): a = self.__nroJogadores name_players = ["Leonardo","Carol"] for i in range(0, a): name_players[i] = Player(name_players[i]) b = name_players[i] self.__players.append(b) def ignorar(self): pass def botoesAposta(self): lista1 = [3,6,9,12,15,18,21,24,27,30,33,36] lista2 = [2,5,8,11,14,17,20,23,26,29,32,35] lista3 = [1,4,7,10,13,16,19,22,25,28,31,34] if self.__tipoJogo == "AMERICANO": self.__b7 = tk.Button(root, text="00", width=1, height=1,command=lambda: self.apostarNro('00')) self.__b7.place(x=32,y=350) self.__b7 = tk.Button(root, text="00,0,1,2,3", width=6, height=1,command=lambda:self.apostaExterna(13)) self.__b7.place(x=0,y=400) else: self.__b7 = tk.Button(root, text="00", width=1, height=1,command=lambda:self.ignorar()) self.__b7.place(x=32,y=350) self.__b7 = tk.Button(root, text="00,0,1,2,3", width=6, height=1,command=lambda:self.ignorar()) self.__b7.place(x=0,y=400) self.__b7 = tk.Button(root, text="LIMPAR", width=5, height=1,command=lambda:self.limparApostas()) self.__b7.place(x=550,y=550) self.__b7 = tk.Button(root, text="0", width=1, height=1,command=lambda:self.apostarNro(0)) self.__b7.place(x=32,y=452) self.__b7 = tk.Button(root, text="1", width=1, height=1,command=lambda:self.apostarNro(1)) self.__b7.place(x=73,y=460) self.__b7 = tk.Button(root, text="2", width=1, height=1,command=lambda:self.apostarNro(2)) self.__b7.place(x=73,y=400) self.__b7 = tk.Button(root, text="3", width=1, height=1,command=lambda:self.apostarNro(3)) self.__b7.place(x=73,y=340) self.__b7 = tk.Button(root, text="4", width=1, height=1,command=lambda:self.apostarNro(4)) self.__b7.place(x=112,y=460) self.__b7 = tk.Button(root, text="5", width=1, height=1,command=lambda:self.apostarNro(5)) self.__b7.place(x=112,y=400) self.__b7 = tk.Button(root, text="6", width=1, height=1,command=lambda:self.apostarNro(6)) self.__b7.place(x=112,y=340) self.__b7 = tk.Button(root, text="7", width=1, height=1,command=lambda:self.apostarNro(7)) self.__b7.place(x=151,y=460) self.__b7 = tk.Button(root, text="8", width=1, height=1,command=lambda:self.apostarNro(8)) self.__b7.place(x=151,y=400) self.__b7 = tk.Button(root, text="9", width=1, height=1,command=lambda:self.apostarNro(9)) self.__b7.place(x=151,y=340) self.__b7 = tk.Button(root, text="10", width=1, height=1,command=lambda:self.apostarNro(10)) self.__b7.place(x=190,y=460) self.__b7 = tk.Button(root, text="11", width=1, height=1,command=lambda:self.apostarNro(11)) self.__b7.place(x=190,y=400) self.__b7 = tk.Button(root, text="12", width=1, height=1,command=lambda:self.apostarNro(12)) self.__b7.place(x=190,y=340) self.__b7 = tk.Button(root, text="13", width=1, height=1,command=lambda:self.apostarNro(13)) self.__b7.place(x=230,y=460) self.__b7 = tk.Button(root, text="14", width=1, height=1,command=lambda:self.apostarNro(14)) self.__b7.place(x=230,y=400) self.__b7 = tk.Button(root, text="15", width=1, height=1,command=lambda:self.apostarNro(15)) self.__b7.place(x=230,y=340) self.__b7 = tk.Button(root, text="16", width=1, height=1,command=lambda:self.apostarNro(16)) self.__b7.place(x=270,y=460) self.__b7 = tk.Button(root, text="17", width=1, height=1,command=lambda:self.apostarNro(17)) self.__b7.place(x=270,y=400) self.__b7 = tk.Button(root, text="18", width=1, height=1,command=lambda:self.apostarNro(18)) self.__b7.place(x=270,y=340) self.__b7 = tk.Button(root, text="19", width=1, height=1,command=lambda:self.apostarNro(19)) self.__b7.place(x=310,y=460) self.__b7 = tk.Button(root, text="20", width=1, height=1,command=lambda:self.apostarNro(20)) self.__b7.place(x=310,y=400) self.__b7 = tk.Button(root, text="21", width=1, height=1,command=lambda:self.apostarNro(21)) self.__b7.place(x=310,y=340) self.__b7 = tk.Button(root, text="22", width=1, height=1,command=lambda:self.apostarNro(22)) self.__b7.place(x=350,y=460) self.__b7 = tk.Button(root, text="23", width=1, height=1,command=lambda:self.apostarNro(23)) self.__b7.place(x=350,y=400) self.__b7 = tk.Button(root, text="24", width=1, height=1,command=lambda:self.apostarNro(24)) self.__b7.place(x=350,y=340) self.__b7 = tk.Button(root, text="25", width=1, height=1,command=lambda:self.apostarNro(25)) self.__b7.place(x=390,y=460) self.__b7 = tk.Button(root, text="26", width=1, height=1,command=lambda:self.apostarNro(26)) self.__b7.place(x=390,y=400) self.__b7 = tk.Button(root, text="27", width=1, height=1,command=lambda:self.apostarNro(27)) self.__b7.place(x=390,y=340) self.__b7 = tk.Button(root, text="28", width=1, height=1,command=lambda:self.apostarNro(28)) self.__b7.place(x=430,y=460) self.__b7 = tk.Button(root, text="29", width=1, height=1,command=lambda:self.apostarNro(29)) self.__b7.place(x=430,y=400) self.__b7 = tk.Button(root, text="30", width=1, height=1,command=lambda:self.apostarNro(30)) self.__b7.place(x=430,y=340) self.__b7 = tk.Button(root, text="31", width=1, height=1,command=lambda:self.apostarNro(31)) self.__b7.place(x=470,y=460) self.__b7 = tk.Button(root, text="32", width=1, height=1,command=lambda:self.apostarNro(32)) self.__b7.place(x=470,y=400) self.__b7 = tk.Button(root, text="33", width=1, height=1,command=lambda:self.apostarNro(33)) self.__b7.place(x=470,y=340) self.__b7 = tk.Button(root, text="34", width=1, height=1,command=lambda:self.apostarNro(34)) self.__b7.place(x=510,y=460) self.__b7 = tk.Button(root, text="35", width=1, height=1,command=lambda:self.apostarNro(35)) self.__b7.place(x=510,y=400) self.__b7 = tk.Button(root, text="36", width=1, height=1,command=lambda:self.apostarNro(36)) self.__b7.place(x=510,y=340) # Aposta externa self.__b7 = tk.Button(root, text="2 for 1", width=5, height=1,command=lambda:self.apostaExterna(1)) self.__b7.place(x=600,y=340) self.__b7 = tk.Button(root, text="2 for 1", width=5, height=1,command=lambda:self.apostaExterna(2)) self.__b7.place(x=600,y=400) self.__b7 = tk.Button(root, text="2 for 1", width=5, height=1,command=lambda:self.apostaExterna(3)) self.__b7.place(x=600,y=460) self.__b7 = tk.Button(root, text="1st to 12", width=15, height=1,command=lambda:self.apostaExterna(4)) self.__b7.place(x=75,y=511) self.__b7 = tk.Button(root, text="2hd to 12", width=15, height=1,command=lambda:self.apostaExterna(5)) self.__b7.place(x=233,y=511) self.__b7 = tk.Button(root, text="3rd to 12", width=15, height=1,command=lambda:self.apostaExterna(6)) self.__b7.place(x=389,y=511) self.__b7 = tk.Button(root, text="1-18", width=5, height=1,command=lambda:self.apostaExterna(7)) self.__b7.place(x=76,y=550) self.__b7 = tk.Button(root, text="19-36", width=5, height=1,command=lambda:self.apostaExterna(8)) self.__b7.place(x=469,y=550) self.__b7 = tk.Button(root, text="EVEN", width=5, height=1,command=lambda:self.apostaExterna(9)) self.__b7.place(x=156,y=550) self.__b7 = tk.Button(root, text="ODD", width=5, height=1,command=lambda:self.apostaExterna(10)) self.__b7.place(x=389,y=550) self.__b7 = tk.Button(root, text="", width=5, height=1,bg="red",command=lambda:self.apostaExterna(11)) self.__b7.place(x=234,y=550) self.__b7 = tk.Button(root, text="", width=5, height=1,bg="black",command=lambda:self.apostaExterna(12)) self.__b7.place(x=314,y=550) def botoesValor(self): self.__b8 = tk.Button(root, text="1", width=2, height=1,command=lambda:self.apostarValor(1)) self.__b8.place(x=32,y=200) self.__b8 = tk.Button(root, text="5", width=2, height=1,command=lambda:self.apostarValor(5)) self.__b8.place(x=90,y=200) self.__b8 = tk.Button(root, text="10", width=2, height=1,command=lambda:self.apostarValor(10)) self.__b8.place(x=148,y=200) self.__b8 = tk.Button(root, text="25", width=2, height=1,command=lambda:self.apostarValor(25)) self.__b8.place(x=206,y=200) self.__b8 = tk.Button(root, text="100", width=2, height=1,command=lambda:self.apostarValor(100)) self.__b8.place(x=264,y=200) def europeu(self): # atualizar o fundo para inserir novos botões if self.getNrojogadores() != 0: self.photo = PhotoImage(file="images/european3.gif") self.blacklabel = Label(root,image=self.photo).place(x=-1,y=-1) # carregar budget cassino self.__lb4 = tk.Label(root) self.__lb4.configure(text="{}".format(self.__budget), width=7, height=1, font="Times 25 bold", fg="black", bg="red") self.__lb4.place(x=630,y=5) # label do numero sorteado self.__lb7 = tk.Label(root) self.__lb7.configure(text="AGUARDE", width=20, height=1, font="Times 12 bold", fg="black", bg="red") self.__lb7.place(x=320,y=50) # botões para fazer aposta dos números self.botoesAposta() # botões para fazer aposta do dinheiro self.botoesValor() # carregamento de funções self.criarPlayers() self.confirmarAposta() self.loadGetCarteiraPlayer() self.loadNomePlayers() def americano(self): # atualizar o fundo para inserir novos botões if self.getTipoJogo() == "AMERICANO" and self.getNrojogadores() != 0: self.photo = PhotoImage(file="images/european3.gif") self.blacklabel = Label(root,image=self.photo).place(x=-1,y=-1) # carregar budget cassino self.__lb4 = tk.Label(root) self.__lb4.configure(text="{}".format(self.__budget), width=7, height=1, font="Times 25 bold", fg="black", bg="red") self.__lb4.place(x=630,y=5) # label do numero sorteado self.__lb7 = tk.Label(root) self.__lb7.configure(text="AGUARDE", width=20, height=1, font="Times 12 bold", fg="black", bg="red") self.__lb7.place(x=320,y=50) # botões para fazer aposta dos números self.botoesAposta() # botões para fazer aposta do dinheiro self.botoesValor() # carregamento de funções self.criarPlayers() self.confirmarAposta() self.loadGetCarteiraPlayer() self.loadNomePlayers() def frances(self): # atualizar o fundo para inserir novos botões if self.getTipoJogo() == "FRANCES" and self.getNrojogadores() != 0: self.photo = PhotoImage(file="images/european3.gif") self.blacklabel = Label(root,image=self.photo).place(x=-1,y=-1) # carregar budget cassino self.__lb4 = tk.Label(root) self.__lb4.configure(text="{}".format(self.__budget), width=7, height=1, font="Times 25 bold", fg="black", bg="red") self.__lb4.place(x=630,y=5) # label do numero sorteado self.__lb7 = tk.Label(root) self.__lb7.configure(text="AGUARDE", width=20, height=1, font="Times 12 bold", fg="black", bg="red") self.__lb7.place(x=320,y=50) # botões para fazer aposta dos números self.botoesAposta() # botões para fazer aposta do dinheiro self.botoesValor() # carregamento de funções self.criarPlayers() self.confirmarAposta() self.loadGetCarteiraPlayer() self.loadNomePlayers() def apostarValor(self,x): self.__players[self.__vez].clearNroPassaVez() self.__b5.configure(state="normal") self.__players[self.__vez].setDinheiroCarteira(-x) self.__players[self.__vez].setValorAposta_Player(x) # self.__players[self.__vez] carteira = (self.__players[self.__vez].getCarteira_Player()) self.__lb5.configure(text="{}".format(carteira), width=7, height=1, font="Times 25 bold", fg="black", bg="red") def apostarNro(self,x): if x not in self.__players[self.__vez].getNumerosAposta(): self.__players[self.__vez].setNumerosAposta(x) elif x in self.__players[self.__vez].getNumerosAposta(): print("o número já foi apostado") print(self.__players[self.__vez].getNumerosAposta()) def apostaExterna(self,x): if x == 1: self.__players[self.__vez].setNumerosAposta("2for1 1") if x == 2: self.__players[self.__vez].setNumerosAposta("2for1 2") if x == 3: self.__players[self.__vez].setNumerosAposta("2for1 3") if x == 4: self.__players[self.__vez].setNumerosAposta("1st12") if x == 5: self.__players[self.__vez].setNumerosAposta("2hd12") if x == 6: self.__players[self.__vez].setNumerosAposta("3rd12") if x == 7: self.__players[self.__vez].setNumerosAposta("1-18") if x == 8: self.__players[self.__vez].setNumerosAposta("19-36") if x == 9: self.__players[self.__vez].setNumerosAposta("even") if x == 10: self.__players[self.__vez].setNumerosAposta("odd") if x == 11: self.__players[self.__vez].setNumerosAposta("red") if x == 12: self.__players[self.__vez].setNumerosAposta("black") if x == 13: self.__players[self.__vez].setNumerosAposta("especial") print(self.__players[self.__vez].getNumerosAposta()) def loadGetCarteiraPlayer(self): carteira = (self.__players[self.__vez].getCarteira_Player()) self.__lb5 = tk.Label(root) self.__lb5.configure(text="{}".format(carteira), width=7, height=1, font="Times 25 bold", fg="black", bg="red") self.__lb5.place(x=630,y=50) def loadNomePlayers(self): nome = (self.__players[self.__vez].getNome_Player()) self.__lb6 = tk.Label(root) self.__lb6.configure(text="{}".format(nome), width=10, height=1, font="Times 25 bold", fg="black", bg="red") self.__lb6.place(x=50,y=50) def confirmarAposta(self): self.__b5 = tk.Button(root, text="APOSTAR", width=5, height=1,command=lambda: self.addVez()) self.__b5.place(x=650,y=550) def addVez(self): self.__vez += 1 if self.__vez == len(self.__players): self.__vez = 0 self.__nroSorteado = self.__roulette.getResult_Roulette() self.payment() self.retiraPlayer() self.limparApostas() self.mostrarNroSorteadoAnterior() if self.__budget < 0 or len(self.__players) <= 0: self.endGame() self.passaVez() self.atualizarValores() def mostrarNroSorteadoAnterior(self): self.__lb7.configure(text="{}".format(self.__nroSorteado), width=20, height=1, font="Times 12 bold", fg="black", bg="red") def passaVez(self): # se eu não apertar nenhum botão de aposta, então passavez += 1 self.__players[self.__vez].setNroPassaVez(1) if self.__players[self.__vez].getNroPassaVez() == 3: self.__b5.configure(state="disabled") def endGame(self): self.photo = PhotoImage(file="images/black.gif") self.blacklabel = Label(root,image=self.photo).place(x=-1,y=-1) self.__lb9 = tk.Label(root) self.__lb9.configure(text="FIM DE JOGO! FECHE PARA VOLTAR", width=50, height=2, font="Times 15 bold", fg="black", bg="red") self.__lb9.place(x=150,y=250) def girarRoleta(self): pass def payment(self): lista1 = [3,6,9,12,15,18,21,24,27,30,33,36] lista2 = [2,5,8,11,14,17,20,23,26,29,32,35] lista3 = [1,4,7,10,13,16,19,22,25,28,32,34] firstTwelve = [1,2,3,4,5,6,7,8,9,10,11,12] secondTwelve = [13,14,15,16,17,18,19,20,21,22,23,24] thirdTwelve = [25,26,27,28,29,30,31,32,33,34,35,36] oneToEighteen = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18] nineteenToThirdSix = [19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36] even = [2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36] odd = [1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35] red = [1,3,5,7,9,12,14,16,18,19,21,23,25,27,30,32,34,36] black = [2,4,6,8,10,11,13,15,17,20,22,24,26,28,29,31,33,35] especial = ['00',0,1,2,3] for player in self.__players: interna = [] externa = [] lenNrosAposta = len(player.getNumerosAposta()) for n in player.getNumerosAposta(): if type(n) == int: interna.append(n) else: externa.append(n) # apostas internas if self.__nroSorteado in interna and len(interna) == 1: player.setDinheiroCarteira(player.getValorAposta_Player() * 36) self.__budget -= (player.getValorAposta_Player() * 36) if self.__nroSorteado in interna and len(interna) == 2: player.setDinheiroCarteira(player.getValorAposta_Player() * 18) self.__budget -= (player.getValorAposta_Player() * 18) if self.__nroSorteado in interna and len(interna) == 3: player.setDinheiroCarteira(player.getValorAposta_Player() * 12) self.__budget -= (player.getValorAposta_Player() * 12) if self.__nroSorteado in interna and len(interna) == 4: player.setDinheiroCarteira(player.getValorAposta_Player() * 9) self.__budget -= (player.getValorAposta_Player() * 9) if self.__nroSorteado in interna and len(interna) == 5: player.setDinheiroCarteira(player.getValorAposta_Player() * 7) self.__budget -= (player.getValorAposta_Player() * 7) if self.__nroSorteado in interna and len(interna) == 6: player.setDinheiroCarteira(player.getValorAposta_Player() * 6) self.__budget -= (player.getValorAposta_Player() * 6) if self.__tipoJogo == "FRANCES" and self.__nroSorteado == 0 and 0 not in player.getNumerosAposta(): self.__budget += (player.getValorAposta_Player() / 2) player.setDinheiroCarteira(player.getValorAposta_Player() / 2) # apostas externas: if (self.__nroSorteado in lista1 and "2for1 1" in player.getNumerosAposta()) or (self.__nroSorteado in lista2 and "2for1 2" in player.getNumerosAposta()) or (self.__nroSorteado in lista3 and "2for1 3" in player.getNumerosAposta()): player.setDinheiroCarteira(player.getValorAposta_Player() * 3) self.__budget -= (player.getValorAposta_Player() * 3) if (self.__nroSorteado in firstTwelve and "1st12" in player.getNumerosAposta()) or (self.__nroSorteado in secondTwelve and "2hd12" in player.getNumerosAposta()) or (self.__nroSorteado in thirdTwelve and "3rd12" in player.getNumerosAposta()): player.setDinheiroCarteira(player.getValorAposta_Player() * 3) self.__budget -= (player.getValorAposta_Player() * 3) if (self.__nroSorteado in oneToEighteen and "1-18" in player.getNumerosAposta()) or (self.__nroSorteado in nineteenToThirdSix and "19-36" in player.getNumerosAposta()): player.setDinheiroCarteira(player.getValorAposta_Player() * 2) self.__budget -= (player.getValorAposta_Player() * 2) if (self.__nroSorteado in even and "even" in player.getNumerosAposta()) or (self.__nroSorteado in odd and "odd" in player.getNumerosAposta()): player.setDinheiroCarteira(player.getValorAposta_Player() * 2) self.__budget -= (player.getValorAposta_Player() * 2) if (self.__nroSorteado in red and "red" in player.getNumerosAposta()) or (self.__nroSorteado in black and "black" in player.getNumerosAposta()): player.setDinheiroCarteira(player.getValorAposta_Player() * 2) self.__budget -= (player.getValorAposta_Player() * 2) if (self.__nroSorteado in especial and "especial" in player.getNumerosAposta()): player.setDinheiroCarteira(player.getValorAposta_Player() * 7) self.__budget -= (player.getValorAposta_Player() * 7) else: self.__budget += player.getValorAposta_Player() def retiraPlayer(self): for player in self.__players: if player.getCarteira_Player() <= 0: self.__players.remove(player) def limparApostas(self): for players in self.__players: players.limparApostas() def atualizarValores(self): # atualização do nome do jogador da vez self.__lb6.configure(text="{}".format(self.__players[self.__vez].getNome_Player()), width=7, height=1, font="Times 25 bold", fg="black", bg="red") # atualização da carteira do jogador da vez self.__lb5.configure(text="{}".format(self.__players[self.__vez].getCarteira_Player()), width=7, height=1, font="Times 25 bold", fg="black", bg="red") # atualização do budget do cassino após as apostas self.__lb4.configure(text="{}".format(self.__budget), width=7, height=1, font="Times 25 bold", fg="black", bg="red") # mostrar numero sorteado dps das apostas self.__lb7.configure(text="{}".format(self.__nroSorteado), width=20, height=1, font="Times 12 bold", fg="black", bg="red")