源码:[mw_shl_code=c,true]#include <stdio.h>
#include <stdlib.h>
#define N 15
int chessboard[N + 1][N + 1] = { 0 };
int whoseTurn = 0;
void initGame(void);
void printChessboard(void);
void playChess(void);
int judge(int, int);
int main(void)
{
initGame();
while (1)
{
whoseTurn++;
playChess();
}
return 0;
}
void initGame(void)
{
char c;
printf("-------------GOMOKU 1.0.0-------------\n");
printf(" Box Company \n");
printf("Press any key to enter the game... \n");
getch();
system("cls");
printf("Please input \'y\' to enter the game:");
c = getchar();
if ('y' != c && 'Y' != c)
exit(0);
system("clear");
printChessboard();
}
void printChessboard(void)
{
int i, j;
for (i = 0; i <= N; i++)
{
for (j = 0; j <= N; j++)
{
if (0 == i)
printf("%3d", j);
else if (j == 0)
printf("%3d", i);
else if (1 == chessboard[j])
printf(" O");
else if (2 == chessboard[j])
printf(" X");
else
printf(" *");
}
printf("\n");
}
}
void playChess(void)
{[/mw_shl_code]只开70行源码,往后3啊哈币/行~~~
|