import random import sys import pandas as pd import math import csv global n,spin,stake, total_stake, win, all_dict,cost,alls,profit,nn,ddf nn=0 total_stake=[] alls=[] nms=[] nos_list=[0,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,34,35,36] #bet_list=[0.25,0.25,0.25,0.25,0.33,0.33,0.33,0.5,0.5,1,2] bet_list=[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,0,0,0,0,0,0,0,0,0,0,0] all_dict=dict(zip(nos_list,bet_list)) #cost=sum(all_dict.values()) #print(cost) #f = open('ted.csv', 'a') def print_csv(): f = open('ted.csv','a') writer = csv.writer(f) writer.writerow(nms) f.close() def winner(spin): print("Win",36*all_dict[spin]) profit=36*all_dict[spin]-sum(alls) print("Profit",profit) if profit>20: nms.append(profit) #f = open('answers.csv', 'a') nms.append(profit) f = open('ted.csv', 'a',encoding='utf8') writer = csv.writer(f) print_csv() #writer.writerow(nms) sys.exit() else: gg=sum(all_dict.values()) all_dict[spin]=all_dict[spin]+nn gg=sum(all_dict.values()) print(all_dict,"Total Next Stake",gg) # ff={37:200}###################### # all_dict.update(ff)################# maximum = max(all_dict, key=all_dict.get) # Just use 'min' instead of 'max' for minimum. #print(maximum, all_dict[maximum]) dtd=all_dict[maximum] #print(dtd*36,profit) if profit<-10000: #print("trsesseerrrrrrrrrrrrrrrrrr") print("Loss=",profit) nms.append(profit) print_csv() #writer.writerow(nms) print("Stop Loss") sys.exit() alls.clear() alls.append(-profit) for xx in range(200): spin=random.randint(0, 36) print(spin) gg=sum(all_dict.values()) alls.append(gg) print("Accumulated Cost",sum(alls)) #print(spin) if spin>0 and spin<37: nn=nn+1 if nn ==2: nn==1 winner(spin) print("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++") # df = pd.DataFrame(dict) # # saving the dataframe # df.to_csv('file1.csv')