首页 >> 大全

python百行代码编码摇骰子模拟器(告诫网du)

2023-12-27 大全 34 作者:考证青年

有话说

该摇骰子项目起初只是想演示一下所谓的倍压法是否有效,实际测试中也发现如果运气够好的话倍押法是一种比较好的回本方式,但是前提是你有足够的本,如果运气一直差的话最后也会输的啥都不剩,而这一切的前提是你所谓的赌都是处于正常模式下,就是每个概率都是公平的。但是如果du的平台做了一点手脚,那么,别说倍压法回本,倾家荡产只是一瞬间的事。

所以,别相信所谓的网du,里面的水不知道有多深,而我只是尝试了一些小东西,往往搞这些du平台的多多少少熟知一些人的正常心理,比如先给你点甜头,后面再慢慢宰。

本来打算用此做一次大数据实验这个所谓的倍押法的,但是由于上班基本没多少时间,周末又不想动,所以当编码完成后做了一两次实验我就没动过了,结果显而易见,最好的回本方法就是碰都不要碰这些所谓的网du,就算上头了一次了,及时悬崖勒马,及时止损是最好的办法。

整体逻辑 初始金币获得押注扣除押注随机出现点数,大:小于9点,小:大于9点根据押注获得比例,压中大小:2倍。顺子:3倍,豹子:6倍。上帝模式:这个是我临时想起来的,做一点手脚后,根本没赢的可能,最好的押注就是平手,而逻辑就是简单的判断你的押注,反向给你出点数,使得你的押注是不可能盈利的。 整体界面演示

上帝模式(不可能赢)

