fix random seed initialization

This commit is contained in:
Benno Fünfstück 2020-02-06 16:53:29 +01:00
parent 3697a76f5f
commit bd3ea26cfe

View file

@ -2,6 +2,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#include <time.h>
enum { enum {
BOARD_SIZE = 10, BOARD_SIZE = 10,
@ -60,6 +61,8 @@ enum target {
enum target check_hit(struct state state, struct position hit); enum target check_hit(struct state state, struct position hit);
int main(void) { int main(void) {
srand(time(NULL));
struct state state = generate_state(); struct state state = generate_state();
while (!state.game_over) { while (!state.game_over) {