Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 tetris help
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
25jai




PostPosted: Tue May 25, 2004 9:25 am   Post subject: tetris help

hey i'm doing tetris for my final summative project in computer science class, and i need lotsa help from u guys who can help me Smile

first of all, when the blocks are coming down, in tetris you are allowed to rotate as many times as you want, move around, before it drops another block. my question is: how do you do this in turing?

i may have a lot more questions later on, but this would be my most important one rite now.

thnx in advance
Sponsor
Sponsor
Sponsor
sponsor
Andy




PostPosted: Tue May 25, 2004 9:34 am   Post subject: (No subject)

search for my tetris source
25jai




PostPosted: Tue May 25, 2004 9:48 am   Post subject: (No subject)

yes i've seen your program, and your blocks do not do that.
your blocks do only one certain move per "drop"
but in real tetris, you can do multiple moves per drop
that's what i'm asking...
25jai




PostPosted: Wed May 26, 2004 8:10 am   Post subject: (No subject)

so, anyone wanna help me?
Tony




PostPosted: Wed May 26, 2004 8:22 am   Post subject: (No subject)

what you do is you make rotation independant of the fall. Basically take out his rotation code and place it in a loop of its own. Then you check for elapsed time every so oftern and compare it to the last time the piece was dropped a row + drop delay.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
25jai




PostPosted: Thu May 27, 2004 3:39 pm   Post subject: (No subject)

i read a thread by brightguy someone talking about clock, and i also saw one of my friend who's also doin tetris in class using the clock function
can anyone tell me how this works and how i can use this in my tetris program?
25jai




PostPosted: Fri May 28, 2004 9:57 pm   Post subject: (No subject)

anyone?
plz i really need help
Dan




PostPosted: Fri May 28, 2004 11:16 pm   Post subject: (No subject)

while what you do is check the time in secs at some point and save it in a var and then check it agean latter on in the progame and take the diffrence of the new one and the saved one and you get how much time has pased.

You could uses that to detrime whtere to move the block down or not.

EX.

if 10 secs gone by then

move block down

reset timer

end if
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Brightguy




PostPosted: Sun May 30, 2004 5:39 am   Post subject: Re: tetris help

I looked through the source of my old Tetris program... it's not very pretty. I wrote most of it when I was just learning how to program. You'd probably be better off not looking at it. Laughing

You should store each cell's filled status in a boolean matrix. Also, here's the basic looping structures for the program:
code:
var cell : array 0 .. 9, 0 .. 19 of boolean
var speed, timer, prevTime : int := 0
var key : string (1)

loop
     %choose random block
     loop
          key := " "
          loop
               if hasch then
                    getch (key)
                    %move block according to keypress
               end if
               clock (timer)
               exit when timer > prevTime + speed
          end loop
          prevTime := timer
          %move block down a square
          %exit when block cannot move down anymore
     end loop
     %check for full line, add up score
     %change level/speed if necessary
end loop
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 9 Posts ]
Jump to:   


Style:  
Search: