It requires the graphics mode, and will use the current “draw color” in the host app.
It fits on the iPad and on the iPhone.
Code: Select all
graphics ! draw color 0,0,0
bandit()
end
def bandit()
ob=option_base() ! option base 0
dim tok(7),rol(13),r_s(3),r_n(3),end(3),win(5),pay(5)
for i=0 to 6 ! read tok(i) ! next i
data 9884,58181,58182,58183,58184,58185,58186
for i=0 to 12 ! read rol(i) ! next i
data 2,5,4,6,1,3,0,3,6,5,1,2,4
for i=0 to 4 ! read pay(i) ! next i
data 1,3,2,5,10
xp=100 ! yp=100
if device_type$()="iPhone" then
get orientation orient
set orientation landscape
xp=10 ! yp=10
end if
page "band" set
page "band" frame xp,yp,560,325
page "band" color .5,.7,.7,1
set buttons custom
set buttons font size 100
button "w0" text chr$(tok(2)) at 20,20 size 160,120
button "w1" text chr$(tok(3)) at 200,20 size 160,120
button "w2" text chr$(tok(4)) at 380,20 size 160,120
set buttons font size 30
t$="Bet (€ 1) "&chr$(10137)
button "pay" text t$ at 60,155 size 200,40
button "h0" text "€ 1" at 300,155 size 60,40
button "h1" text "€ 5" at 390,155 size 60,40
button "h2" text "€ 20" at 480,155 size 60,40
button "win" text "" at 20,210 size 240,40
button "pot" text "Pot: € 100" at 20,270 size 240,40
set buttons font size 40
button "rol" text "start" at 300,210 size 100,100
button "bos" text "Boss!" at 420,210 size 120,100
init=1 ! running=0 ! inzet=1 ! winst=100
for i=0 to 4 ! win(i)=int(inzet*pay(i)) ! next i
randomize()
page "band" show
do slowdown
if bp("bos") then
page "band" hide
if orient>0 then set orientation orient
option base ob
return
end if
for i=0 to 2
if bp("h"&i) then
if i=0 then inzet=1
if i=1 then inzet=5
if i=2 then inzet=20
t$="Inzet (€ "&inzet&") "&chr$(10137)
button "pay" text t$
for j=0 to 4 ! win(j)=int(inzet*pay(j)) ! next j
end if
next i
if not running and bp("rol")=1 then
running=1 ! tour=1 ! button "win" text ""
winst-=inzet ! button "pot" text "Pot: € "&winst
for i=0 to 2 ! r_s(i)=rnd(13) ! r_n(i)=3+rnd(4) ! next i
while running
for i=0 to 2
if r_n(i)=0 then continue
k=r_s(i)%13 ! r_s(i)+=1
end(i)=rol(k)
button "w"&i text chr$(tok(end(i)))
next i
pause .3
running=0
for i=0 to 2
if r_n(i)>0 then
running=1 ! r_n(i)-=1 ! break
end if
next i
end while
bwin=0
if end(0)=end(1) then ' check winnende combi
if end(2)=end(1) then trip(end(1)) else dub(end(1))
else ! if end(1)=end(2) then dub(end(1))
end if
skull=0
for i=0 to 2 ! if end(i)=0 then skull+=1 ! next i
bwin+=skull*win(1) ! winst+=bwin
button "pot" text "Pot: € "&winst
if bwin>0 then
button "win" text "Win: € "&bwin
beep
end if
end if
until forever
end def
def dub(k)
if k=0 then res=bandit.win(2)
if k=1 then res=bandit.win(1)
if k>1 then res=bandit.win(0)
bandit.bwin=res ! bandit.winst+=res
button "pot" text "Pot: € "&bandit.winst
button "win" text "Win: € "&res
end def
def trip(k)
if k=0 then res=bandit.win(4)
if k=1 then res=bandit.win(3)
if k>1 then res=bandit.win(1)
bandit.bwin=res ! bandit.winst+=res
button "pot" text "Pot: € "&bandit.winst
button "win" text "Win: € "&res
end def
def db ! debug pause ! end def
def bp(a$) = button_pressed(a$)