forked from alexhsamuel/AC3.3
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSignboard.java
More file actions
48 lines (40 loc) · 1.14 KB
/
Copy pathSignboard.java
File metadata and controls
48 lines (40 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package nyc.c4q;
import java.util.Scanner;
public class Signboard {
private int mFrame = 0;
private void printLine(){
System.out.println("IIII");
}
private int playerHorizontalPosition(){
return mFrame % 4;
}
private int playerVerticalPosition(){
return mFrame / 4;
}
public void display() {
if (mFrame == 12){
mFrame = 0;
}
for (int vertical=0; vertical < 3; vertical++){
for (int horizontal=0; horizontal< 4; horizontal++){
if (vertical == playerVerticalPosition() &&
horizontal == playerHorizontalPosition()) {
System.out.print("O");
}
else {
System.out.print("I");
}
}
System.out.print("\n");
}
mFrame++;
}
public static void main(String[] args) throws InterruptedException {
Signboard signboard = new Signboard();
Scanner scanner = new Scanner(System.in);
while (true){
signboard.display();
scanner.next();
}
}
}