Skip to content

Commit f9ec81c

Browse files
snake.java
1 parent babc846 commit f9ec81c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

snake.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
public class SnakeGame {
2+
public static void main(String[] args) throws Exception {
3+
int x = 5;
4+
5+
while (true) {
6+
System.out.print("\r");
7+
for (int i = 0; i < x; i++) System.out.print(" ");
8+
System.out.print("O");
9+
10+
x++;
11+
if (x == 50) x = 5;
12+
13+
Thread.sleep(100);
14+
}
15+
}
16+
}

0 commit comments

Comments
 (0)