コミットを比較
2 コミット
03739c36fa
...
0a228a490d
作成者 | SHA1 | 日付 |
---|---|---|
ninya9k | 0a228a490d | |
ninya9k | ea0a6ed49c |
36
uttt.c
36
uttt.c
|
@ -49,7 +49,18 @@ char ut_winner(char *tiles, int offset, int stride) {
|
|||
if (tile == T(0, 0) && tile == T(2, 2)) {return tile;}
|
||||
if (tile == T(2, 0) && tile == T(0, 2)) {return tile;}
|
||||
|
||||
return '\0';
|
||||
// check for draw
|
||||
for (int y = 0; y < 3; y++) {
|
||||
for (int x = 0; x < 3; x++) {
|
||||
if (T(x, y) == '\0') {
|
||||
// tile is empty - not a draw
|
||||
return '\0';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// draw
|
||||
return -1;
|
||||
}
|
||||
|
||||
int ut_move(struct ut_state *new_state, const struct ut_state *old_state, int row, int col)
|
||||
|
@ -87,23 +98,6 @@ void ut_show(const struct ut_state *state) {
|
|||
play_board_row = state->playBoard / 3;
|
||||
play_board_col = state->playBoard % 3;
|
||||
}
|
||||
/*for(int i = 0; i < 3; i++)
|
||||
{
|
||||
putchar(' ');
|
||||
for(int j = 0; j < 3; j++)
|
||||
{
|
||||
printf("%d ");
|
||||
}
|
||||
}
|
||||
for(int br = 0; br < 3; br++)
|
||||
{
|
||||
for(int r = 0; r < 3; r++)
|
||||
{
|
||||
}for(int bc = 0; bc < 3; bc++)
|
||||
{
|
||||
|
||||
}
|
||||
}*/
|
||||
printf(" 012 345 678\n");
|
||||
for(int y = 0; y < 9; y++)
|
||||
{
|
||||
|
@ -161,11 +155,7 @@ bool getpos(const struct ut_state *state, int *x, int *y) {
|
|||
return false;
|
||||
if (sscanf_result != 2)
|
||||
continue;
|
||||
/*
|
||||
if (
|
||||
*x >= 0 && *x < 9 && *y >= 0 && *y < 9
|
||||
&& board->tiles[*y][*x] == '\0'
|
||||
) */ break;
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
読み込み中…
新しいイシューから参照