Here is something I threw together. Perhaps it will help you.
sync on : sync rate 60
backdrop on : color backdrop rgb(25,25,25)
autocam off : hide mouse
randomize timer()
dim grid(18,4)
x# = -45.0 : y# = 20.0 : obj = 100
for k = 1 to 18
grid(k,4) = rnd(2) + 1 : ` pick random 1 - 3
select grid(k,4)
case 1
make object cube obj,2
endcase
case 2
make object sphere obj,2
endcase
case 3
make object triangle obj, 0, 0, 0, 2, -2, 0, 2, 2, 0
endcase
endselect
r = rnd(128) + 127 : g = rnd(128) + 127 : b = rnd(128) + 127
color object obj,rgb(r,g,b) : set object ambience obj,rgb(r,g,b)
if k = 10 then x# = -45.0 : y# = 30.0
position object obj,x#, y#,0.0
inc obj : inc x# , 10.0
next k
position camera 0.0,0.0,-60
point camera 0.0,0.0,0.0
match = Check3inarow()
sh = screen height() : sw = screen width() * .5
repeat
if match > 0
text 10,sh - 50,"Found " + str$(match) + " matches."
else
text 10,sh - 50,"Sorry, no matches found."
endif
sync
until mouseclick() > 0
end
function Check3inarow()
match = 1
for k = 1 to 7
if grid(k,4) = grid(k + 1,4) and grid(k,4) = grid(k + 2,4) and grid(k,3) = 0 and grid(k + 1,3) = 0 and grid(k + 2,3) = 0
grid(k,3) = match : grid(k + 1,3) = match : grid(k + 2,3) = match : inc match
endif
if grid(k + 9,4) = grid(k + 10,4) and grid(k + 9,4) = grid(k + 11,4) and grid(k + 9,3) = 0 and grid(k + 10,3) = 0 and grid(k + 11,3) = 0
grid(k + 9,3) = match : grid(k + 10,3) = match : grid(k + 11,3) = match : inc match
endif
next k
dec match
endfunction match
So many games to code.......so little time.