//定行检列,行为定住的那一行,列为中心点的列号 //__ISW做检测色 BOOL COthelloDlg::can_do_nexe_col(LineNumber __l, ColNumber __c, BOOL __ISW) const { //向左检列,列- for (ColNumber i = __c; i >= 1; i--) if (m_psNow.get_state_by_coord(__l, i) == e_psBlank && reverse_chess(__l, i, __ISW) == TRUE) return TRUE; //向右检测,列+ for (ColNumber i = __c; i <= 8; i++) if (m_psNow.get_state_by_coord(__l, i) == e_psBlank && reverse_chess(__l, i, __ISW) == TRUE) return TRUE; return FALSE; }
int down() { int i, j; if (x + 1 >= MAP_SIZE || map[x + 1][y] != reverse_chess(chess)) { return FAIL; } for (i = x + 1; i < MAP_SIZE; i++) { if (map[i][y] == reverse_chess(chess)) { continue; } else if (map[i][y] == chess) { return SUCCESS; } else { return FAIL; } } return FAIL; }
int up() { int i, j; if (x - 1 < 0 || map[x - 1][y] != reverse_chess(chess)) { return FAIL; } for (i = x - 1; i >= 0; i--) { if (map[i][y] == reverse_chess(chess)) { continue; } else if (map[i][y] == chess) { return SUCCESS; } else { return FAIL; } } return FAIL; }
int right() { int i, j; if (y + 1 >= MAP_SIZE || map[x][y+1] != reverse_chess(chess)) { return FAIL; } for (i = y + 1; i <= MAP_SIZE; i++) { if (map[x][i] == reverse_chess(chess)) { continue; } else if (map[x][i] == chess) { return SUCCESS; } else { return FAIL; } } return FAIL; }
int left() { int i, j; if (y - 1 < 0 || map[x][y-1] != reverse_chess(chess)) { return FAIL; } for (i = y - 1; i >= 0; i--) { if (map[x][i] == reverse_chess(chess)) { continue; } else if (map[x][i] == chess) { return SUCCESS; } else { return FAIL; } } return FAIL; }
int left_down() { int i, j; if (x + 1 >= MAP_SIZE || y - 1 < 0 || map[x + 1][y - 1] != reverse_chess(chess)) { return FAIL; } for (i = x + 1, j = y - 1; i < MAP_SIZE && j >= 0; i++, j--) { if (map[i][j] == reverse_chess(chess)) { continue; } else if (map[i][j] == chess) { return SUCCESS; } else { return FAIL; } } return FAIL; }
int right_down() { int i, j; if (x + 1 >= MAP_SIZE || y + 1 >= MAP_SIZE || map[x + 1][y + 1] != reverse_chess(chess)) { return FAIL; } for (i = x + 1, j = y + 1; i < MAP_SIZE && j < MAP_SIZE; i++, j++) { if (map[i][j] == reverse_chess(chess)) { continue; } else if (map[i][j] == chess) { return SUCCESS; } else { return FAIL; } } return FAIL; }
int right_up() { int i, j; if (x - 1 < 0 || y + 1 >= MAP_SIZE || map[x - 1][y + 1] != reverse_chess(chess)) { return FAIL; } for (i = x - 1, j = y + 1; i >= 0 && j < MAP_SIZE; i--, j++) { if (map[i][j] == reverse_chess(chess)) { continue; } else if (map[i][j] == chess) { return SUCCESS; } else { return FAIL; } } return FAIL; }
int left_up() { int i, j; if (x - 1 < 0 || y - 1 < 0 || map[x - 1][y - 1] != reverse_chess(chess)) { return FAIL; } for (i = x - 1, j = y - 1; i >= 0 && j >= 0; i--, j--) { if (map[i][j] == reverse_chess(chess)) { continue; } else if (map[i][j] == chess) { return SUCCESS; } else { return FAIL; } } return FAIL; }
//落子合法性检查 BOOL COthelloDlg::down_check(LineNumber __l, ColNumber __c, vecPairLiCol * __v) const { if (m_psNow.get_state_by_coord(__l, __c) == e_psBlank && reverse_chess(__l, __c, m_bIsWriteDownChess, __v) == TRUE //横纵斜4向检查,看看是否可以翻转对方 ) return TRUE; return FALSE; }
int left_down() { int i, j; if (x + 1 >= MAP_SIZE || y - 1 < 0 || map[x + 1][y - 1] != reverse_chess(chess)) { return FAIL; } for (i = x + 1, j = y - 1; i < MAP_SIZE && j >= 0; i++, j--) { if (map[i][j] == reverse_chess(chess)) { continue; } else if (map[i][j] == chess) { int m, n; for (m = i-1, n = j+1; m >= x + 1 && n <= y - 1; m--, n++) { map[m][n] = reverse_chess(map[m][n]); } return SUCCESS; } else { return FAIL; } } return FAIL; }
int right_down() { int i, j; if (x + 1 >= MAP_SIZE || y + 1 >= MAP_SIZE || map[x + 1][y + 1] != reverse_chess(chess)) { return FAIL; } for (i = x + 1, j = y + 1; i < MAP_SIZE && j < MAP_SIZE; i++, j++) { if (map[i][j] == reverse_chess(chess)) { continue; } else if (map[i][j] == chess) { int m, n; for (m = i-1, n = j-1; m >= x + 1 && n >= y + 1; m--, n--) { map[m][n] = reverse_chess(map[m][n]); } return SUCCESS; } else { return FAIL; } } return FAIL; }
int right_up() { int i, j; if (x - 1 < 0 || y + 1 >= MAP_SIZE || map[x - 1][y + 1] != reverse_chess(chess)) { return FAIL; } for (i = x - 1, j = y + 1; i >= 0 && j < MAP_SIZE; i--, j++) { if (map[i][j] == reverse_chess(chess)) { continue; } else if (map[i][j] == chess) { int m, n; for (m = i+1, n = j-1; m <= x - 1 && n >= y + 1; m++, n--) { map[m][n] = reverse_chess(map[m][n]); } return SUCCESS; } else { return FAIL; } } return FAIL; }
int left_up() { int i, j; if (x - 1 < 0 || y - 1 < 0 || map[x - 1][y - 1] != reverse_chess(chess)) { return FAIL; } for (i = x - 1, j = y - 1; i >= 0 && j >= 0; i--, j--) { if (map[i][j] == reverse_chess(chess)) { continue; } else if (map[i][j] == chess) { int m, n; for (m = i+1, n = j+1; m <= x - 1 && n <= y - 1; m++, n++) { map[m][n] = reverse_chess(map[m][n]); } return SUCCESS; } else { return FAIL; } } return FAIL; }