Mercurial > projects > rantaiwarna
comparison board.c @ 4:aec74ae4d6e5 version-2
Fix the logic checking whether a generated board is playable
author | Guido Berhoerster <guido+rantaiwarna@berhoerster.name> |
---|---|
date | Fri, 24 Oct 2014 17:12:12 +0200 |
parents | a9a7ad180c3b |
children | 4f6bf50dbc4a |
comparison
equal
deleted
inserted
replaced
3:868670fcc17b | 4:aec74ae4d6e5 |
---|---|
108 for (j = 0; j < board->width * board->height; j++) { | 108 for (j = 0; j < board->width * board->height; j++) { |
109 board->elements[j] = | 109 board->elements[j] = |
110 (short)(rantaiwarna_rand(&board->seed) % | 110 (short)(rantaiwarna_rand(&board->seed) % |
111 board->colors) + 1; | 111 board->colors) + 1; |
112 } | 112 } |
113 if (board_check_status(board) & GAME_OVER) { | 113 if (!(board_check_status(board) & GAME_OVER)) { |
114 return (ERR); | 114 break; |
115 } | 115 } |
116 } | 116 } |
117 | 117 |
118 board->score = 0; | 118 board->score = 0; |
119 | 119 |
120 return (OK); | 120 return (!(board->status & GAME_OVER) ? OK : ERR); |
121 } | 121 } |
122 | 122 |
123 int | 123 int |
124 board_compact(struct board_ctx *board) | 124 board_compact(struct board_ctx *board) |
125 { | 125 { |