[comp.sys.handhelds] Faster TETRIS Update

a634@mindlink.UUCP (Rob Prior) (11/18/90)

No, this isn't about the ML version... :)  I have improved the faster version
posted yesterday... Now the program starts at a more reasonable speed and
builds up as you play, eventually getting as fast as the original post.
Anyways, enough talk, here is the update:

Replace:  TETRIS, RK2 with the new ones below
Delete:   RKEY (presumably a test version of RK2, doesn't do anything)
Add:      delay, a (a will be created by the new TETRIS, if you like)

Everything else stays the same.  Enjoy the revision!

The programs:

==================================CUT
HERE======================================
  TETRIS
    \<< .101 'a' STO 1            @ Initializes the delay timer
CF MKSCR 0 'PNTS'
STO 0 ADDP
      DO delay FLST               @ Decreases the delay before
RAND 7 * IP 1 + DUP               @ each piece is displayed
'OB1' STO GET 1 DUP
'OB2' STO GET # 11d
1 CF
        DO
          IF 1 FC?
          THEN RK2
RK2 RK2 RK2
          END DUP2
# 0d XFIG # 256d +
DUP2 # 0d + TFIG
          IF # 0d
==
          THEN DUP2
# 63903d XFIG
          ELSE
# 256d - # 63903d
XFIG # 0d
          END
        UNTIL DUP
# 0d ==
        END 20 ADDP
DROP PACK MEM DROP
      UNTIL FULL
      END 2 WAIT
      WHILE KEY
      REPEAT DROP
      END
    \>>

  RK2
    \<<
      IF KEY
      THEN
        IF { 72 74
73 63 } SWAP POS
DUP
        THEN {
          \<< # 1d
NEG MSIDE
          \>>
          \<< # 1d
MSIDE
          \>>
          \<< 1 SF
          \>> ROTF }
SWAP GET EVAL
        ELSE DROP
        END
      END a WAIT                  @ Waits the specified time
    \>>

  delay                           @ The program that changes the
    \<< a .001 - DUP              @ wait time
      IF 0 \<=
      THEN 0 'a'
STO DROP
      ELSE 'a' STO
      END
    \>>

  a .101                          @ the delay
==================================CUT
HERE======================================
--
 _______________________________________________________________
|Rob Prior - President, Still Animation Logo Design, Burnaby, BC|
|---------------------------------------------------------------|
|            Mail to: a634@mindlink.uucp                        |
|   ___  _        or: !uunet!van-bc!rsoft!mindlink!a634         |
|  /__  /_\    "You must find us.... a shrubbery!!!!!!"         |
|____/ /   \____________________________________________________|

frechett@boulder.Colorado.EDU (-=Runaway Daemon=-) (11/19/90)

Hmmm, could you possibly post the whole directory over again?  I downloaded
TETRIS RK2 and delay after much hassle, stripping off the name that comes
from the fact that those objects look to have been stipped out of a 
directory object.  Also, if I download a file called delay from my UNIX it 
trys to create DELAY and of course chokes, and calls it DELAY.1  so I have 
change it to "delay".  Such fun, and when I am all done and I exececute
TETRIS, it comes up a bit slower which is nice but absolutely none of the 
commands work.. It will not move or rotate with the arrow keys at all.  
Any idea what this could be?  

	ian

--
-=Runaway Daemon=-    

kaufman@delta.eecs.nwu.edu (Michael L. Kaufman) (11/20/90)

Sorry about posting this, but my mail to you keeps bouncing.  Could you send me
a copy of the entire Fast-Tetris directory?  Our system didn't get your first
post and I have lost my copy of tetris anyhow.  Thanks,  Michael


Michael Kaufman  | I've seen things you people wouldn't believe. Attack ships
  kaufman        | on fire off the shoulder of Orion. I watched C-beams glitter
   @eecs.nwu.edu | in the dark near the Tannhauser gate. All these moments will
                 | be lost in time - like tears in rain. Time to die.

gt3398b@prism.gatech.EDU (DELANO,ANDREW DOUGLAS) (11/20/90)

In the delay program,

\<< a .005 - DUP
    IF 0 \>= 
    THEN 0 'a' STO .....

when 'a' is 0, the program ends and so does you game, 
so make a default to a number other than 0:
 
\<< a .005 - DUP
    IF 0 \>=
    THEN .0000001 'a' STO .....rest of original program
     

This will make the Tetris continue to play at top speed once
it reaches that point.

			Enjoy,

				Andy Delano

p.s. by the way, thanks for the great improvements on this game (all of you).

-- 
DELANO,ANDREW DOUGLAS
Georgia Institute of Technology, Atlanta Georgia, 30332
uucp:	  ...!{decvax,hplabs,ncar,purdue,rutgers}!gatech!prism!gt3398b
Internet: gt3398b@prism.gatech.edu

frechett@boulder.Colorado.EDU (-=Runaway Daemon=-) (11/21/90)

Ok, I did figure out the part about the keys being redefined.  I promptly 
put them back and added a few things.
Fixed the 0 wait bug in 'delay'.  
I changed the first few lines of 'TETRIS' to \<< b 'a' STO   
where 'b' contains the intial delay value so that you don't have to edit 
'TETRIS' when your skill level goes up in general.  
I changed the last bit of 'TETRIS' to    END 1 CF \>> 
Which makes sure to clear flag one.  This you will set if you end the game
by dropping (down arrow) to dead.  If you look at RK2, you can see that this
flag is set whenever you hit down arrow and it tells everything when to drop 
and to not do anything else while dropping.  
And finally, I added something that I had been meaning to add for a long time,
A clockwise rotation key.  I am not able to decipher ROTF fully yet so I just 
used a kludge.  In RK2 the IF ... THEN stuff has been modified.

old:  IF { 34 36 35 25  } SWAP ....... etc.
new:  IF { 34 36 35 25 26 } SWAP ....etc.    That is the NXT key.

further down.

old: .... \>> ROTF }    
new: .... \>> ROTF \<<ROTF ROTF ROTF \>> }

So what I did was to add the keystroke NXT to rotate the figure three times 
counter clockwise and thus once clockwise.  I know, I know, some what of 
a mess but I will get it all straightened out eventually.  ;)


Thaz it.   I would like to say that I am not a video game nut and tetris was
one of the only games that I could stand, until I saw MINEHUNT today.  ;)  
Bill, I suspect that anyone who is asking for the M-L version of tetris already
has a hp48sx and so I suspect that buying a GAMEBOY would be a bit impractical.
I realize that this is one serious piece of machinery but I rebel at the
thought that it has be be used in a purely serious sense.  Go ahead and try to
convince me that machine language hacking is serious work and holds less
enjoyment than a video game holds for some people.  I wouldn't believe you
anyway.  ;)  I would like to see TETRAS for two reasons.  I suspect that it is
very small, and I am curious of course why HP is interested.  As for the speed,
does anyone really think that they can handle a version of "fast tetris" faster
than what it will run with the delay gone?  I doubt it.  Ah well, I haven't
tryed any of the CHIP stuff yet, even though it is in my archive, because I
don't have the space.. Need that 128K card NOW!!! ;)

	ian
--
-=Runaway Daemon=-