This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const base xMask = 0x000000000000ffff; | |
const base constant = 0x0001000100010001; | |
const base yMask = (constant << 192) | (constant << 128) | (constant << 64) | constant; | |
const base constantBlock = 0x000f000f000f000f; | |
const base blockMask[16] = { ((constantBlock << 0) << 0), ((constantBlock << 4) << 0), ((constantBlock << 8) << 0), ((constantBlock << 12) << 0), | |
((constantBlock << 0) << 64), ((constantBlock << 4) << 64), ((constantBlock << 8) << 64), ((constantBlock << 12) << 64), | |
((constantBlock << 0) << 128), ((constantBlock << 4) << 128), ((constantBlock << 8) << 128), ((constantBlock << 12) << 128), | |
((constantBlock << 0) << 192), ((constantBlock << 4) << 192), ((constantBlock << 8) << 192), ((constantBlock << 12) << 192)}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Board::set(int coordinate, int c){ | |
for (int i = 0; i < 16; ++i){ | |
cells[i][coordinate] = false; | |
} | |
base mask = 0; | |
int x = coordinate /16, y = coordinate %16, block; | |
mask |= (xMask << (x*16)); | |
mask |= (yMask << y); | |
block = (x/4)*4 + y/4; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool Board::isFinish(){ | |
return (~(OR(confirmedCells)) == 0); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool Board::checkError(){ | |
return (~(OR(cells)) != 0); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
typedef int color; | |
const color white = 0; | |
const color black = 1; | |
const color empty = -1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uint64 o = (cells[c] & 0x7F7F7F7F7F7F7F7F) << 1, | |
p = cells[1-c] & 0xFEFEFEFEFEFEFEFE; | |
uint64 left = (~(p | o) & (p + o)) & 0xFEFEFEFEFEFEFEFE; |