JAVA 프로그래밍

문제

WASD키를 이용하여 캐릭터를 상하좌우로 이동하고 주변 맵을 출력하는 문제입니다 이를 해결하는 다음 프로그램에 대해 빈칸을 채우세요 
WASD와[Enter]를 입력하세요: s
WASD와[Enter]를 입력하세요: q

WASD와[Enter]를 입력하세요: a
WASD와[Enter]를 입력하세요: a
WASD와[Enter]를 입력하세요: x

WASD와[Enter]를 입력하세요: s
WASD와[Enter]를 입력하세요: s
WASD와[Enter]를 입력하세요: q

코드 빈칸 채우기

 java.util.Scanner; 
 move.ObjectOnZoomMap; 
  CharacterMovementOnZoomMap 
{	 
	 static void main( String args[] ) { 
		Scanner scan =  Scanner( System.in ); 
		 
		int[][] map = { 
		               { 1,1,1,1,1,1,1,1,1 }, 
		               { 1,0,0,0,1,0,0,0,1 }, 
		               { 1,1,1,0,1,0,1,1,1 }, 
		               { 1,0,0,0,1,0,0,0,1 }, 
		               { 1,0,1,1,1,1,1,0,1 }, 
		               { 1,0,0,0,0,0,0,0,1 }, 
		               { 1,1,1,1,1,1,1,1,1 }  
		              } ; 
 
		ObjectOnZoomMap character =  
		                             ObjectOnZoomMap( map, 2, 1 ); 
				 
		char direction='d'; 
		 {				 
			character.move( direction ); 
			System.out.println(  
			                    character ); 
			System.out.print( "\033[17;1f\033[2KWASD와[Enter]를 입력하세요: " ); 
			direction= scan.nextLine().charAt(0); 
		} ( ( direction  'W' ) || ( direction  'A' ) || ( direction  'S' ) || ( direction  'D' ) 
		      || ( direction  'w' ) || ( direction  'a' ) || ( direction  's' ) || ( direction  'd' ) ); 
	} 
} 
 
 move; 
 
  ObjectOnMap 
{ 
	 int[][] map; 
	 int x, y, minX, minY, maxX, maxY; 
	 final int LEFT = -1, RIGHT = 1, UP = -1, DOWN = 1, STOP = 0; 
	 final int PATH = 0, WALL = 1, CHARACTER = 2; 
	 final String symbol[] = { "  ", "\033[44m   \033[0m", "옷" }; 
	 ObjectOnMap( int[][] map, int x, int y ) { 
		.map = map; 
		.x = x; 
		.y = y; 
		.minX = 0; 
		.minY = 0; 
		.maxX = ( map  null ) ? 0 : map[0].length-1; 
		.maxY = ( map  null ) ? 0 : map.length-1; 
	} 
 
	 void move( char direction ) { 
		int directionX = STOP, directionY = STOP; 
		( direction ) { 
			 'W':  'w':  
				directionY = UP; 
				; 
			 'A':  'a':  
				directionX = LEFT; 
				; 
			 'S':  's':  
				directionY = DOWN; 
				; 
			 'D':  'd':  
				directionX = RIGHT; 
				; 
		} 
		move( directionX, directionY ); 
	} 
 
	 void move( int directionX, int directionY ) { 
		( map[.y+directionY][.x+directionX]  WALL ) 
			; 
			 
		.x += directionX; 
		.y += directionY; 
		.x = ( .x <= minX ) ? minX : .x; 
		.y = ( .y <= minY ) ? minY : .y; 
		.x = ( .x >= maxX ) ? maxX : .x; 
		.y = ( .y >= maxY ) ? maxY : .y; 
	} 
 
	@Override 
	 String () { 
		String strMap = "\033[1;1f";	 
		( int y = minY; y <= maxY; y++ ) { 
			( int x = minY; x <= maxX; x++ ) { 
				strMap += symbol[ map[y][x] ]; 
			} 
			strMap += "\n"; 
		} 
		 strMap + .appear(); 
	} 
	 
	 String appear() { 
		 "\033[" + (this.y+1) + ";" + (this.x*2+1) + "f"+ symbol[ CHARACTER ]; 
	} 
	 
	 String disappear() { 
		 "\033[" + (this.y+1) + ";" + (this.x*2+1) + "f  "; 
	} 
} 
 move; 
 
  ObjectOnZoomMap extends ObjectOnMap 
{ 
	 static final int SCOPE = 3; 
	 
	 ObjectOnZoomMap( int[][] map, int x, int y ) { 
		( map, x, y ); 
	} 
 
	@Override 
	 String () { 
		String zoomMap = "\033[1;1f";	 
		( int y = .y - SCOPE, offsetY = y; y <= .y + SCOPE; y++ ){ 
			( int x = .x - SCOPE, offsetX = x; x <= .x + SCOPE; x++ ){ 
				int index = WALL; 
				 ( ( x  .x ) && ( y  .y ) ) 
					index = CHARACTER; 
				 ( ( 0 <= x ) && ( x <= maxX ) && ( 0 <= y ) && ( y <= maxY ) ) 
					index = map[y][x]; 
				zoomMap += symbol[ index ]; 
			} 
			zoomMap += "\n"; 
		} 
		 zoomMap; 
	} 
}