Browse Source

fixed test for VisualizerPlainText

remotes/origin/player
fdai7910 11 months ago
parent
commit
bd9559e5d0
  1. 9
      src/main/java/pacmanGame/VisualizerPlainText.java
  2. 2
      src/test/java/pacmanTests/VisualizerPlainTextTest.java

9
src/main/java/pacmanGame/VisualizerPlainText.java

@ -6,6 +6,7 @@ public class VisualizerPlainText implements Visualizer {
private String output;
public final GameManager gameManager;
public boolean showScore = true;
public HashMap<String, String> sprites = new HashMap<String,String>(){{
this.put("empty", " ");
@ -28,7 +29,13 @@ public class VisualizerPlainText implements Visualizer {
@Override
public void Update() {
output = "Score: " + gameManager.score + "\n";
if(showScore) {
output = "Score: " + gameManager.score + "\n";
}
else {
output = "";
}
Map map = gameManager.map;
for(int y = 0; y < map.size.y; y++) {

2
src/test/java/pacmanTests/VisualizerPlainTextTest.java

@ -22,6 +22,7 @@ class VisualizerPlainTextTest {
GameManager gameManager = new GameManager();
gameManager.map = new Map(mapTest, gameManager);
VisualizerPlainText vpt = new VisualizerPlainText(gameManager);
vpt.showScore = false;
String expected = ""
+ "[]. []\n"
@ -46,6 +47,7 @@ class VisualizerPlainTextTest {
GameManager gameManager = new GameManager();
gameManager.map = new Map(mapTest, gameManager);
VisualizerPlainText vpt = new VisualizerPlainText(gameManager);
vpt.showScore = false;
gameManager.ghosts[0].position = new Vector2(1, 1);

Loading…
Cancel
Save