틱택토 게임(tic-tae-toe)
- 최초 등록일
- 2008.05.07
- 최종 저작일
- 2007.11
- 5페이지/ 한컴오피스
- 가격 2,000원
소개글
틱택토 게임입니다.
목차
1. TIC-TAE-TOE 게임
2. 실행결과
본문내용
1. TIC-TAE-TOE 게임
#include <stdio.h>
#define SPACE ` `
char board[3][3] = {SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE, SPACE};
void display_matrix(void); // matrix를 그리는 함수
void playerO_move(void); // 플레이어 O 차례를 처리하는 함수
void playerX_move(void); // 플레이어 X 차례를 처리하는 함수
char check_winner(void); // 승자를 체크하는 함수
int main()
{
int count=0;
while( check_winner()!=`O`|| check_winner()!=`X`)
{
count+=1;
display_matrix();
playerO_move();
check_winner();
if(check_winner()==`O`)
{
display_matrix();
printf("플레이어(O)이 승리했습니다. \n\n");
break;
}
else if(count==9)
{
display_matrix();
printf("게임이 비겼습니다. \n\n");
break;
}
else
{
display_matrix();
playerX_move();
check_winner();
count+=1;
if(check_winner()==`X`)
{
display_matrix();
printf("플레이어(X)가 승리했습니다. \n\n");
break;
}
}
}
참고 자료
없음