From 4fcfc251a16dc01a2ad0f1f5c90384e547fcfcb7 Mon Sep 17 00:00:00 2001 From: Gwenhael Le Moine Date: Fri, 1 Jul 2011 11:53:51 +0200 Subject: [PATCH] comment hairy conditional + remove debug print --- star.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/star.c b/star.c index 9d28115..7fbb4b3 100644 --- a/star.c +++ b/star.c @@ -116,10 +116,13 @@ void move( state *s, int direction ) } /* Calculating arrival coordinates */ - while ( + while ( /* Hairy conditions ahead */ + /* target cell is within level's boundaries */ ( ( tmpx + dx >= 0 ) && ( tmpx + dx < LEVEL_WIDTH ) ) && ( ( tmpy + dy >= 0 ) && ( tmpy + dy < LEVEL_HEIGHT ) ) && + /* and target cell is empty */ ( get_cell( s, tmpx + dx, tmpy + dy ) == VOID ) + /* or, in case the ball is moving, target cell can be a gift (which we'll eat) */ || ( s->moving == BALL && ( get_cell( s, tmpx + dx, tmpy + dy ) == GIFT ) ) ) { tmpx += dx; @@ -182,7 +185,7 @@ int main( int argc, char* argv[] ) load_level( s, levels[ 0 ] ); display_level( s ); - fprintf( stderr, "starting to move\n" ); + char* moves = "drdluruldrdlrulurudlurdul"; do { fprintf( stderr, "move %c\n", moves[ i ]);