fixup
This commit is contained in:
5
chess.c
5
chess.c
@@ -6,6 +6,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
#define E 0 /* empty */
|
||||
#define K 1 /* king */
|
||||
#define Q 2 /* queen */
|
||||
@@ -23,6 +24,7 @@ void print_board(int* board);
|
||||
void init_board(int* board);
|
||||
void do_turn(int turn_no, int* board);
|
||||
|
||||
|
||||
/*
|
||||
* main
|
||||
*/
|
||||
@@ -190,13 +192,12 @@ int get_piece(char *str){
|
||||
|
||||
if( 'A' <= c && c <= 'H' ){
|
||||
x = c - 'A';
|
||||
}else if( '1' <= c && c <= '8'){
|
||||
}else if('1' <= c && c <= '8'){
|
||||
y = c - '1';
|
||||
}
|
||||
}
|
||||
|
||||
if(x != -1 && y != -1){
|
||||
printf("%i", 8*(8-y) + x);
|
||||
return 8*(7-y) + x;
|
||||
}else{
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user