#include <cstdlib>
#include <iostream>
#include <conio.h>
using namespace std;
int ludek_x = 0;
int ludek_y = 0;
bool koniec = false;
char ruch;
char mapa[ 10 ][ 10 ] = {
' ', ' ', ' ', '|', '|', '-', '-', '-', '-', '-',
'|', '-', ' ', '-', '-', ' ', ' ', ' ', ' ', '|',
'|', ' ', ' ', ' ', '|', ' ', ' ', ' ', ' ', '|',
'|', ' ', '-', ' ', '|', ' ', ' ', ' ', ' ', '|',
'|', ' ', '|', ' ', '|', '-', ' ', ' ', ' ', '|',
'|', ' ', '|', ' ', ' ', ' ', ' ', ' ', ' ', '|',
'|', ' ', '|', ' ', ' ', '|', ' ', ' ', ' ', '|',
'|', ' ', '-', ' ', '-', ' ', ' ', ' ', ' ', '|',
'|', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '|',
'|', '-', '-', '-', '-', '-', '-', '-', '-', '-'
};
int main( int argc, char * argv[] )
{
while( !koniec )
{
system( "cls" );
for( int y = 0; y < 10; y++ )
{
for( int x = 0; x < 10; x++ )
{
if( x == ludek_x && y == ludek_y ) cout << "x";
else
cout << mapa[ x ][ y ];
}
cout << "\n";
}
ruch = getch();
switch( ruch )
{
case 'w': if( mapa[ ludek_x ][ ludek_y - 1 ] == ' ' )
--ludek_y;
break;
case 's': if( mapa[ ludek_x ][ ludek_y + 1 ] == ' ' )
++ludek_y;
break;
case 'a': if( mapa[ ludek_x - 1 ][ ludek_y ] == ' ' )
--ludek_x;
break;
case 'd': if( mapa[ ludek_x + 1 ][ ludek_y ] == ' ' )
++ludek_x;
break;
case 'q': koniec = true; break;
}
}
system( "PAUSE" );
return EXIT_SUCCESS;
}