Alex,
More results from my tetris code review. :-)
: game-over? ( tetris -- ? )
dup dup tetris-next-piece piece-valid? ;
: new-current-piece ( tetris -- )
game-over? [
dup tetris-pieces cdr swap set-tetris-pieces
] [
f swap set-tetris-running?
] if ;
I think you have an extra dup in game-over? and new-current-piece depends on
this. Because of this extra dup, the declared stack effect is incorrect.
Also, game-over? returns t when the game is actually not over. :-) So here
are my suggestions:
: game-over? ( tetris -- ? ) dup tetris-next-piece piece-valid? not ;
: new-current-piece ( tetris -- )
dup game-over?
[ f swap set-tetris-running? ]
[ dup tetris-pieces cdr swap set-tetris-pieces ]
if ;
Ed
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Factor-talk mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/factor-talk