#include <stdio.h> #include <stdlib.h>char arr[3][3];void print () {int t; for (t=0;t<3;t++) {printf ("%c|%c|%c|", arr[t][0],arr[t][1],arr[t][2]);p rintf ("\n_|_|_|\n");}} Void init () {int i,j;for (i=0;i<3;i++) {for (j=0;j<3;j++) {arr[i][j]= ' ';}}} Void player_move () {int x,y;printf ("Please enter the coordinates of your chess!"); scanf ("%d%d", &x,&y) x--;y--;if (arr[x][y]!= ' ' ) {printf ("The location is already occupied, please reenter the!!! \ n ");p layer_move ();} else arr[x][y]= ' x ';} Int computer () {int i, j; for (i = 0; i < 3; i++) { for (j = 0; j < 3; j++) { if (arr[i][j] == ' ' ) { arr[i][j]= ' 0 '; break; } } break; }}char check () {int i;for (i=0;i<3;i++) {if (arr[i][0 ]==arr[i][1]&&arr[i][1]==arr[i][2]) {return arr[i][0];}} for (i=0;i<3;i++) {if (Arr[0][i]==arr[1][i]&&arr[1][i]==arr[2][i]) {return arr[0][i];}} if (Arr[0][0]==arr[1][1]&&arr[1][1]==arr[2][2]) {return arr[0][0];} if (Arr[0][2]==arr[1][1]&&arr[1][1]==arr[2][0]) {return arr[0][2];} else {return ' ';}} Int main () {char none;printf ("Welcome to board game!\n"), init ();d o{print ();p layer_move (); None=check (); if (none!= ') ') break;computer (); if (none!= ' ') break;} while (none== ' '), if (none== ' X ') {printf ("Congratulations on winning!\ n ");} ELSE&NBSP;{PRINTF ("Computer wins!\n");} Print ();}
"Fun board Game" write a player-operated function and a two-person board game that the computer can manipulate, which has three connected wins