VBS->21游戏
VBS
msgbox"总数值为x,每次最少减一,最多减三,使数值为零的人输.",0,"规则"
Dim a,b,c,d,e,f,g
d=int(inputbox("标准21","总数:","21"))
b=inputbox("谁先?","Who first?","computer")
if b="computer" then
f=d-1
e=f mod 4
if e=0 then
e=e+3
else
end if
else
e=0
end if
do
if g=1 then
else
d=d-e
end if
g=0
if d>0 then
a=int(inputbox("computer:"&(e)&",你要取:(1,2,3)","还剩:"&(d)&"个."))
if a<4 and a>0 then
d=d-a
if d>0 then
msgbox"还剩:"&(d)&"个.",0,"How mach."
f=d-1
e=f mod 4
if e=0 then
randomize
e=int(3*rnd+1)
else
end if
else
c=2
end if
else
g=1
msgbox"你违反了规则.",0,"Wrong."
end if
else
c=1
end if
loop while d>0
if c=1 then
msgbox"你赢了.",0,"Game over."
else if c=2 then
msgbox"你输了.",0,"Game over."
else
msgbox"游戏故障",0,"Wrong."
end if
end if
初一写的,翻了出来.