#include<iostream>
#include<windows.h>
#include <conio.h>
using namespace std;
int m[11][11]={
	1,1,1,1,1,1,1,1,1,1,1,
	1,0,0,0,0,0,0,0,0,0,1,
	1,0,0,0,0,0,0,0,0,0,1,
	1,0,0,0,0,0,0,0,0,0,1,
	1,0,0,0,0,0,0,0,0,0,1,
	1,0,0,0,0,0,0,0,0,0,1,
	1,0,0,0,0,0,0,0,0,0,1,
	1,0,0,0,0,0,0,0,0,0,1,
	1,0,0,0,0,0,0,0,0,0,1,
	1,0,0,0,0,0,0,0,0,0,1,
	1,1,1,1,1,1,1,1,1,1,1,
};
void print(int dx,int dy){
	for(int i=0;i<=10;i++){
		for(int j=0;j<=10;j++){
			if(i==dx&&j==dy)cout<<"P";
			else if(m[i][j]==1)cout<<"1";
			else cout<<" ";
			cout<<" ";
		}
		cout<<endl;
	}
}
int main() {
	int x=1,y=1;
    while(true){
        system("cls");
        print(x,y);
        cout << "(" << x<< ", " <<y << ")" << endl;
        char c= _getch();
        if(c=='a'&&m[x][y-1]!=1){y--;}
        else if(c=='d'&&m[x][y+1]!=1){y++;}
        else if(c=='w'&&m[x-1][y]!=1){x--;}
        else if(c=='s'&&m[x+1][y]!=1){x++;}
        Sleep(50);
    }
    
    return 0;
}