#include "head.h"

char input_(char *_input, char *charsInInput){
    
    // INPUT
    do{
    *charsInInput = 0;
        char ch;
        while((ch=getchar())>' '&&*charsInInput<CHARS_IN_INPUT_MAX){
            *(_input+*charsInInput)=ch;
            (*charsInInput)++;
        }
        if(ch<= 4)return -1;
        if(*_input>= '0' && *_input<='9'){
            for(int i = 0;i<*charsInInput;i++)
                putchar(_input[i]);
            putchar(' ');
            continue;}
        if((*_input>= 'A' && *_input<='A'+7) ||
            (*_input>= 'a' && *_input<='a'+7)||
            (*_input=='N'||*_input=='Q'||*_input=='R'||*_input=='K'||*_input=='P')){
            for(int i = 0;i<*charsInInput;i++)
                putchar(_input[i]);
            putchar('\n');  
            break;}

    }while(*_input>4);

    return 0;
}

void print_board(char* _board){
    for (int i = 0;i<8;i++){
        putchar('8'-i);
        putchar(' ');
        for(int j = 0;j<8;j++){
            putchar(_board[i*8+j]);
            putchar(' ');
        }
        putchar('\n');
    }
    putchar(' ');putchar(' ');
    for(int i = 0; i<8;i++){
        putchar('a'+i);
        putchar(' ');
    }
    putchar('\n');
    putchar('\n');
    return;
}
