import random import sys import pandas as pd import math import printout 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,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,0.1,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('answers.csv', 'a') def winner(spin): print("Win",36*all_dict[spin]) profit=36*all_dict[spin]-sum(alls) print("Profit",profit) if profit>100: nms.append(profit) #f = open('answers.csv', 'a') nms.append(profit) f = open('1yyyy.csv', 'a') writer = csv.writer(f) writer.writerow(nms) f.close() sys.exit() else: gg=sum(all_dict.values()) all_dict[spin]=all_dict[spin]+nn gg=sum(all_dict.values()) print(all_dict,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<-50: #print("trsesseerrrrrrrrrrrrrrrrrr") print("Loss=",profit) nms.append(profit) f = open('***.csv', 'a') writer = csv.writer(f) writer.writerow(nms) f.close() 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("Cost",sum(alls)) #print(spin) if spin>0 and spin<13: nn=nn+0.1 winner(spin) print("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++") # df = pd.DataFrame(dict) # # saving the dataframe # df.to_csv('file1.csv')