//all i want to do here is zachytat board// #include #include #include void readboard(char); void nextmove(char arr[3][3],char); void print_board(char arr[3][3]); char arr[3][3]; void main() { char choice,t,turn; printf("please enter a c for checkers or t for tic-tac-toe \n"); scanf("%c",&choice); if(choice=='t') readboard(t); else exit(1); printf("enter x for ""x"" and o for ""o""\n"); scanf(" %c",&turn); printf("you entered %c\n",turn); // getchar(); //getchar(); nextmove(arr,turn); exit(1); } void readboard(char t) { int i,j,m=0; printf("\nenter a board 3 lines by 3 characters, either x, o or -\n"); printf("after each line hit enter\n"); printf("enter a board\n\n"); for(i=0;i<=2;i++) for(j=0;j<=2;j++){ scanf(" %c",&arr[i][j]);//x, o or - from input are stored //in two-dimentional array } printf("\n"); printf("this is a board\n\n"); print_board(arr); } void nextmove(char arr[3][3],char turn){ int i,j; print_board(arr); for(i=0;i<=2;i++) for(j=0;j<=2;j++){ //tyt ya must call eto recursively, ya tak ponimau if(arr[i][j]=='-'){ printf("\nPossible result\n"); arr[i][j]=turn; print_board(arr); arr[i][j]='-'; } printf("\n"); } } void print_board(char arr[3][3]){ int i,j; for(i=0;i<=2;i++){ for(j=0;j<=2;j++) printf("%c",arr[i][j]); printf("\n"); } }