Sounds like a challenge! I never tried programming tetris before. I tried OBese's code - the result looks pretty good. I haven't looked at how he did it. I'm gonna try and jump in the tank blind and see what I can come up with. I think I'll need 30 days instead of 30 minutes - but I'll give 30 mins a shot.
Okay, it's taken me 25 mins just to think up and type the data - not having even gotten to the coding. So far this much has been typed:
remstart
==============================================================
= Title : Tetris
= Author : Latch
= Date : 05/23/2012
= Update :
= Version:
==============================================================
Comments
==============================================================
remend
rem =============================================================
rem = SET UP DISPLAY
rem =============================================================
autocam off
set display mode 800,600,32
sync on
sync rate 60
rem =============================================================
rem = MAIN
rem =============================================================
do
sync
loop
end
rem =============================================================
rem = SUBROUTINES - PROCEDURES
rem =============================================================
_init:
rem read in block data
dim blocks(7,4,16)
restore _blocks_data
for x=1 to 7
for y=1 to 4
for z=1 to 16
read blocks(x,y,z)
next z
next y
next x
rem design grid
rem =============================================================
rem = FUNCTIONS
rem =============================================================
rem =============================================================
rem = DATA STATEMENTS
rem =============================================================
_blocks_data:
remstart
Each shape can be contained in a 4x4 grid. Each shape can
be rotated at 4 angles. Store each of these possibilities
grid aligned as such
1,2,3,4
5,6,7,8
9,10,11,12
13,14,15,16
remend
`left z
data 0,0,0,0, 0,0,0,0, 1,1,0,0, 0,1,1,0
data 0,0,0,0, 0,0,1,0, 0,1,1,0, 0,1,0,0
data 0,0,0,0, 0,0,0,0, 1,1,0,0, 0,1,1,0
data 0,0,0,0, 0,0,1,0, 0,1,1,0, 0,1,0,0
`right z
data 0,0,0,0, 0,0,0,0, 0,1,1,0, 1,1,0,0
data 0,0,0,0, 0,1,0,0, 0,1,1,0, 1,0,0,0
data 0,0,0,0, 0,0,0,0, 0,1,1,0, 1,1,0,0
data 0,0,0,0, 0,1,0,0, 0,1,1,0, 1,0,0,0
`box
data 0,0,0,0, 0,0,0,0, 0,1,1,0, 0,1,1,0
data 0,0,0,0, 0,0,0,0, 0,1,1,0, 0,1,1,0
data 0,0,0,0, 0,0,0,0, 0,1,1,0, 0,1,1,0
data 0,0,0,0, 0,0,0,0, 0,1,1,0, 0,1,1,0
`stick
data 0,0,0,0, 0,0,0,0, 0,0,0,0, 1,1,1,1
data 1,0,0,0, 1,0,0,0, 1,0,0,0, 1,0,0,0
data 0,0,0,0, 0,0,0,0, 0,0,0,0, 1,1,1,1
data 1,0,0,0, 1,0,0,0, 1,0,0,0, 1,0,0,0
`right L
data 0,0,0,0, 0,0,0,0, 0,0,1,0, 1,1,1,0
data 0,0,0,0, 1,1,0,0, 0,1,0,0, 0,1,0,0
data 0,0,0,0, 0,0,0,0, 1,1,1,0, 1,0,0,0
data 0,0,0,0, 1,0,0,0, 1,0,0,0, 1,1,0,0
`left L
data 0,0,0,0, 0,0,0,0, 1,0,0,0, 1,1,1,0
data 0,0,0,0, 0,1,0,0, 0,1,0,0, 1,1,0,0
data 0,0,0,0, 0,0,0,0, 1,1,1,0, 0,0,1,0
data 0,0,0,0, 1,1,0,0, 1,0,0,0, 1,0,0,0
`T
data 0,0,0,0, 0,0,0,0, 0,1,0,0, 1,1,1,1
data 0,0,0,0, 0,1,0,0, 1,1,0,0, 0,1,0,0
data 0,0,0,0, 0,0,0,0, 1,1,1,0, 0,1,0,0
data 0,0,0,0, 0,1,0,0, 0,1,1,0, 1,0,0,0
I got little more than nothin' after 1.5 hours. I've failed this challenge! It's taking me about 30 minutes just to think through the logic for each new task - like displaying the blocks or updating the positions. Then typing and bug fixing? forget about it!
Enjoy your day.