From 19eb41066c208fadbef8521fce51478ecfd9fa93 Mon Sep 17 00:00:00 2001 From: Andrin Fassbind Date: Thu, 24 Mar 2022 18:45:59 +0100 Subject: [PATCH 1/2] GameTest.java correct --- src/test/java/ch/zhaw/pm2/racetrack/GameTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/java/ch/zhaw/pm2/racetrack/GameTest.java b/src/test/java/ch/zhaw/pm2/racetrack/GameTest.java index 4aca662..78b580b 100644 --- a/src/test/java/ch/zhaw/pm2/racetrack/GameTest.java +++ b/src/test/java/ch/zhaw/pm2/racetrack/GameTest.java @@ -133,7 +133,7 @@ class GameTest { @Test void winner() { - game = new Game(new interFace("Test",new Integer[]{0,2,1},new PositionVector.Direction[]{RIGHT, + game = new Game(new interFace("Test",new Integer[]{0,2,0},new PositionVector.Direction[]{RIGHT, RIGHT, RIGHT, NONE, @@ -178,7 +178,7 @@ class GameTest { @Test void crashA() { - game = new Game(new interFace("Test",new Integer[]{0,2,2},new PositionVector.Direction[]{UP})); + game = new Game(new interFace("Test",new Integer[]{0,1,0},new PositionVector.Direction[]{UP})); game.initPhase(); Assertions.assertEquals("b",game.gamePhase()); } From 1a3a96218cc297b2587c09b7b786ee79633e73e1 Mon Sep 17 00:00:00 2001 From: Andrin Fassbind Date: Thu, 24 Mar 2022 18:49:07 +0100 Subject: [PATCH 2/2] refactor Track --- src/main/java/ch/zhaw/pm2/racetrack/Track.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/java/ch/zhaw/pm2/racetrack/Track.java b/src/main/java/ch/zhaw/pm2/racetrack/Track.java index 0c5fe2f..1012840 100644 --- a/src/main/java/ch/zhaw/pm2/racetrack/Track.java +++ b/src/main/java/ch/zhaw/pm2/racetrack/Track.java @@ -275,7 +275,6 @@ public class Track implements TrackSpecification { */ @Override public Config.SpaceType getSpaceType(PositionVector position) { - //isPositionVectorOnTrack(position); Should be used but we are not allowed to change method head. We don't use function anyway char charAtPosition = track.get(position.getY()).charAt(position.getX()); ConfigSpecification.SpaceType[] spaceTypes = ConfigSpecification.SpaceType.values(); for (ConfigSpecification.SpaceType spaceType : spaceTypes) { @@ -284,7 +283,7 @@ public class Track implements TrackSpecification { } } - return null; + return ConfigSpecification.SpaceType.WALL; } /**