#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
int main(void) {
char board[10][10] = { {'#', '#', '#', '#', '.', '.', '.', '.', '.', '.' },
{'.', '.', '.', '.', '.', '#', '.', '.', '.', '.' },
{'#', '#', '#', '.', '#', '.', '.', '.', '.', '.' },
{'.', '.', '#', '.', '.', '#', '.', '.', '.', '.' },
{'.', '.', '#', '.', '.', '#', '.', '.', '.', '.' },
{'.', '.', '#', '.', '.', '#', '.', '.', '.', '.' },
{'.', '.', '.', '#', '.', '.', '#', '#', '.', '.' },
{'.', '.', '.', '.', '#', '.', '.', '.', '#', '#' },
{'.', '.', '.', '.', '.', '#', '.', '.', '.', '.' },
{'.', '.', '.', '.', '.', '#', '#', '#', '#', '#' } };
int xpos = 0, ypos = 1;
board[ypos][xpos] = '@';
// »ç¿ëÀڷκÎÅÍ À§Ä¡¸¦ ¹Þ¾Æ¼ º¸µå¿¡ Ç¥½ÃÇÑ´Ù.
while (1) {
system("cls");
printf("¿ÞÂÊÀ̵¿:<-, ¿À¸¥ÂÊ À̵¿:-> À§ÂÊ À̵¿:^, ¾Æ·¡ÂÊ À̵¿:V\n");
for (int y = 0; y < 10; y++) {
for (int x = 0; x < 10; x++) printf("%c", board[y][x]);
printf("\n");
}
board[ypos][xpos] = '.';
int ch = _getch();
if (ch == 224) {
int ch2 = _getch();
if (ch2 == 75) xpos--;
else if (ch2 == 80) ypos++;
else if (ch2 == 72) ypos--;
else if (ch2 == 77) xpos++;
}
board[ypos][xpos] = '@';
}
return 0;
}