' each stone is a sprite with a name "i,j", i and j being
' the 2 number of eyes on the stone
Maybe someone likes to program a game with the domino stones
Code: Select all
graphics ! graphics clear 1,1,1
draw color 0,0,0
option angle degrees ! get screen size sx,sy
dominoset()
for i=0 to 6
for j=i to 6
sprite i&j show
sprite i&j at 100*j, 130*i scale 0.7
next j
next i
pause 3
do graphics clear 1,1,1
i=rnd(7) ! j=i+floor(rnd(7-i)) ! sc=.4+rnd(1) ! a=rnd(360)
sprite i&j at rnd(sx),rnd(sy) scale sc angle a
sprite i&j stamp ! pause .2
until forever
end
' this function generates a set of 28 domino stones
' each stone is a sprite with a name "i,j", i and j being
' the 2 number of eyes on the stone
'
def dominoset()
ob=option_base() ! option base 1
dim .xy(7,2)
for i=1 to 7 ! read .xy(i,1) ! read .xy(i,2) ! next i
data 21,21, 21,45, 21,69, 45,45, 69,21, 69,45, 69,69
for i=0 to 6 ! for j=i to 6
sprite i&j begin 90,173
fill color .867, .766, .645
fill rect 0,0 to 90,173
draw size 8 ! draw rect 0,0 to 90,173
draw size 2 ! draw line 8,86 to 82,86
d_c(i,0) ! d_c(j,83)
sprite i&j end
next j ! next i
option base ob
end def
def d_c(k,dy)
fill color 0,0,0
if k=0 then return
if k=1 then
fill circle .xy(4,1),.xy(4,2)+dy size 8
return
end if
if k=2 then
fill circle .xy(1,1),.xy(1,2)+dy size 8
fill circle .xy(7,1),.xy(7,2)+dy size 8
return
end if
if k=3 then
fill circle .xy(1,1),.xy(1,2)+dy size 8
fill circle .xy(4,1),.xy(4,2)+dy size 8
fill circle .xy(7,1),.xy(7,2)+dy size 8
return
end if
if k=4 then
fill circle .xy(1,1),.xy(1,2)+dy size 8
fill circle .xy(3,1),.xy(3,2)+dy size 8
fill circle .xy(5,1),.xy(5,2)+dy size 8
fill circle .xy(7,1),.xy(7,2)+dy size 8
return
end if
if k=5 then
for i=1 to 7 ! if i=2 or i=6 then continue
fill circle .xy(i,1),.xy(i,2)+dy size 8
next i ! return
end if
if k=6 then
for i=1 to 7 ! if i=4 then continue
fill circle .xy(i,1),.xy(i,2)+dy size 8
next i
end if
end def