Snake: Difference between revisions
Content deleted Content added
Line 21: | Line 21: | ||
/* Implementing this task in Hopper-FLOW-MATIC++ */ |
/* Implementing this task in Hopper-FLOW-MATIC++ */ |
||
/* The snake must catch a bite before time runs out, which decreases by |
/* The snake must catch a bite before time runs out, which decreases by |
||
10 points every |
10 points every 800 milliseconds. |
||
The remaining time will be added to your total score. */ |
The remaining time will be added to your total score. */ |
||
Line 42: | Line 42: | ||
SET( TIME, 100 ) |
SET( TIME, 100 ) |
||
LET( Size := MUL(w,h) ) |
LET( Size := MUL(w,h) ) |
||
SET( TLimit := |
SET( TLimit := 100 ) |
||
VOID( big number, numL1, numL2, numL3 ) |
VOID( big number, numL1, numL2, numL3 ) |
||
GOSUB( set score ) |
GOSUB( set score ) |
||
Line 55: | Line 55: | ||
TIC( T ) |
TIC( T ) |
||
WHILE( NOT (quit) ) |
WHILE( NOT (quit) ) |
||
DEVIATE-IF( TLimit ~= TPlay ){ |
|||
GOSUB( show ) |
|||
WHEN( KEY-PRESSED? ){ |
|||
SCAN-CODE( C ) |
|||
SWITCH( C ) |
|||
CASE( |
CASE( K_UP ) { dir = N, EXIT } |
||
CASE( |
CASE( K_RIGHT ){ dir = E, EXIT } |
||
CASE( |
CASE( K_DOWN ) { dir = S, EXIT } |
||
CASE( |
CASE( K_LEFT ) { dir = W, EXIT } |
||
CASE( |
CASE( K_ESC ) { quit = 1, EXIT } |
||
CASE( 32 ) { PAUSE, EXIT } |
|||
SWEND |
|||
} |
|||
⚫ | |||
} |
} |
||
DEVIATE-IF( 800 ~= T ) { |
|||
TIME-=10, CLAMP(0,100,TIME) |
|||
{TIME, 12, 52} GOSUB( put time ) |
|||
// is not suitable for anything but toy projects like this |
|||
DEVIATE-IF( 500 ~= T ) { |
|||
⚫ | |||
⚫ | |||
} |
} |
||
WEND |
WEND |
||
Line 189: | Line 189: | ||
{SCORE, 4, 52} GOSUB( put score ) |
{SCORE, 4, 52} GOSUB( put score ) |
||
LET( TIME := 100 ) |
LET( TIME := 100 ) |
||
++counter, COND( GT?( counter, |
++counter, COND( GT?( counter, 5 ) ) |
||
LET( TLimit := SUB( TLimit, |
LET( TLimit := SUB( TLimit,5 )) |
||
⚫ | |||
LET( counter := 0 ) |
LET( counter := 0 ) |
||
CEND |
CEND |