문제 1초마다 비트가 아래로 떨어지면, A(왼쪽),S(중앙),D(오른쪽) 중 하나를 입력받아 맞추는 문제입니다 이를 해결하는 다음 프로그램에 대해 빈칸을 채우세요 OOOOO
OOOOO
OOOOO
OOOOO
OOOOO
A S D
A,S,D 중 하나를 입력하고 엔터치세요: s
OOOOO
OOOOO
OOOOO
OOOOO
Good!
A S D
A,S,D 중 하나를 입력하고 엔터치세요: d
OOOOO
OOOOO
OOOOO
OOOOO
Good!
A S D
A,S,D 중 하나를 입력하고 엔터치세요: quit
OOOOO
OOOOO
OOOOO
OOOOO
OOOOO
A S D
A,S,D 중 하나를 입력하고 엔터치세요: d
OOOOO
OOOOO
OOOOO
OOOOO
Miss!
A S D
A,S,D 중 하나를 입력하고 엔터치세요: s
OOOOO
OOOOO
OOOOO
OOOOO
Miss!
A S D
A,S,D 중 하나를 입력하고 엔터치세요: quit
코드 빈칸 채우기 import java.util.Scanner;
Beat {
private int index;
private String[][] beat = {
{ " ", " ", " " },
{ " ", " ", " " },
{ " ", " ", " " },
{ " ", " ", " " },
{ " ", " ", " " },
{ " ", " ", "OOOOO" },
{ " ", "OOOOO", " " },
{ " ", "OOOOO", " " },
{ "OOOOO", " ", " " },
{ " ", " ", "OOOOO" },
{ " ", "OOOOO", " " },
{ " ", " ", " " },
{ " ", " ", " " },
{ " ", " ", " " },
{ " ", " ", " " },
};
void () {
{
System.out.println( "\033[6;1f A S D " );
( index = beat.length-1; index > 3; index-- ) {
System.out.print( "\033[1;1f" );
System.out.println( beat[index-4][0] + beat[index-4][1] + beat[index-4][2] );
System.out.println( beat[index-3][0] + beat[index-3][1] + beat[index-3][2] );
System.out.println( beat[index-2][0] + beat[index-2][1] + beat[index-2][2] );
System.out.println( beat[index-1][0] + beat[index-1][1] + beat[index-1][2] );
System.out.println( beat[index ][0] + beat[index ][1] + beat[index ][2] );
System.out.println( "\033[7;1f\033[7;40f" );
System.out.flush();
. ( 1000 );
}
System. (0);
} ( e ) {
}
}
void hit() {
Scanner scan = Scanner( System.in );
String in = "";
{
( ( in.equals("A") || in.equals("a") ) && beat[index][0].equals("OOOOO") )
System.out.println( "\033[5;1fGood!");
( in.equals("A") || in.equals("a") )
System.out.println( "\033[5;1fMiss!");
( ( in.equals("S") || in.equals("s") ) && beat[index][1].equals("OOOOO") )
System.out.println( "\033[5;6fGood!");
( in.equals("S") || in.equals("s") )
System.out.println( "\033[5;6fMiss!");
( ( in.equals("D") || in.equals("d") ) && beat[index][2].equals("OOOOO") )
System.out.println( "\033[5;11fGood!");
( in.equals("D") || in.equals("d") )
System.out.println( "\033[5;11fMiss!");
System.out.flush();
System.out.print( "\033[7;1fA,S,D,Q(uit)중 하나를 입력하고 엔터치세요: " );
in =
scan.nextLine();
} ( in.equals("a") || in.equals("s") || in.equals("d") || in.equals("A") || in.equals("S") || in.equals("D") );
scan.close();
}
}
RhythmGame
{
public static void main( String[] args ) {
Beat beat = Beat();
thread = ( beat );
thread. ();
beat.hit();
}
}