Commit f32479bd authored by Radia EL HAMDOUNI's avatar Radia EL HAMDOUNI

added fen notation

parent e93caa1c
#include<stdio.h>
int side;
void fen(char *my_fen){
// first reset the board
reset();
for(int i = 0 ; i<8 ; i++){ //loop over the ranks
for(int j=0;j<16;j++ ){ // loop over the files
int square = 16 * i + j;
// first part of fen
if(!(square & 0x88)){
if((*my_fen >= 'a' && *my_fen <= 'z')|| (*my_fen >= 'A' && *my_fen <= 'Z') ){
board[square] = char_pieces[*my_fen];
*my_fen++;
}
if(*my_fen >= '0' && *my_fen <= '8'){
j += *my_fen-'0';
*my_fen++;
}
if(*my_fen=='/'){
*my_fen++;
}
}
}
}
*my_fen++;
// second part of FEN
if(*my_fen == 'w'){
side = white;
}
else{
side = black;
}
show_board();
// castling
// en passant
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment