From ef9af2ec8e029cd84975d4495cf7feead8619d62 Mon Sep 17 00:00:00 2001 From: KoCoder Date: Tue, 14 Apr 2026 16:53:51 +0200 Subject: [PATCH] Whitespaces in Main und scanner width und height entfernen --- src/CatchTheMouse.java | 46 ++++++++++++++++++------------------------ 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/src/CatchTheMouse.java b/src/CatchTheMouse.java index 465e7f1..39c19a0 100644 --- a/src/CatchTheMouse.java +++ b/src/CatchTheMouse.java @@ -1,35 +1,29 @@ import java.io.IOException; -import java.util.Scanner; 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); - int width; - int height; - int round = 0; + System.out.println("Welcome to Catch the Mouse"); + Game game = Game.getInstance(10, 10); - System.out.println("Welcome to Catch the Mouse"); - Game game = Game.getInstance(10, 10); + try { + while (!game.gameOver()) { + game.writer.write("Round " + round); + game.writer.newLine(); + game.printField(); + game.cat.movePlayer(); + game.mouse.movePlayer(); + Thread.sleep(1000); - try { - while(!game.gameOver()) - { - game.writer.write("Round " + round); - game.writer.newLine(); - game.printField(); - game.cat.movePlayer(); - game.mouse.movePlayer(); - Thread.sleep(1000); + round++; + } + game.writer.flush(); - round++; - } - game.writer.flush(); - - System.out.println("Congrats! You caught the mouse!"); - } catch (Exception e) { - game.writer.flush(); - e.printStackTrace(); - } + System.out.println("Congrats! You caught the mouse!"); + } catch (Exception e) { + game.writer.flush(); + e.printStackTrace(); } + } }