新年第一个程序三子棋小游戏C语言数组实现腾讯新闻

char board[ROW][COL] = { 0 };//二维数组的初始化并没有这么简单

printf(“——————————-\n”);

printf(“——————————-\n”);

printf(“—-1.play 0.exit——–\n”);

printf(“——————————-\n”);

printf(“——————————-\n”);

void InitBoard(char board[ROW][COL], int row, int col)

void DisplayBoard(char board[ROW][COL], int row, int col)

void PlayerMove(char board[ROW][COL], int row, int col)

if (board[x - 1][y - 1] == ' ')

board[x - 1][y - 1] = 'X';

void ComputerMove(char board[ROW][COL], int row, int col)

if (board[x - 1][y - 1] == ' ')

board[x - 1][y - 1] = 'O';

int IsFull(char board[ROW][COL], int row, int col)

char Iswin(char board[ROW][COL], int row, int col)

if (board[i][0] == board[i][1] && board[i][1] == board[i][2] && board[i][1] != ' ')

return board[i][0];//Iswin直接结束

if (board[0][i] == board[1][i] && board[1][i] == board[2][i] && board[1][i] != ' ')

if (board[0][0] == board[1][1] && board[1][1] == board[2][2] && board[1][1] != ' ')

if (board[0][2] == board[1][1] && board[1][1] == board[2][0] && board[1][1] != ' ')

srand((unsigned int)time(NULL));//扩大电脑走的随机值范围


新年第一个程序三子棋小游戏C语言数组实现腾讯新闻

您可以选择一种方式赞助本站

    A+
发布日期:2021年02月20日  所属分类:游戏
标签:

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: