src/chess/rules.c

changeset 87
d4d67105d4e1
parent 80
b980a7192b5a
equal deleted inserted replaced
86:f187e97f845e 87:d4d67105d4e1
182 case KING: return 'K'; 182 case KING: return 'K';
183 default: return '\0'; 183 default: return '\0';
184 } 184 }
185 } 185 }
186 186
187 unsigned char* getpieceunicode(uint8_t piece) { 187 char* getpieceunicode(uint8_t piece) {
188 switch (piece & PIECE_MASK) { 188 switch (piece & PIECE_MASK) {
189 case PAWN: return "\u265f"; 189 case PAWN: return "\u265f";
190 case ROOK: return "\u265c"; 190 case ROOK: return "\u265c";
191 case KNIGHT: return "\u265e"; 191 case KNIGHT: return "\u265e";
192 case BISHOP: return "\u265d"; 192 case BISHOP: return "\u265d";
535 uint8_t candidatecount; 535 uint8_t candidatecount;
536 if (get_threats(gamestate, row, file, color, candidates, &candidatecount)) { 536 if (get_threats(gamestate, row, file, color, candidates, &candidatecount)) {
537 537
538 bool result = false; 538 bool result = false;
539 uint8_t kingfile = 0, kingrow = 0; 539 uint8_t kingfile = 0, kingrow = 0;
540 for (uint8_t row = 0 ; row < 8 ; row++) { 540 for (uint8_t r = 0 ; r < 8 ; r++) {
541 for (uint8_t file = 0 ; file < 8 ; file++) { 541 for (uint8_t f = 0 ; f < 8 ; f++) {
542 if (gamestate->board[row][file] == (color|KING)) { 542 if (gamestate->board[r][f] == (color|KING)) {
543 kingfile = file; 543 kingfile = f;
544 kingrow = row; 544 kingrow = r;
545 } 545 }
546 } 546 }
547 } 547 }
548 548
549 for (uint8_t i = 0 ; i < candidatecount ; i++) { 549 for (uint8_t i = 0 ; i < candidatecount ; i++) {

mercurial