오목질문입니다!!
콩순
질문 제목 : 오목질문입니다!질문 요약 :제가 궁금한 부분은 지금 이 소스에서 검은or흰 돌을 놓았을때 그위에 또 돌을 놓아지지 않게 하고싶어요!!
그리고 그냥 커서를 표시하기 위해 별모양을 했는데 별모양이 막 찍히기도 합니다.. 왜그런 것일까요?!! 가르쳐주세요! 질문 내용 :
#include stdio.h
#include windows.h
#include conio.h
#define right 77
#define left 75
#define up 72
#define down 80
#define enter 13
void draw();
void move();
void gotoxy();
//void check();
void game();
int x=16,y=8;
char xy[32][16];
char stone[3][3] = {, ○,●};
int a=1;
int main()
{
game();
while(1)
move();
return 0;
}
void game()
{
int i,j;
for(i=0;i=15;i++)
{
for(j=0;j=15;j++)
{
printf(┼);
}
printf(\n);
}
}
void gotoxy(int x, int y)
{
coord xy = {x, y};
setconsolecursorposition(getstdhandle(std_output_handle), xy);
}
void move()
{char c;
c = getch();
switch(c)
{
case right:
{
if(x 30)
{
x = x+2;
gotoxy(x,y);
printf(★);
}
gotoxy(x-2,y);
if(xy[x-2][y]==0)
printf(┼);
break;
}
case left:
{
if(x0)
{
x = x-2;
gotoxy(x,y);
printf(★);
}
gotoxy(x+2,y);
if(xy[x+2][y]==0)
printf(┼);break;}
case up:/se up:
{
if(y0)
{
y = y-1;
gotoxy(x,y);
printf(★);
}
gotoxy(x,y+1);
if(xy[x][y+1]==0)
printf(┼);
break;}
case down:
{
if(y15)
{
y = y+1;
gotoxy(x,y);
printf(★);
}
gotoxy(x,y-1);
if(xy[x][y-1]==0)
printf(┼);
break;}
case enter:
{
xy[x][y]=a;
gotoxy(x,y);
if(xy[x][y]!=0)
printf(%s,stone[a]);
a++;
if(a==3) a=1;
}
}
}