#include char pole[8][8]; int mode=-1; // 0 = white, 1 = black int next=0; void readpos() { char a,b,c; int x; int y; a=fgetc(stdin); b=fgetc(stdin); if ((a>='A')&&(a<='Z')) { c=fgetc(stdin); x=b-'a'; y=c-'1'; if (mode==0) pole[x][y]=a; else pole[x][y]=a+('a'-'A'); } else { x=a-'a'; y=b-'1'; if (mode==0) pole[x][y]='P'; else pole[x][y]='p'; } a=fgetc(stdin); if (a==',') { next=0; } else { next=1; } } void drop(int _a) { int i; for(i=0;i<_a;i++) fgetc(stdin); } int main() { char c; int i,j; int wh=0; for(j=0;j<8;j++) { for(i=0;i<8;i++) { pole[i][j]=(wh==0)?':':'.'; wh=(wh+1)%2; } wh=(wh+1)%2; } printf ("\n"); for(i=0;i<2;i++) { c=fgetc(stdin); switch(c){ case 'W': mode=0; next=0; drop(6); while(next==0) { readpos(); } break; case 'B': mode=1; next=0; drop(6); while(next==0) { readpos(); } break; case 'h': mode=0; next=0; drop(5); while(next==0) { readpos(); } break; case 'l': mode=1; next=0; drop(5); while(next==0) { readpos(); } break; } } wh=0; for(j=7;j>=0;j--) //for(j=0;j<8;j++) { printf("+---+---+---+---+---+---+---+---+\n"); for(i=0;i<8;i++) // for(i=7;i>=0;i--) { if (wh==0) printf("|.%c.",pole[i][j]); else printf("|:%c:",pole[i][j]); wh=(wh+1)%2; } wh=(wh+1)%2; printf("|\n"); } printf("+---+---+---+---+---+---+---+---+\n"); return 0; }