#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <conio.h>
using namespace std;
class Player
{
private:
	char scin;
	unsigned int X;
	unsigned int Y;
public:
	void Move(char M)
	{
		if ((Y > 0) and (M == 'w'))
		{
			Y = Y + 1;
		}
		if ((Y < 2) and (M == 's'))
		{
			Y = Y - 1;
		}
		if ((X > 0) and (M == 'a'))
		{
			X = X - 1;
		}
		if ((X < 0) and (M == 'd'))
		{
			X = X + 1;
		}
	}
	void Show(char N)
	{
		system("cls");
		char mapp[3][3] = {
			{ N, N, N },
		    { N, N, N },
		    { N, N, N }
		};
		mapp[X][Y] = '_';
		for (int i = 0; i < 3; i++)
		{
			for (int z = 0; z < 3; z++)
			{
				cout << mapp[i][z];
			}
		}
		mapp[X][Y] = N;
	}
};
int main()
{
		Player First;
		int key;
		key = _getch();
		while (true)
		{
		if (key == 87)
		{
			First.Move('w');
			First.Show(' ');
		}
		if (key == 83)
		{
			First.Move('s');
			First.Show(' ');
		}
		if (key == 68)
		{
			First.Move('d');
			First.Show(' ');
		}
		if (key == 65)
		{
			First.Move('a');
			First.Show(' ');
		}
	}
	system("PAUSE");
	return 0;
}