#include <stdio.h>
#include <conio.h>
#include <stdlib.h>
int main()
{
int x = 0;
int y = 0;
int px = 5;
int py = 5;
bool isp = true;
char input;
while ((input = _getch()))
{
switch (input)
{
case 'w': if (y > 0)y--; break;
case 's': if (true)y++; break;
case 'a': if (x > 0)x--; break;
case 'd': if (true)x++; break;
}
// redraw
system("cls");
printf("Simple Game\n");
for (int i = 0; i < 10; i++)
{
for (int j = 0; j < 10; j++)
{
if (i == y && j == x)
{
printf("o");
}
else
{
if (j == px && i == py && isp)
{
printf("x");
}
printf(" ");
}
}
printf("\n");
}
if (x == px && y == py && isp)
{
printf("you pick up the box");
isp = false;
}
}
return 0;
}