JAVA 프로그래밍

문제

WASD키를 이용하여 캐릭터를 상하좌우로 이동시키는 문제입니다 이를 해결하는 다음 프로그램에 대해 빈칸을 채우세요 1행, 9행, 1열, 16열을 기준으로 벽이 있으므로, 캐릭터는 2행부터 8행 사이, 2열부터 15열 사이에서 이동할 수 있습니다.
WASD와 [Enter]를 입력하세요: a WASD와 [Enter]를 입력하세요: q

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

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

코드 빈칸 채우기

 .; 
	 
public class CharacterMovement 
{ 
	public static void main( String[] args ) { 
		 scan =  (  ); 
		int row = 0, column = 9; 
		( " \033[44m                  \033[0m" ); 
		( row < 8 ) 
			( "\n \033[44m   \033[0m              \033[44m   \033[0m" ); 
		( "\n \033[44m                  \033[0m" ); 
		 
		char direction = 'w'; 
		 { 
			( " \033["  row  ";"  column  "f  " ); 
			( direction ) { 
				 'w':  'W':  
					row = ( row  2 )  2 : row  1; 
					; 
				 'a':  'A':  
					column = ( column  3 )  3 : column  1; 
					; 
				 's':  'S':  
					row = ( 8  row )  8 : row  1; 
					; 
				 'd':  'D':  
					column = ( 14  column )  14 : column  1; 
					; 
			} 
			( " \033["  row  ";"  column  "f옷" ); 
	 
			( " \033[10;1f \033[2KWASD와 [Enter]를 입력하세요: " ); 
			direction = scan.().(0); 
		} ( ( direction  'W' )  ( direction  'A' )  ( direction  'S' )  ( direction  'D' ) 
		         ( direction  'w' )  ( direction  'a' )  ( direction  's' )  ( direction  'd' ) ); 
		scan.close(); 
	} 
}