mirror of
https://github.com/gwenhael-le-moine/c-urs_-toil-s.git
synced 2025-01-14 08:01:19 +01:00
renamed s->moves into s->distance_travelled and change its meaning.
It makes more sense to me now, I can define the goal of the game as "collect all the gifts while travelling the least possible."
This commit is contained in:
parent
a8a00b2ec0
commit
4018177e11
1 changed files with 5 additions and 5 deletions
10
star.c
10
star.c
|
@ -295,7 +295,7 @@ struct options { /* store how the game is started (controlled by
|
||||||
struct state { /* current state of the game at an instant T */
|
struct state { /* current state of the game at an instant T */
|
||||||
char board[ LEVEL_HEIGHT * LEVEL_WIDTH ];
|
char board[ LEVEL_HEIGHT * LEVEL_WIDTH ];
|
||||||
char moving;
|
char moving;
|
||||||
int moves;
|
int distance_travelled;
|
||||||
int level;
|
int level;
|
||||||
int nb_levels;
|
int nb_levels;
|
||||||
};
|
};
|
||||||
|
@ -346,7 +346,7 @@ void load_level( struct state *s, char* levels[], int nb )
|
||||||
strncpy( s->board, levels[ nb ], LEVEL_HEIGHT * LEVEL_WIDTH );
|
strncpy( s->board, levels[ nb ], LEVEL_HEIGHT * LEVEL_WIDTH );
|
||||||
s->level = nb;
|
s->level = nb;
|
||||||
s->moving = BALL;
|
s->moving = BALL;
|
||||||
s->moves = 0;
|
s->distance_travelled = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Swicth the currently moving actor between BALL and CUBE
|
/* Swicth the currently moving actor between BALL and CUBE
|
||||||
|
@ -424,7 +424,7 @@ void display_level( struct state *s )
|
||||||
|
|
||||||
mvprintw( 1, 35, "level %i of %i", s->level + 1, s->nb_levels );
|
mvprintw( 1, 35, "level %i of %i", s->level + 1, s->nb_levels );
|
||||||
mvprintw( 2, 35, "%i gifts left", count_gifts( s ) );
|
mvprintw( 2, 35, "%i gifts left", count_gifts( s ) );
|
||||||
mvprintw( 3, 35, "%i moves made", s->moves );
|
mvprintw( 3, 35, "%i meter%s traveled", s->distance_travelled, ( s->distance_travelled > 1 ) ? "s" : "" );
|
||||||
|
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
@ -479,9 +479,9 @@ void make_a_move( struct state *s, direction where )
|
||||||
(maybe on a very slow machine it adds beauty?...)
|
(maybe on a very slow machine it adds beauty?...)
|
||||||
*/
|
*/
|
||||||
/* display_level( s ); */
|
/* display_level( s ); */
|
||||||
}
|
|
||||||
|
|
||||||
s->moves++; /* increment moves' counter */
|
s->distance_travelled++; /* increment distance_travelled's counter */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Parse the --arguments, if any, to populate options
|
/* Parse the --arguments, if any, to populate options
|
||||||
|
|
Loading…
Reference in a new issue