From 19571757f327bcd8cbcb7ad99682fe45fe0ad60e Mon Sep 17 00:00:00 2001 From: fdai7012 Date: Thu, 8 Feb 2024 02:05:59 +0100 Subject: [PATCH 1/4] Added VisualizerPlainTextUltraTest --- .../pacmanTests/VisualizerPlainTextUltraTest.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/test/java/pacmanTests/VisualizerPlainTextUltraTest.java diff --git a/src/test/java/pacmanTests/VisualizerPlainTextUltraTest.java b/src/test/java/pacmanTests/VisualizerPlainTextUltraTest.java new file mode 100644 index 0000000..97d52de --- /dev/null +++ b/src/test/java/pacmanTests/VisualizerPlainTextUltraTest.java @@ -0,0 +1,13 @@ +package pacmanTests; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.*; + +import org.junit.jupiter.api.Test; + +import pacmanGame.*; + + +class VisualizerPlainTextUltraTest { + +} From c1ea9edb72b692690c79288c92c587cc4eaca86c Mon Sep 17 00:00:00 2001 From: fdai7012 Date: Thu, 8 Feb 2024 02:07:12 +0100 Subject: [PATCH 2/4] Added test for vptu --- .../VisualizerPlainTextUltraTest.java | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/test/java/pacmanTests/VisualizerPlainTextUltraTest.java b/src/test/java/pacmanTests/VisualizerPlainTextUltraTest.java index 97d52de..d42b9f3 100644 --- a/src/test/java/pacmanTests/VisualizerPlainTextUltraTest.java +++ b/src/test/java/pacmanTests/VisualizerPlainTextUltraTest.java @@ -10,4 +10,31 @@ import pacmanGame.*; class VisualizerPlainTextUltraTest { + @Test + void VisualizerPlainTextUtlra_mapCells_areVisualized() { + // arrange + String[] mapTest = { + "w.w", + "e.e", + "w.w" + }; + + GameManager gameManager = new GameManager(); + gameManager.map = new Map(mapTest, gameManager); + VisualizerPlainTextUltra vptu = new VisualizerPlainTextUltra(gameManager); + vptu.showScore = false; + + String expected = "" + + "|''| . |''|\n" + + "|__| |__|\n" + + " . \n" + + " \n" + + "|''| . |''|\n" + + "|__| |__|\n"; + // act + vptu.Update(); + String result = (String)vptu.GetOutput(); + // assert + assertThat(expected).isEqualTo(result); + } } From a5178c56a3b92e651202df684424dbd1db59a798 Mon Sep 17 00:00:00 2001 From: fdai7012 Date: Thu, 8 Feb 2024 02:07:48 +0100 Subject: [PATCH 3/4] added another test for vput --- .../VisualizerPlainTextUltraTest.java | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/test/java/pacmanTests/VisualizerPlainTextUltraTest.java b/src/test/java/pacmanTests/VisualizerPlainTextUltraTest.java index d42b9f3..e7e42e9 100644 --- a/src/test/java/pacmanTests/VisualizerPlainTextUltraTest.java +++ b/src/test/java/pacmanTests/VisualizerPlainTextUltraTest.java @@ -37,4 +37,34 @@ class VisualizerPlainTextUltraTest { // assert assertThat(expected).isEqualTo(result); } + + @Test + void VisualizerPlainTextUltra_ghosts_areVisualized() { + // arrange + String[] mapTest = { + "w.w", + "e.e", + "w.w" + }; + + GameManager gameManager = new GameManager(); + gameManager.map = new Map(mapTest, gameManager); + VisualizerPlainTextUltra vptu = new VisualizerPlainTextUltra(gameManager); + vptu.showScore = false; + + gameManager.ghosts[0].position = new Vector2(1, 1); + + String expected = "" + + "|''| . |''|\n" + + "|__| |__|\n" + + " /--\\ \n" + + " ~~~~ \n" + + "|''| . |''|\n" + + "|__| |__|\n"; + // act + vptu.Update(); + String result = (String)vptu.GetOutput(); + // assert + assertThat(expected).isEqualTo(result); + } } From 1f49220723d039c8763dd032ff1c973bb0a97e44 Mon Sep 17 00:00:00 2001 From: fdai2751 Date: Thu, 8 Feb 2024 02:08:51 +0100 Subject: [PATCH 4/4] =?UTF-8?q?added=20the=20pause=20touch=20in=20the=20Ga?= =?UTF-8?q?memove=C2=B4s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/pacmanGame/Player.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/pacmanGame/Player.java b/src/main/java/pacmanGame/Player.java index c622521..e178978 100644 --- a/src/main/java/pacmanGame/Player.java +++ b/src/main/java/pacmanGame/Player.java @@ -32,8 +32,10 @@ public class Player { } public void processInput(char inputchar) { - - if(inputchar == 'w') { + if(inputchar == 'p') { + checkInput(new Vector2(0,0)); + } + else if(inputchar == 'w') { checkInput(new Vector2(0,1)); }