整体代码

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2020/12/17 20:02
# @Author  : Cxk
# @File    : 摇塞子模拟.py
# @文件下载地址 http://www.cxkboke.top/phone_win_file/%E6%91%87%E9%AA%B0%E5%AD%90%E6%A8%A1%E6%8B%9F.zipimport tkinter
from PIL import Image, ImageTk
import random,time 
import tkinter.messageboxdef new_game():global v,run_now,chiose,gold,chiose_once,is_god,old_goldold_gold=goldrun_now = Falseis_god=Falsechiose_once=Falsechiose={"BIG":0,"SMORT":0,"SHUN":0,"BAO":0}# 添加按钮所实现的功能
def run(count):try:global v,run_now,chiose,gold,chiose_once,is_god,old_goldif run_now:returnis_run = Trueif not chiose_once:now_gold=gold-t1.get()-t2.get()-t3.get()-t4.get()if now_gold<0:tkinter.messagebox.showinfo(title = '提示',message='金币不够下注')returnif CheckVar1.get()==0 and CheckVar2.get()==0 and CheckVar3.get()==0 and CheckVar4.get()==0 or t1.get()==0 and t2.get()==0 and t3.get()==0 and t4.get()==0:tkinter.messagebox.showinfo(title = '提示',message='未进行下注')returnelse:if CheckVar1.get()==1:gold-=t1.get()chiose['BIG']=t1.get()v.set('%s'%str(gold))if CheckVar2.get()==1:gold-=t2.get()chiose['SMORT']=t2.get()v.set('%s'%str(gold))if CheckVar3.get()==1:gold-=t3.get()chiose['SHUN']=t3.get()v.set('%s'%str(gold))if CheckVar4.get()==1:gold-=t4.get()chiose['BAO']=t4.get()v.set('%s'%str(gold))chiose_once=True#print(chiose)if is_god:if chiose['BIG']>chiose['SMORT']:a=[random.randint(1,3) for i in range(0,3)]else:a=[random.randint(3,6) for i in range(0,3)]else:a=[random.randint(1,6) for i in range(0,3)]diceimage = ImageTk.PhotoImage(Image.open("sz/%s.jpg"%a[0]))# 更新图片label1.configure(image=diceimage)label1.image = diceimagediceimage = ImageTk.PhotoImage(Image.open("sz/%s.jpg"%a[1]))# 更新图片label2.configure(image=diceimage)label2.image = diceimagediceimage = ImageTk.PhotoImage(Image.open("sz/%s.jpg"%a[2]))# 更新图片label3.configure(image=diceimage)label3.image = diceimagewait = [a for a in range(50, 200, 10)] + [b for b in range(200, 400, 300 // 2)] + \[c for c in range(400, 600, 120)] + [d for d in range(600, 800, 200)]if count < len(wait):root.after(wait[count], run,count + 1)else:a.sort()if sum(a)>9:gold+=chiose['BIG']*2if sum(a)<9:gold+=chiose['SMORT']*2if a[0]+a[1]==a[2]:gold+=chiose['SHUN']*3if a[0]==a[1] and a[0]==a[2]:gold+=chiose['BAO']*6v.set('%s'%str(gold))#print(old_gold)if gold-old_gold>=0:tkinter.messagebox.showinfo(title = '提示',message='本局押对,获得金币:%s'%str(gold-old_gold))else:tkinter.messagebox.showinfo(title = '提示',message='本局押错,扣除金币:%s'%str(old_gold-gold))new_game()except:new_game()tkinter.messagebox.showerror(title = '提示',message='出错了,请重新')def get_gold(golds):global gold,vgold=goldsv.set('%s'%str(gold))tkinter.messagebox.showinfo(title = '提示',message='金币已重置')def God():global is_godif is_god:tkinter.messagebox.showinfo(title = '提示',message='上帝模式关闭,看运气模式')is_god=Falseelse:tkinter.messagebox.showinfo(title = '提示',message='上帝模式开启,不可能获胜')is_god=Trueif __name__=='__main__':global v,run_now,gold,chiose,chiose_once,is_god,old_goid#初始金gold=5000old_gold=5000is_god=Falsechiose_once=Falsechiose={"BIG":0,"SMORT":0,"SHUN":0,"BAO":0}run_now=False# 创建主窗口root = tkinter.Tk()winWidth = 800winHeight = 400screenWidth = root.winfo_screenwidth()screenHeight = root.winfo_screenheight()x = int((screenWidth - winWidth) / 2)y = int((screenHeight - winHeight) / 2)# 设置窗口初始位置在屏幕居中root.geometry("%sx%s+%s+%s" % (winWidth, winHeight, x, y))root.title("摇塞子模拟")root.resizable(width=False, height=False)#绘制主界面# 图片文件# 使用随机数并生成图像a=[6,6,6]diceimage = ImageTk.PhotoImage(Image.open("sz/%s.jpg"%a[0]))label1 = tkinter.Label(root, image=diceimage)label1.image = diceimage# 放置在窗口中 label1.place(x=55, y=80)diceimage = ImageTk.PhotoImage(Image.open("sz/%s.jpg"%a[1]))label2 = tkinter.Label(root, image=diceimage)label2.image = diceimage# 放置在窗口中 label2.place(x=255, y=80)diceimage = ImageTk.PhotoImage(Image.open("sz/%s.jpg"%a[2]))label3 = tkinter.Label(root, image=diceimage)label3.image = diceimage# 放置在窗口中 label3.place(x=455, y=80)v = tkinter.StringVar()v.set("%s"%gold)label4 = tkinter.Label(root, textvariable=v,fg="red", bg="yellow",font=("微软雅黑", 25, "bold"))label4.pack(side="top",pady=10)pailie=20t1 = tkinter.IntVar()entry = tkinter.Entry(root,textvariable = t1,width = 10)entry.place(x=pailie, y=290)CheckVar1 = tkinter.IntVar()C1 = tkinter.Checkbutton(root,text = "买大(2倍)", variable = CheckVar1,onvalue = 1, offvalue = 0, height=3,width = 10)C1.place(x=pailie+70, y=270)t2 = tkinter.IntVar()entry = tkinter.Entry(root,textvariable = t2,width = 10)entry.place(x=pailie+200, y=290)CheckVar2 = tkinter.IntVar()C2 = tkinter.Checkbutton(root, text = "买小(2倍)", variable = CheckVar2, onvalue = 1, offvalue = 0, height=3,width = 10)C2.place(x=pailie+270, y=270)t3 = tkinter.IntVar()entry = tkinter.Entry(root,textvariable = t3,width = 10)entry.place(x=pailie+400, y=290)CheckVar3 = tkinter.IntVar()C3 = tkinter.Checkbutton(root, text = "顺子(3倍)", variable = CheckVar3,onvalue = 1, offvalue = 0, height=3,width =10)C3.place(x=pailie+470, y=270)t4 = tkinter.IntVar()entry = tkinter.Entry(root,textvariable = t4,width = 10)entry.place(x=pailie+600, y=290)CheckVar4 = tkinter.IntVar()C4 = tkinter.Checkbutton(root, text = "豹子(6倍)", variable = CheckVar4, onvalue = 1, offvalue = 0, height=3,width = 10)C4.place(x=pailie+670, y=270)# 添加按钮 设置按钮样式 实现上面所定义的功能button = tkinter.Button(root, text="摇塞子", width=50,height=3,fg="red", command=lambda:run(0))# 放置在窗口中button.pack(side="bottom",pady=10)# 添加按钮 设置按钮样式 实现上面所定义的功能button = tkinter.Button(root, text="重置金币", width=10,height=3,fg="red", command=lambda:get_gold(5000))# 放置在窗口中button.place(x=100, y=325)# 添加按钮 设置按钮样式 实现上面所定义的功能button = tkinter.Button(root, text="上帝模式", width=10,height=3,fg="red", command=lambda:God())# 放置在窗口中button.place(x=620, y=325)root.mainloop()

关于我们

最火推荐

小编推荐

联系我们


版权声明:本站内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 88@qq.com 举报,一经查实,本站将立刻删除。备案号:桂ICP备2021009421号
Powered By Z-BlogPHP.
复制成功
微信号:
我知道了