用户:
十三月的季节查看:0 回复:4 评论:0 创建时间:2019-06-05T18:12:20
#include<stdio.h>
void drawmap( int playerx, int playery)
{
for( int i = 0; i < 10; i++)
{
for( int j = 0; j < 10; j++)
{
if( (j == 0) | (j == 9) )
{
printf("|");
}else if( (i == 0) | (i == 9) ){
printf("=");
}else{
if( ( playerx == j ) & ( playery == i ) )
{
printf("!");
}else{
printf(" ");
}
}
}
printf("\n");
}
}
int main()
{
int x = 1;
int y = 9;
char count = 'n';
while( !(count == 'e') ){
drawmap(x, (10 - y));
count = getchar();
if( count == 'u')
{
y++;
}
if( count == 'd')
{
y--;
}
if( count == 'l')
{
x--;
}
if( count == 'r')
{
x++;
}
}
return 1;
}