-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
I noticed that there's a bug in usr/minesweeper.c.
The function mine_mark()
is defined in line 304~311 to mark the mine if this cell is not opened.
// usr/minesweeper.c, line 304~311
void mine_mark(struct command *com){
int x, y;
x = com->x;
y = com->y;
if(!(board[x][y] & OPEN)) // check if the cell is opened
board[x][y] ^= MARKED;
}
However the macro OPEN
is not a status but a command.
// usr/minesweeper.c, line 15~28
// cell status
#define BOMB_MASK 15
#define OPENED 16
#define MARKED 32
#define BOMB 64
// command
#define INIT 0
#define IOPEN 1
#define OPEN 2
#define MARK 3
#define QUIT 4
#define HELP 5
#define NOP 6
So, in function mine_mark()
, OPEN
should be replaced with OPENED
as follows:
void mine_mark(struct command *com){
int x, y;
x = com->x;
y = com->y;
if(!(board[x][y] & OPENED))
board[x][y] ^= MARKED;
}
I'd say sorry that I am not familiar with github and my git skill is not good.
That is why I have to report in this way.
Metadata
Metadata
Assignees
Labels
No labels