猜拳游戏.txt


function Game() gg.setVisible(false) c1="第"..n.."把"
c=gg.choice({"石头","剪刀"," 布 ","退出"},nil,c1)
x=math.random(1,3) if c==nil then Game() else n=n+1
if c==1 then z="石头" end if c==2 then z="剪刀" end
if c==3 then z=" 布 " end if x==1 then y="石头" end
if x==2 then y="剪刀" end if x==3 then y=" 布 " end
if c~=4 then xc=" 你出 "..z.." 我出 "..y
gg.alert(xc) if c==x then zx=" 平 局" end
if c==1 and x==3 then zx=" 你输了" jf=jf-10 end
if c==2 and x==1 then zx=" 你输了" jf=jf-10 end
if c==3 and x==2 then zx=" 你输了" jf=jf-10 end
if c==1 and x==2 then zx=" 你赢了" cs=cs+1 jf=jf+10 end
if c==2 and x==3 then zx=" 你赢了" cs=cs+1 jf=jf+10 end
if c==3 and x==1 then zx=" 你赢了" cs=cs+1 jf=jf+10 end
gg.alert(c1..zx) print(c1..xc..zx) print() end end end

n=1 c=0 cs=0 jf=0 while true do if n==10
then c=4 end if c~=4 then Game() else if jf>10
then ov="腻害腻害!" else ov="再接再厉!" end
print("你总共赢了 "..cs.."把","当前积分为 "..jf,ov)
gg.setVisible(true) os.exit() end end

1 Download (1 KB)