Whitespaces in Main und scanner width und height entfernen
This commit is contained in:
@@ -1,35 +1,29 @@
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Scanner;
|
|
||||||
|
|
||||||
public class CatchTheMouse {
|
public class CatchTheMouse {
|
||||||
public static void main(String[] args) throws IOException {
|
public static void main(String[] args) throws IOException {
|
||||||
|
int round = 0;
|
||||||
|
|
||||||
Scanner scanner = new Scanner(System.in);
|
System.out.println("Welcome to Catch the Mouse");
|
||||||
int width;
|
Game game = Game.getInstance(10, 10);
|
||||||
int height;
|
|
||||||
int round = 0;
|
|
||||||
|
|
||||||
System.out.println("Welcome to Catch the Mouse");
|
try {
|
||||||
Game game = Game.getInstance(10, 10);
|
while (!game.gameOver()) {
|
||||||
|
game.writer.write("Round " + round);
|
||||||
|
game.writer.newLine();
|
||||||
|
game.printField();
|
||||||
|
game.cat.movePlayer();
|
||||||
|
game.mouse.movePlayer();
|
||||||
|
Thread.sleep(1000);
|
||||||
|
|
||||||
try {
|
round++;
|
||||||
while(!game.gameOver())
|
}
|
||||||
{
|
game.writer.flush();
|
||||||
game.writer.write("Round " + round);
|
|
||||||
game.writer.newLine();
|
|
||||||
game.printField();
|
|
||||||
game.cat.movePlayer();
|
|
||||||
game.mouse.movePlayer();
|
|
||||||
Thread.sleep(1000);
|
|
||||||
|
|
||||||
round++;
|
System.out.println("Congrats! You caught the mouse!");
|
||||||
}
|
} catch (Exception e) {
|
||||||
game.writer.flush();
|
game.writer.flush();
|
||||||
|
e.printStackTrace();
|
||||||
System.out.println("Congrats! You caught the mouse!");
|
|
||||||
} catch (Exception e) {
|
|
||||||
game.writer.flush();
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user