Exemplo n.º 1
0
//定行检列,行为定住的那一行,列为中心点的列号
//__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;
}
Exemplo n.º 2
0
Arquivo: F.c Projeto: geeeqie/codes
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;
}
Exemplo n.º 3
0
Arquivo: F.c Projeto: geeeqie/codes
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;
}
Exemplo n.º 4
0
Arquivo: F.c Projeto: geeeqie/codes
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;
}
Exemplo n.º 5
0
Arquivo: F.c Projeto: geeeqie/codes
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;
}
Exemplo n.º 6
0
Arquivo: F.c Projeto: geeeqie/codes
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;
}
Exemplo n.º 7
0
Arquivo: F.c Projeto: geeeqie/codes
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;
}
Exemplo n.º 8
0
Arquivo: F.c Projeto: geeeqie/codes
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;
}
Exemplo n.º 9
0
Arquivo: F.c Projeto: geeeqie/codes
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;
}
Exemplo n.º 10
0
//落子合法性检查
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;
}
Exemplo n.º 11
0
Arquivo: E.c Projeto: geeeqie/codes
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;
}
Exemplo n.º 12
0
Arquivo: E.c Projeto: geeeqie/codes
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;
}
Exemplo n.º 13
0
Arquivo: E.c Projeto: geeeqie/codes
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;
}
Exemplo n.º 14
0
Arquivo: E.c Projeto: geeeqie/codes
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;
}