본문내용
SIZE || y<0 || y>=MAPSIZE) return OK;
if(xy[y][x]==OtherPlayer) return OK;
if(xy[y][x]==NONE) return NO;
cnt=0;
result=NO;
map[y][x]=OK;
if(TestFlag(x,y-1)==FLAGFALSE) {
if(SefeDeleteTest(x,y-1,OtherPlayer)) {
cnt=cnt + 1;
}
} else {
cnt=cnt+1;
}
if(TestFlag(x-1,y)==FLAGFALSE) {
if(SefeDeleteTest(x-1,y,OtherPlayer)) {
cnt=cnt + 1;
}
} else {
cnt=cnt+1;
}
if(TestFlag(x+1,y)==FLAGFALSE) {
if(SefeDeleteTest(x+1,y,OtherPlayer)) {
cnt=cnt + 1;
}
} else {
cnt=cnt+1;
}
if(TestFlag(x,y+1)==FLAGFALSE) {
if(SefeDeleteTest(x,y+1,OtherPlayer)) {
cnt=cnt + 1;
}
} else {
cnt=cnt+1;
}
if(IsKill(cnt)){
result=OK;
}
return result;
}
void DolDelete(int x,int y,int OtherPlayer)
{
if(x<0 || x>=MAPSIZE || y<0 || y>=MAPSIZE) return;
if(xy[y][x]==OtherPlayer) return;
if(xy[y][x]==NONE) return;
xy[y][x]=CLEAR;
if(x+1
if(x-1>=0) DolDelete(x-1,y,OtherPlayer);
if(y+1
if(y-1>=0) DolDelete(x,y-1,OtherPlayer);
}
void RalDeleteTest(int x,int y,int OtherPlayer)
{
clearValue();
if(SefeDeleteTest(x+1,y,OtherPlayer)==YES)
DolDelete(x+1,y,OtherPlayer);
clearValue();
if(SefeDeleteTest(x-1,y,OtherPlayer)==YES)
DolDelete(x-1,y,OtherPlayer);
clearValue();
if(SefeDeleteTest(x,y+1,OtherPlayer)==YES)
DolDelete(x,y+1,OtherPlayer);
clearValue();
if(SefeDeleteTest(x,y-1,OtherPlayer)==YES)
DolDelete(x,y-1,OtherPlayer);
}
void input(int Player)
{
char c;
int LOOP=START;
int OtherPlayer;
if(Player == PLAYER1) {
OtherPlayer = PLAYER2;
} else {
OtherPlayer = PLAYER1;
}
while(LOOP!=END){
c = getch();
switch(c)
{
case RIGHT:
x=x+1;
if(x >= MAPSIZE) x=x-1;
gotoxy(x,y);
break;
case LEFT:
x=x-1;
if(x < 0 ) x=x+1;
gotoxy(x,y);
break;
case UP:
y=y-1;
if(y < 0 ) y=y+1;
gotoxy(x,y);
break;
case DOWN:
y=y+1;
if(y >= MAPSIZE ) y=y-1;
gotoxy(x,y);
break;
case ENTER:
if(xy[y][x] != NONE ) break;
xy[y][x]=Player;
RalDeleteTest(x,y,Player);
clearValue();
if(SefeDeleteTest(x,y,OtherPlayer)==YES){
xy[y][x]=CLEAR;
} else {
LOOP = END;
}
}
}
}
void printScreen()
{
system("cls");
int x,y,n;
char c[3];
for(y=0;y
for(x=0;x
if(xy[y][x] == PLAYER1) {
printf("○");
} else if(xy[y][x] == PLAYER2 ) {
printf("●");
} else if(xy[y][x] == NONE ) {
n=(x+16)/17+(y+16)/17*3;
c[0]=mapChar[n*2];
c[1]=mapChar[n*2+1];
c[2]=0;
if((x-3)%6==0 && (y-3)%6==0) {
strcpy(c,"×");
}
printf("%s",c);
}
}
printf("\n");
}
gotoxy(displayX,displayLineY);
printf("UP:T DOWN:G LEFT:F RIGHT:H ENTER:Q");
}
int gamePlayCheck(int Player)
{
return 1;
}
void InitMapData()
{
int x,y;
for(y=0;y
for(x=0;x
xy[y][x]=CLEAR;
}
}
}
void SetCursorShow(void)
{
HANDLE hConsole;
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_CURSOR_INFO ci;
GetConsoleCursorInfo( hConsole, &ci );
ci.dwSize=100;
ci.bVisible = TRUE;
SetConsoleCursorInfo( hConsole , &ci );
}
void gotoxy(int x , int y)
{
COORD Pos = { x*2 , y};
SetConsoleCursorPosition(GetStdHandle( STD_OUTPUT_HANDLE), Pos);
}
if(xy[y][x]==OtherPlayer) return OK;
if(xy[y][x]==NONE) return NO;
cnt=0;
result=NO;
map[y][x]=OK;
if(TestFlag(x,y-1)==FLAGFALSE) {
if(SefeDeleteTest(x,y-1,OtherPlayer)) {
cnt=cnt + 1;
}
} else {
cnt=cnt+1;
}
if(TestFlag(x-1,y)==FLAGFALSE) {
if(SefeDeleteTest(x-1,y,OtherPlayer)) {
cnt=cnt + 1;
}
} else {
cnt=cnt+1;
}
if(TestFlag(x+1,y)==FLAGFALSE) {
if(SefeDeleteTest(x+1,y,OtherPlayer)) {
cnt=cnt + 1;
}
} else {
cnt=cnt+1;
}
if(TestFlag(x,y+1)==FLAGFALSE) {
if(SefeDeleteTest(x,y+1,OtherPlayer)) {
cnt=cnt + 1;
}
} else {
cnt=cnt+1;
}
if(IsKill(cnt)){
result=OK;
}
return result;
}
void DolDelete(int x,int y,int OtherPlayer)
{
if(x<0 || x>=MAPSIZE || y<0 || y>=MAPSIZE) return;
if(xy[y][x]==OtherPlayer) return;
if(xy[y][x]==NONE) return;
xy[y][x]=CLEAR;
if(x+1
if(y+1
}
void RalDeleteTest(int x,int y,int OtherPlayer)
{
clearValue();
if(SefeDeleteTest(x+1,y,OtherPlayer)==YES)
DolDelete(x+1,y,OtherPlayer);
clearValue();
if(SefeDeleteTest(x-1,y,OtherPlayer)==YES)
DolDelete(x-1,y,OtherPlayer);
clearValue();
if(SefeDeleteTest(x,y+1,OtherPlayer)==YES)
DolDelete(x,y+1,OtherPlayer);
clearValue();
if(SefeDeleteTest(x,y-1,OtherPlayer)==YES)
DolDelete(x,y-1,OtherPlayer);
}
void input(int Player)
{
char c;
int LOOP=START;
int OtherPlayer;
if(Player == PLAYER1) {
OtherPlayer = PLAYER2;
} else {
OtherPlayer = PLAYER1;
}
while(LOOP!=END){
c = getch();
switch(c)
{
case RIGHT:
x=x+1;
if(x >= MAPSIZE) x=x-1;
gotoxy(x,y);
break;
case LEFT:
x=x-1;
if(x < 0 ) x=x+1;
gotoxy(x,y);
break;
case UP:
y=y-1;
if(y < 0 ) y=y+1;
gotoxy(x,y);
break;
case DOWN:
y=y+1;
if(y >= MAPSIZE ) y=y-1;
gotoxy(x,y);
break;
case ENTER:
if(xy[y][x] != NONE ) break;
xy[y][x]=Player;
RalDeleteTest(x,y,Player);
clearValue();
if(SefeDeleteTest(x,y,OtherPlayer)==YES){
xy[y][x]=CLEAR;
} else {
LOOP = END;
}
}
}
}
void printScreen()
{
system("cls");
int x,y,n;
char c[3];
for(y=0;y
printf("○");
} else if(xy[y][x] == PLAYER2 ) {
printf("●");
} else if(xy[y][x] == NONE ) {
n=(x+16)/17+(y+16)/17*3;
c[0]=mapChar[n*2];
c[1]=mapChar[n*2+1];
c[2]=0;
if((x-3)%6==0 && (y-3)%6==0) {
strcpy(c,"×");
}
printf("%s",c);
}
}
printf("\n");
}
gotoxy(displayX,displayLineY);
printf("UP:T DOWN:G LEFT:F RIGHT:H ENTER:Q");
}
int gamePlayCheck(int Player)
{
return 1;
}
void InitMapData()
{
int x,y;
for(y=0;y
}
}
}
void SetCursorShow(void)
{
HANDLE hConsole;
hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_CURSOR_INFO ci;
GetConsoleCursorInfo( hConsole, &ci );
ci.dwSize=100;
ci.bVisible = TRUE;
SetConsoleCursorInfo( hConsole , &ci );
}
void gotoxy(int x , int y)
{
COORD Pos = { x*2 , y};
SetConsoleCursorPosition(GetStdHandle( STD_OUTPUT_HANDLE), Pos);
}
추천자료
c언어로 구구단(2단~9단)출력하는 프로그램
java 프로그래밍을 이용한 타자 프로그램 프로젝트 세부 리포트
[C언어]심리테스트 및 소수구하는 프로그램
자바 서버 클라이언트 소켓이용 간단한 채팅프로그램
제곱을 매크로로 만들어 원의 정보를 구하는 프로그램
C언어 연결리스트 파일입출력 을 이용한 관리 프로그램
Linked list를 이용한 학생정보관리 프로그램
C# 으로 만든 채팅 & 파일전송 프로그램 & 보고서
Microsoft Visual C++을 이용한 DES 프로그램
[자바]DB를 이용한 인원관리 프로그램
c++ 레포트-나이에 따라 동물원 입장료 계산 프로그램
영양 분석 및 설계 프로그램
[C/C++] 간단한 파일 전송 프로그램
소개글