From 9a2bec1e5bbd7095f8de1c7c1357c6faeecbb454 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Sat, 8 Aug 2015 17:35:29 +0200 Subject: rename tankontank directories into rustanddust --- .../asynk/rustanddust/android/AndroidLauncher.java | 16 + .../asynk/tankontank/android/AndroidLauncher.java | 16 - core/test/ch/asynk/rustanddust/BoardUtils.java | 197 +++ core/test/ch/asynk/rustanddust/Helpers.java | 144 ++ .../test/ch/asynk/rustanddust/LineOfSightTest.java | 1421 ++++++++++++++++++++ core/test/ch/asynk/tankontank/BoardUtils.java | 197 --- core/test/ch/asynk/tankontank/Helpers.java | 144 -- core/test/ch/asynk/tankontank/LineOfSightTest.java | 1421 -------------------- .../asynk/rustanddust/desktop/DesktopLauncher.java | 18 + .../asynk/tankontank/desktop/DesktopLauncher.java | 18 - .../src/ch/asynk/rustanddust/GdxDefinition.gwt.xml | 11 + .../rustanddust/GdxDefinitionSuperdev.gwt.xml | 15 + .../ch/asynk/rustanddust/client/HtmlLauncher.java | 19 + html/src/ch/asynk/tankontank/GdxDefinition.gwt.xml | 11 - .../asynk/tankontank/GdxDefinitionSuperdev.gwt.xml | 15 - .../ch/asynk/tankontank/client/HtmlLauncher.java | 19 - ios/src/ch/asynk/rustanddust/IOSLauncher.java | 22 + ios/src/ch/asynk/tankontank/IOSLauncher.java | 22 - 18 files changed, 1863 insertions(+), 1863 deletions(-) create mode 100644 android/src/ch/asynk/rustanddust/android/AndroidLauncher.java delete mode 100644 android/src/ch/asynk/tankontank/android/AndroidLauncher.java create mode 100644 core/test/ch/asynk/rustanddust/BoardUtils.java create mode 100644 core/test/ch/asynk/rustanddust/Helpers.java create mode 100644 core/test/ch/asynk/rustanddust/LineOfSightTest.java delete mode 100644 core/test/ch/asynk/tankontank/BoardUtils.java delete mode 100644 core/test/ch/asynk/tankontank/Helpers.java delete mode 100644 core/test/ch/asynk/tankontank/LineOfSightTest.java create mode 100644 desktop/src/ch/asynk/rustanddust/desktop/DesktopLauncher.java delete mode 100644 desktop/src/ch/asynk/tankontank/desktop/DesktopLauncher.java create mode 100644 html/src/ch/asynk/rustanddust/GdxDefinition.gwt.xml create mode 100644 html/src/ch/asynk/rustanddust/GdxDefinitionSuperdev.gwt.xml create mode 100644 html/src/ch/asynk/rustanddust/client/HtmlLauncher.java delete mode 100644 html/src/ch/asynk/tankontank/GdxDefinition.gwt.xml delete mode 100644 html/src/ch/asynk/tankontank/GdxDefinitionSuperdev.gwt.xml delete mode 100644 html/src/ch/asynk/tankontank/client/HtmlLauncher.java create mode 100644 ios/src/ch/asynk/rustanddust/IOSLauncher.java delete mode 100644 ios/src/ch/asynk/tankontank/IOSLauncher.java diff --git a/android/src/ch/asynk/rustanddust/android/AndroidLauncher.java b/android/src/ch/asynk/rustanddust/android/AndroidLauncher.java new file mode 100644 index 0000000..46f2da9 --- /dev/null +++ b/android/src/ch/asynk/rustanddust/android/AndroidLauncher.java @@ -0,0 +1,16 @@ +package ch.asynk.rustanddust.android; + +import android.os.Bundle; + +import com.badlogic.gdx.backends.android.AndroidApplication; +import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration; +import ch.asynk.rustanddust.RustAndDust; + +public class AndroidLauncher extends AndroidApplication { + @Override + protected void onCreate (Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + AndroidApplicationConfiguration config = new AndroidApplicationConfiguration(); + initialize(new RustAndDust(), config); + } +} diff --git a/android/src/ch/asynk/tankontank/android/AndroidLauncher.java b/android/src/ch/asynk/tankontank/android/AndroidLauncher.java deleted file mode 100644 index 46f2da9..0000000 --- a/android/src/ch/asynk/tankontank/android/AndroidLauncher.java +++ /dev/null @@ -1,16 +0,0 @@ -package ch.asynk.rustanddust.android; - -import android.os.Bundle; - -import com.badlogic.gdx.backends.android.AndroidApplication; -import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration; -import ch.asynk.rustanddust.RustAndDust; - -public class AndroidLauncher extends AndroidApplication { - @Override - protected void onCreate (Bundle savedInstanceState) { - super.onCreate(savedInstanceState); - AndroidApplicationConfiguration config = new AndroidApplicationConfiguration(); - initialize(new RustAndDust(), config); - } -} diff --git a/core/test/ch/asynk/rustanddust/BoardUtils.java b/core/test/ch/asynk/rustanddust/BoardUtils.java new file mode 100644 index 0000000..a0b5a1b --- /dev/null +++ b/core/test/ch/asynk/rustanddust/BoardUtils.java @@ -0,0 +1,197 @@ +package ch.asynk.rustanddust; + +import java.util.List; +import java.util.ArrayList; +import java.util.HashSet; + +import org.junit.Test; +import org.junit.Before; + +import ch.asynk.rustanddust.engine.Tile; +import ch.asynk.rustanddust.engine.Path; + +import static org.junit.Assert.assertTrue; + +public class BoardUtils +{ + private Helpers.FakeBoard b; + private Helpers.FakeSearchBoard sb; + + @Before + public void initialize() + { + int cols = 10; + int rows = 9; + int mvt = 3; + b = new Helpers.FakeBoard(cols, rows, 3); + sb = new Helpers.FakeSearchBoard(b, cols, rows); + } + + private void assertTile(Tile t, int col, int row) + { + assertTrue(t.getCol() == col); + assertTrue(t.getRow() == row); + } + + @Test + public void testPaths() + { + int n = b.buildPathBuilder(2, 2, 4, 3); + + assertTrue(b.pathBuilder.distance == 2); + assertTrue(n == 8); + + for(int p = 0; p < n; p++) { + + Path path = b.pathBuilder.getPath(p); + int z = path.tiles.size(); + assertTrue(path.cost == (z + 1)); + + Tile t; + int i = 0; + if (z == 1) { + t = path.tiles.get(i); + assertTrue(t.getCol() == 3); + assertTrue((t.getRow() == 2) || (t.getRow() == 3));; + } else if (z == 2) { + t = path.tiles.get(i); + if (t.getCol() == 2) { + i += 1; + if (t.getRow() == 1) { + t = path.tiles.get(i); + assertTile(t, 3, 2); + } else { + assert(t.getRow()== 3); + t = path.tiles.get(i); + assertTile(t, 3, 3); + } + } else if (t.getCol() == 3) { + i += 1; + if (t.getRow() == 2) { + t = path.tiles.get(i); + if (t.getCol() == 3) + assert(t.getRow()== 3); + else { + assertTile(t, 4, 2); + } + } else { + assert(t.getRow() == 3); + t = path.tiles.get(i); + if (t.getCol() == 3) + assert(t.getRow() == 2); + else { + assertTile(t, 4, 4); + } + } + } else { + assertTrue(false); + } + } else { + assertTrue(false); + } + } + } + + @Test + public void testPathSet() + { + int n = b.buildPathBuilder(2, 2, 3, 3); + assertTrue(n == 1); + + n = b.buildPathBuilder(2, 2, 4, 3); + assertTrue(n == 8); + + n = b.togglePoint(3, 3); + assertTrue(n == 1); + + n = b.buildPathBuilder(2, 2, 5, 3); + assertTrue(n == 3); + + n = b.togglePoint(3, 3); + assertTrue(n == 1); + + n = b.togglePoint(3, 3); + assertTrue(n == 3); + + n = b.togglePoint(3, 2); + assertTrue(n == 2); + + n = b.togglePoint(4, 2); + assertTrue(n == 1); + + } + + @Test + public void testDistance() + { + assertTrue(sb.distance(6, 4, 6, 4) == 0); + assertTrue(sb.distance(6, 4, 5, 4) == 1); + assertTrue(sb.distance(6, 4, 6, 5) == 1); + assertTrue(sb.distance(6, 4, 7, 5) == 1); + assertTrue(sb.distance(6, 4, 7, 4) == 1); + assertTrue(sb.distance(6, 4, 6, 3) == 1); + assertTrue(sb.distance(6, 4, 5, 3) == 1); + assertTrue(sb.distance(6, 4, 4, 4) == 2); + assertTrue(sb.distance(6, 4, 5, 5) == 2); + assertTrue(sb.distance(6, 4, 6, 6) == 2); + assertTrue(sb.distance(6, 4, 7, 6) == 2); + assertTrue(sb.distance(6, 4, 8, 6) == 2); + assertTrue(sb.distance(6, 4, 8, 5) == 2); + assertTrue(sb.distance(6, 4, 8, 4) == 2); + assertTrue(sb.distance(6, 4, 7, 3) == 2); + assertTrue(sb.distance(6, 4, 6, 2) == 2); + assertTrue(sb.distance(6, 4, 5, 2) == 2); + assertTrue(sb.distance(6, 4, 4, 2) == 2); + assertTrue(sb.distance(6, 4, 4, 3) == 2); + + assertTrue(sb.distance(6, 4, 9, 7) == 3); + assertTrue(sb.distance(6, 4, 10, 8) == 4); + assertTrue(sb.distance(6, 4, 6, 1) == 3); + assertTrue(sb.distance(6, 4, 9, 6) == 3); + assertTrue(sb.distance(6, 4, 9, 5) == 3); + assertTrue(sb.distance(6, 4, 10, 6) == 4); + assertTrue(sb.distance(6, 4, 3, 1) == 3); + assertTrue(sb.distance(6, 4, 2, 0) == 4); + + assertTrue(sb.distance(6, 4, 9, 4) == 3); + assertTrue(sb.distance(6, 4, 8, 4) == 2); + assertTrue(sb.distance(6, 4, 9, 5) == 3); + assertTrue(sb.distance(6, 4, 10, 5) == 4); + assertTrue(sb.distance(6, 4, 10, 4) == 4); + assertTrue(sb.distance(6, 4, 9, 3) == 4); + assertTrue(sb.distance(6, 4, 8, 3) == 3); + + assertTrue(sb.distance(6, 4, 8, 2) == 4); + assertTrue(sb.distance(6, 4, 7, 2) == 3); + assertTrue(sb.distance(6, 4, 8, 3) == 3); + assertTrue(sb.distance(6, 4, 9, 3) == 4); + assertTrue(sb.distance(6, 4, 9, 2) == 5); + assertTrue(sb.distance(6, 4, 8, 1) == 5); + assertTrue(sb.distance(6, 4, 7, 1) == 4); + + assertTrue(sb.distance(6, 4, 2, 2) == 4); + assertTrue(sb.distance(6, 4, 1, 2) == 5); + assertTrue(sb.distance(6, 4, 2, 3) == 4); + assertTrue(sb.distance(6, 4, 3, 3) == 3); + assertTrue(sb.distance(6, 4, 3, 2) == 3); + assertTrue(sb.distance(6, 4, 2, 1) == 4); + assertTrue(sb.distance(6, 4, 1, 1) == 5); + + assertTrue(sb.distance(6, 4, 5, 7) == 4); + assertTrue(sb.distance(6, 4, 4, 7) == 5); + assertTrue(sb.distance(6, 4, 5, 8) == 5); + assertTrue(sb.distance(6, 4, 6, 8) == 4); + assertTrue(sb.distance(6, 4, 6, 7) == 3); + assertTrue(sb.distance(6, 4, 5, 6) == 3); + assertTrue(sb.distance(6, 4, 4, 6) == 4); + + assertTrue(sb.distance(6, 4, 8, 8) == 4); + assertTrue(sb.distance(6, 4, 7, 8) == 4); + assertTrue(sb.distance(6, 4, 1, 1) == 5); + assertTrue(sb.distance(6, 4, 7, 0) == 5); + assertTrue(sb.distance(6, 4, 9, 8) == 4); + assertTrue(sb.distance(6, 4, 8, 7) == 3); + assertTrue(sb.distance(6, 4, 7, 7) == 3); + } + +} diff --git a/core/test/ch/asynk/rustanddust/Helpers.java b/core/test/ch/asynk/rustanddust/Helpers.java new file mode 100644 index 0000000..818f1a0 --- /dev/null +++ b/core/test/ch/asynk/rustanddust/Helpers.java @@ -0,0 +1,144 @@ +package ch.asynk.rustanddust; + +import java.util.List; +import java.util.ArrayList; +import java.util.HashSet; + +import ch.asynk.rustanddust.engine.Pawn; +import ch.asynk.rustanddust.engine.Tile; +import ch.asynk.rustanddust.engine.Board; +import ch.asynk.rustanddust.engine.Orientation; +import ch.asynk.rustanddust.engine.SearchBoard; +import ch.asynk.rustanddust.engine.PathBuilder; + +public class Helpers +{ + public static class FakePawn extends Pawn + { + private int mvt; + public FakePawn (int mvt) + { + this.mvt = mvt; + } + + @Override public int getMovementPoints() { return mvt; } + @Override public int getRoadMarchBonus() { return 1; } + @Override public int getAngleOfAttack() { return 0; } + @Override public int getFlankSides() { return 0; } + @Override public int getDefense(Tile tile) { return 8; } + @Override public int getEngagementRangeFrom(Tile tile) { return 3; } + + @Override public boolean isA(PawnId id) { return true; } + @Override public boolean isA(PawnType type) { return true; } + @Override public boolean isHq() { return true; } + @Override public boolean isHqOf(Pawn other) { return true; } + @Override public boolean isUnit() { return true; } + @Override public boolean isHardTarget() { return true; } + @Override public boolean isEnemy(Pawn other) { return true; } + + @Override public boolean canMove() { return true; } + @Override public boolean canRotate() { return true; } + @Override public boolean canEngage() { return true; } + @Override public boolean canEngage(Pawn other) { return true; } + @Override public boolean canAssistEngagementWithoutLos() { return true; } + + @Override public void move() { } + @Override public void engage() { } + + @Override public void reset() { } + @Override public void revertLastMove() { } + } + + public static class FakeTile extends Tile + { + public boolean offMap; + + public FakeTile(int col, int row) + { + super(col, row); + offMap = false; + } + + public FakeTile(int col, int row, boolean offMap) + { + super(col, row); + this.offMap = offMap; + } + + @Override public boolean isOffMap() + { + return offMap; + } + @Override public int exitCost() { return 1; } + @Override public int costFrom(Pawn pawn, Orientation side) { return 1; } + @Override public int defense() { return 0; } + + @Override public boolean isA(TileTerrain terrain) { return true; } + @Override public boolean road(Orientation side) { return false; } + @Override public boolean atLeastOneMove(Pawn pawn) { return true; } + @Override public boolean blockLineOfSightFrom(Tile from) { return false; } + } + + public static class FakeSearchBoard extends SearchBoard + { + public FakeSearchBoard(Board b, int cols, int rows) + { + super(b, cols, rows); + } + + public int distance(int col0, int row0, int col1, int row1) + { + return distance(getNode(col0, row0), getNode(col1, row1)); + } + } + + public static class FakeBoard extends Board + { + public FakePawn pawn; + public FakeTile fakeTiles[]; + public PathBuilder pathBuilder; + + public FakeBoard(int cols, int rows, int mvt) + { + super(cols, rows); + fakeTiles = new FakeTile[(cols + 2) * (rows + 2)]; + + int idx = 0; + for (int i = -1; i < (rows + 1); i++) { + for ( int j = -1; j < (cols + 1); j ++) { + boolean offmap = ((j < 0) || (i < 0) || (j >= cols) || (i >= rows)); + fakeTiles[idx] = new FakeTile((j + ((i + 1) / 2)), i, offmap); + idx += 1; + } + } + + fakeTiles[ 36 - 2].offMap = true; + fakeTiles[ 60 - 2].offMap = true; + fakeTiles[ 84 - 2].offMap = true; + fakeTiles[108 - 2].offMap = true; + + pawn = new FakePawn(mvt); + pathBuilder = new PathBuilder(this, 10, 20, 5, 10); + } + + @Override + public Tile getTile(int col, int row) + { + int i = getTileOffset(col, row); + if (i < 0) + return null; + return fakeTiles[i]; + } + + public int buildPathBuilder(int x0, int y0, int x1, int y1) + { + pathBuilder.init(pawn, getTile(x0, y0)); + return pathBuilder.build(getTile(x1, y1)); + } + + public int togglePoint(int x, int y) + { + return pathBuilder.toggleCtrlTile(getTile(x, y)); + } + } +} diff --git a/core/test/ch/asynk/rustanddust/LineOfSightTest.java b/core/test/ch/asynk/rustanddust/LineOfSightTest.java new file mode 100644 index 0000000..60b95ab --- /dev/null +++ b/core/test/ch/asynk/rustanddust/LineOfSightTest.java @@ -0,0 +1,1421 @@ +package ch.asynk.rustanddust; + +import java.util.List; + +import org.junit.Test; +import org.junit.Before; + +import ch.asynk.rustanddust.engine.SearchBoard; +import ch.asynk.rustanddust.engine.SearchBoard.Node; + +import static org.junit.Assert.assertTrue; + +public class LineOfSightTest +{ + private SearchBoard sb; + + @Before + public void initialize() + { + int cols = 10; + int rows = 9; + Helpers.FakeBoard fakeBoard = new Helpers.FakeBoard(cols, rows, 0); + sb = new SearchBoard(fakeBoard, cols, rows); + } + + private void checkNode(List l, int i, int col, int row) + { + Node n = l.get(i); + assertTrue(n.col == col); + assertTrue(n.row == row); + } + + private List lineOfSight(int x0, int y0, int x1, int y1) + { + return sb.lineOfSight(x0, y0, x1, y1, true); + } + + // from bottom left + @Test public void test_1() { + List s = lineOfSight(0, 0, 2, 1); + assertTrue(s.size() == 4); + checkNode(s, 0, 0, 0); + checkNode(s, 1, 1, 0); + checkNode(s, 2, 1, 1); + checkNode(s, 3, 2, 1); + } + + @Test public void test_2() { + List s = lineOfSight(0, 0, 5, 1); + assertTrue(s.size() == 6); + checkNode(s, 0, 0, 0); + checkNode(s, 1, 1, 0); + checkNode(s, 2, 2, 0); + checkNode(s, 3, 3, 1); + checkNode(s, 4, 4, 1); + checkNode(s, 5, 5, 1); + } + + @Test public void test_3() { + List s = lineOfSight(0, 0, 8, 1); + assertTrue(s.size() == 10); + checkNode(s, 0, 0, 0); + checkNode(s, 1, 1, 0); + checkNode(s, 2, 2, 0); + checkNode(s, 3, 3, 0); + checkNode(s, 4, 4, 1); + checkNode(s, 5, 4, 0); + checkNode(s, 6, 5, 1); + checkNode(s, 7, 6, 1); + checkNode(s, 8, 7, 1); + checkNode(s, 9, 8, 1); + } + + @Test public void test_4() { + List s = lineOfSight(0, 0, 1, 2); + assertTrue(s.size() == 3); + checkNode(s, 0, 0, 0); + checkNode(s, 1, 1, 1); + checkNode(s, 2, 1, 2); + } + + @Test public void test_5() { + List s = lineOfSight(0, 0, 4, 2); + assertTrue(s.size() == 7); + checkNode(s, 0, 0, 0); + checkNode(s, 1, 1, 0); + checkNode(s, 2, 1, 1); + checkNode(s, 3, 2, 1); + checkNode(s, 4, 3, 1); + checkNode(s, 5, 3, 2); + checkNode(s, 6, 4, 2); + } + + @Test public void test_6() { + List s = lineOfSight(0, 0, 7, 2); + assertTrue(s.size() == 8); + checkNode(s, 0, 0, 0); + checkNode(s, 1, 1, 0); + checkNode(s, 2, 2, 1); + checkNode(s, 3, 3, 1); + checkNode(s, 4, 4, 1); + checkNode(s, 5, 5, 1); + checkNode(s, 6, 6, 2); + checkNode(s, 7, 7, 2); + } + + @Test public void test_7() { + List s = lineOfSight(0, 0, 10, 2); + assertTrue(s.size() == 11); + checkNode(s, 0, 0, 0); + checkNode(s, 1, 1, 0); + checkNode(s, 2, 2, 0); + checkNode(s, 3, 3, 1); + checkNode(s, 4, 4, 1); + checkNode(s, 5, 5, 1); + checkNode(s, 6, 6, 1); + checkNode(s, 7, 7, 1); + checkNode(s, 8, 8, 2); + checkNode(s, 9, 9, 2); + checkNode(s, 10, 10, 2); + } + + @Test public void test_8() { + List s = lineOfSight(0, 0, 6, 3); + assertTrue(s.size() == 10); + checkNode(s, 0, 0, 0); + checkNode(s, 1, 1, 0); + checkNode(s, 2, 1, 1); + checkNode(s, 3, 2, 1); + checkNode(s, 4, 3, 1); + checkNode(s, 5, 3, 2); + checkNode(s, 6, 4, 2); + checkNode(s, 7, 5, 2); + checkNode(s, 8, 5, 3); + checkNode(s, 9, 6, 3); + } + + @Test public void test_9() { + List s = lineOfSight(0, 0, 2, 4); + assertTrue(s.size() == 5); + checkNode(s, 0, 0, 0); + checkNode(s, 1, 1, 1); + checkNode(s, 2, 1, 2); + checkNode(s, 3, 2, 3); + checkNode(s, 4, 2, 4); + } + + @Test public void test_10() { + List s = lineOfSight(0, 0, 5, 4); + assertTrue(s.size() == 6); + checkNode(s, 0, 0, 0); + checkNode(s, 1, 1, 1); + checkNode(s, 2, 2, 2); + checkNode(s, 3, 3, 2); + checkNode(s, 4, 4, 3); + checkNode(s, 5, 5, 4); + } + + @Test public void test_11() { + List s = lineOfSight(0, 0, 8, 4); + assertTrue(s.size() == 13); + checkNode(s, 0, 0, 0); + checkNode(s, 1, 1, 0); + checkNode(s, 2, 1, 1); + checkNode(s, 3, 2, 1); + checkNode(s, 4, 3, 1); + checkNode(s, 5, 3, 2); + checkNode(s, 6, 4, 2); + checkNode(s, 7, 5, 2); + checkNode(s, 8, 5, 3); + checkNode(s, 9, 6, 3); + checkNode(s, 10, 7, 3); + checkNode(s, 11, 7, 4); + checkNode(s, 12, 8, 4); + } + + @Test public void test_12() { + List s = lineOfSight(0, 0, 11, 4); + assertTrue(s.size() == 12); + checkNode(s, 0, 0, 0); + checkNode(s, 1, 1, 0); + checkNode(s, 2, 2, 1); + checkNode(s, 3, 3, 1); + checkNode(s, 4, 4, 1); + checkNode(s, 5, 5, 2); + checkNode(s, 6, 6, 2); + checkNode(s, 7, 7, 3); + checkNode(s, 8, 8, 3); + checkNode(s, 9, 9, 3); + checkNode(s, 10, 10, 4); + checkNode(s, 11, 11, 4); + } + + @Test public void test_13() { + List s = lineOfSight(0, 0, 4, 5); + assertTrue(s.size() == 6); + checkNode(s, 0, 0, 0); + checkNode(s, 1, 1, 1); + checkNode(s, 2, 2, 2); + checkNode(s, 3, 2, 3); + checkNode(s, 4, 3, 4); + checkNode(s, 5, 4, 5); + } + + @Test public void test_14() { + List s = lineOfSight(0, 0, 7, 5); + assertTrue(s.size() == 8); + checkNode(s, 0, 0, 0); + checkNode(s, 1, 1, 1); + checkNode(s, 2, 2, 1); + checkNode(s, 3, 3, 2); + checkNode(s, 4, 4, 3); + checkNode(s, 5, 5, 4); + checkNode(s, 6, 6, 4); + checkNode(s, 7, 7, 5); + } + + @Test public void test_15() { + List s = lineOfSight(0, 0, 10, 5); + assertTrue(s.size() == 16); + checkNode(s, 0, 0, 0); + checkNode(s, 1, 1, 0); + checkNode(s, 2, 1, 1); + checkNode(s, 3, 2, 1); + checkNode(s, 4, 3, 1); + checkNode(s, 5, 3, 2); + checkNode(s, 6, 4, 2); + checkNode(s, 7, 5, 2); + checkNode(s, 8, 5, 3); + checkNode(s, 9, 6, 3); + checkNode(s, 10, 7, 3); + checkNode(s, 11, 7, 4); + checkNode(s, 12, 8, 4); + checkNode(s, 13, 9, 4); + checkNode(s, 14, 9, 5); + checkNode(s, 15, 10, 5); + } + + @Test public void test_16() { + List s = lineOfSight(0, 0, 3, 6); + assertTrue(s.size() == 7); + checkNode(s, 0, 0, 0); + checkNode(s, 1, 1, 1); + checkNode(s, 2, 1, 2); + checkNode(s, 3, 2, 3); + checkNode(s, 4, 2, 4); + checkNode(s, 5, 3, 5); + checkNode(s, 6, 3, 6); + } + + @Test public void test_17() { + List s = lineOfSight(0, 0, 12, 6); + assertTrue(s.size() == 19); + checkNode(s, 0, 0, 0); + checkNode(s, 1, 1, 0); + checkNode(s, 2, 1, 1); + checkNode(s, 3, 2, 1); + checkNode(s, 4, 3, 1); + checkNode(s, 5, 3, 2); + checkNode(s, 6, 4, 2); + checkNode(s, 7, 5, 2); + checkNode(s, 8, 5, 3); + checkNode(s, 9, 6, 3); + checkNode(s, 10, 7, 3); + checkNode(s, 11, 7, 4); + checkNode(s, 12, 8, 4); + checkNode(s, 13, 9, 4); + checkNode(s, 14, 9, 5); + checkNode(s, 15, 10, 5); + checkNode(s, 16, 11, 5); + checkNode(s, 17, 11, 6); + checkNode(s, 18, 12, 6); + } + + @Test public void test_18() { + List s = lineOfSight(0, 0, 5, 7); + assertTrue(s.size() == 8); + checkNode(s, 0, 0, 0); + checkNode(s, 1, 1, 1); + checkNode(s, 2, 1, 2); + checkNode(s, 3, 2, 3); + checkNode(s, 4, 3, 4); + checkNode(s, 5, 4, 5); + checkNode(s, 6, 4, 6); + checkNode(s, 7, 5, 7); + } + + @Test public void test_19() { + List s = lineOfSight(0, 0, 8, 7); + assertTrue(s.size() == 10); + checkNode(s, 0, 0, 0); + checkNode(s, 1, 1, 1); + checkNode(s, 2, 2, 2); + checkNode(s, 3, 3, 3); + checkNode(s, 4, 4, 3); + checkNode(s, 5, 4, 4); + checkNode(s, 6, 5, 4); + checkNode(s, 7, 6, 5); + checkNode(s, 8, 7, 6); + checkNode(s, 9, 8, 7); + } + + @Test public void test_20() { + List s = lineOfSight(0, 0, 11, 7); + assertTrue(s.size() == 12); + checkNode(s, 0, 0, 0); + checkNode(s, 1, 1, 1); + checkNode(s, 2, 2, 1); + checkNode(s, 3, 3, 2); + checkNode(s, 4, 4, 3); + checkNode(s, 5, 5, 3); + checkNode(s, 6, 6, 4); + checkNode(s, 7, 7, 4); + checkNode(s, 8, 8, 5); + checkNode(s, 9, 9, 6); + checkNode(s, 10, 10, 6); + checkNode(s, 11, 11, 7); + } + + @Test public void test_21() { + List s = lineOfSight(0, 0, 4, 8); + assertTrue(s.size() == 9); + checkNode(s, 0, 0, 0); + checkNode(s, 1, 1, 1); + checkNode(s, 2, 1, 2); + checkNode(s, 3, 2, 3); + checkNode(s, 4, 2, 4); + checkNode(s, 5, 3, 5); + checkNode(s, 6, 3, 6); + checkNode(s, 7, 4, 7); + checkNode(s, 8, 4, 8); + } + + @Test public void test_22() { + List s = lineOfSight(0, 0, 7, 8); + assertTrue(s.size() == 10); + checkNode(s, 0, 0, 0); + checkNode(s, 1, 1, 1); + checkNode(s, 2, 2, 2); + checkNode(s, 3, 3, 3); + checkNode(s, 4, 3, 4); + checkNode(s, 5, 4, 4); + checkNode(s, 6, 4, 5); + checkNode(s, 7, 5, 6); + checkNode(s, 8, 6, 7); + checkNode(s, 9, 7, 8); + } + + @Test public void test_23() { + List s = lineOfSight(0, 0, 10, 8); + assertTrue(s.size() == 11); + checkNode(s, 0, 0, 0); + checkNode(s, 1, 1, 1); + checkNode(s, 2, 2, 2); + checkNode(s, 3, 3, 2); + checkNode(s, 4, 4, 3); + checkNode(s, 5, 5, 4); + checkNode(s, 6, 6, 5); + checkNode(s, 7, 7, 6); + checkNode(s, 8, 8, 6); + checkNode(s, 9, 9, 7); + checkNode(s, 10, 10, 8); + } + + @Test public void test_24() { + List s = lineOfSight(0, 0, 13, 8); + assertTrue(s.size() == 14); + checkNode(s, 0, 0, 0); + checkNode(s, 1, 1, 1); + checkNode(s, 2, 2, 1); + checkNode(s, 3, 3, 2); + checkNode(s, 4, 4, 2); + checkNode(s, 5, 5, 3); + checkNode(s, 6, 6, 4); + checkNode(s, 7, 7, 4); + checkNode(s, 8, 8, 5); + checkNode(s, 9, 9, 6); + checkNode(s, 10, 10, 6); + checkNode(s, 11, 11, 7); + checkNode(s, 12, 12, 7); + checkNode(s, 13, 13, 8); + } + + // from top right + @Test public void test_25() { + List s = lineOfSight(13, 8, 11, 7); + assertTrue(s.size() == 4); + checkNode(s, 0, 13, 8); + checkNode(s, 1, 12, 8); + checkNode(s, 2, 12, 7); + checkNode(s, 3, 11, 7); + } + + @Test public void test_26() { + List s = lineOfSight(13, 8, 8, 7); + assertTrue(s.size() == 6); + checkNode(s, 0, 13, 8); + checkNode(s, 1, 12, 8); + checkNode(s, 2, 11, 8); + checkNode(s, 3, 10, 7); + checkNode(s, 4, 9, 7); + checkNode(s, 5, 8, 7); + } + + @Test public void test_27() { + List s = lineOfSight(13, 8, 5, 7); + assertTrue(s.size() == 10); + checkNode(s, 0, 13, 8); + checkNode(s, 1, 12, 8); + checkNode(s, 2, 11, 8); + checkNode(s, 3, 10, 8); + checkNode(s, 4, 9, 7); + checkNode(s, 5, 9, 8); + checkNode(s, 6, 8, 7); + checkNode(s, 7, 7, 7); + checkNode(s, 8, 6, 7); + checkNode(s, 9, 5, 7); + } + + @Test public void test_28() { + List s = lineOfSight(13, 8, 12, 6); + assertTrue(s.size() == 3); + checkNode(s, 0, 13, 8); + checkNode(s, 1, 12, 7); + checkNode(s, 2, 12, 6); + } + + @Test public void test_29() { + List s = lineOfSight(13, 8, 9, 6); + assertTrue(s.size() == 7); + checkNode(s, 0, 13, 8); + checkNode(s, 1, 12, 8); + checkNode(s, 2, 12, 7); + checkNode(s, 3, 11, 7); + checkNode(s, 4, 10, 7); + checkNode(s, 5, 10, 6); + checkNode(s, 6, 9, 6); + } + + @Test public void test_30() { + List s = lineOfSight(13, 8, 6, 6); + assertTrue(s.size() == 8); + checkNode(s, 0, 13, 8); + checkNode(s, 1, 12, 8); + checkNode(s, 2, 11, 7); + checkNode(s, 3, 10, 7); + checkNode(s, 4, 9, 7); + checkNode(s, 5, 8, 7); + checkNode(s, 6, 7, 6); + checkNode(s, 7, 6, 6); + } + + @Test public void test_31() { + List s = lineOfSight(13, 8, 3, 6); + assertTrue(s.size() == 11); + checkNode(s, 0, 13, 8); + checkNode(s, 1, 12, 8); + checkNode(s, 2, 11, 8); + checkNode(s, 3, 10, 7); + checkNode(s, 4, 9, 7); + checkNode(s, 5, 8, 7); + checkNode(s, 6, 7, 7); + checkNode(s, 7, 6, 7); + checkNode(s, 8, 5, 6); + checkNode(s, 9, 4, 6); + checkNode(s, 10, 3, 6); + } + + @Test public void test_32() { + List s = lineOfSight(13, 8, 7, 5); + assertTrue(s.size() == 10); + checkNode(s, 0, 13, 8); + checkNode(s, 1, 12, 8); + checkNode(s, 2, 12, 7); + checkNode(s, 3, 11, 7); + checkNode(s, 4, 10, 7); + checkNode(s, 5, 10, 6); + checkNode(s, 6, 9, 6); + checkNode(s, 7, 8, 6); + checkNode(s, 8, 8, 5); + checkNode(s, 9, 7, 5); + } + + @Test public void test_33() { + List s = lineOfSight(13, 8, 11, 4); + assertTrue(s.size() == 5); + checkNode(s, 0, 13, 8); + checkNode(s, 1, 12, 7); + checkNode(s, 2, 12, 6); + checkNode(s, 3, 11, 5); + checkNode(s, 4, 11, 4); + } + + @Test public void test_34() { + List s = lineOfSight(13, 8, 8, 4); + assertTrue(s.size() == 6); + checkNode(s, 0, 13, 8); + checkNode(s, 1, 12, 7); + checkNode(s, 2, 11, 6); + checkNode(s, 3, 10, 6); + checkNode(s, 4, 9, 5); + checkNode(s, 5, 8, 4); + } + + @Test public void test_35() { + List s = lineOfSight(13, 8, 5, 4); + assertTrue(s.size() == 13); + checkNode(s, 0, 13, 8); + checkNode(s, 1, 12, 8); + checkNode(s, 2, 12, 7); + checkNode(s, 3, 11, 7); + checkNode(s, 4, 10, 7); + checkNode(s, 5, 10, 6); + checkNode(s, 6, 9, 6); + checkNode(s, 7, 8, 6); + checkNode(s, 8, 8, 5); + checkNode(s, 9, 7, 5); + checkNode(s, 10, 6, 5); + checkNode(s, 11, 6, 4); + checkNode(s, 12, 5, 4); + } + + @Test public void test_36() { + List s = lineOfSight(13, 8, 2, 4); + assertTrue(s.size() == 12); + checkNode(s, 0, 13, 8); + checkNode(s, 1, 12, 8); + checkNode(s, 2, 11, 7); + checkNode(s, 3, 10, 7); + checkNode(s, 4, 9, 7); + checkNode(s, 5, 8, 6); + checkNode(s, 6, 7, 6); + checkNode(s, 7, 6, 5); + checkNode(s, 8, 5, 5); + checkNode(s, 9, 4, 5); + checkNode(s, 10, 3, 4); + checkNode(s, 11, 2, 4); + } + + @Test public void test_37() { + List s = lineOfSight(13, 8, 9, 3); + assertTrue(s.size() == 6); + checkNode(s, 0, 13, 8); + checkNode(s, 1, 12, 7); + checkNode(s, 2, 11, 6); + checkNode(s, 3, 11, 5); + checkNode(s, 4, 10, 4); + checkNode(s, 5, 9, 3); + } + + @Test public void test_38() { + List s = lineOfSight(13, 8, 6, 3); + assertTrue(s.size() == 8); + checkNode(s, 0, 13, 8); + checkNode(s, 1, 12, 7); + checkNode(s, 2, 11, 7); + checkNode(s, 3, 10, 6); + checkNode(s, 4, 9, 5); + checkNode(s, 5, 8, 4); + checkNode(s, 6, 7, 4); + checkNode(s, 7, 6, 3); + } + + @Test public void test_39() { + List s = lineOfSight(13, 8, 3, 3); + assertTrue(s.size() == 16); + checkNode(s, 0, 13, 8); + checkNode(s, 1, 12, 8); + checkNode(s, 2, 12, 7); + checkNode(s, 3, 11, 7); + checkNode(s, 4, 10, 7); + checkNode(s, 5, 10, 6); + checkNode(s, 6, 9, 6); + checkNode(s, 7, 8, 6); + checkNode(s, 8, 8, 5); + checkNode(s, 9, 7, 5); + checkNode(s, 10, 6, 5); + checkNode(s, 11, 6, 4); + checkNode(s, 12, 5, 4); + checkNode(s, 13, 4, 4); + checkNode(s, 14, 4, 3); + checkNode(s, 15, 3, 3); + } + + @Test public void test_40() { + List s = lineOfSight(13, 8, 10, 2); + assertTrue(s.size() == 7); + checkNode(s, 0, 13, 8); + checkNode(s, 1, 12, 7); + checkNode(s, 2, 12, 6); + checkNode(s, 3, 11, 5); + checkNode(s, 4, 11, 4); + checkNode(s, 5, 10, 3); + checkNode(s, 6, 10, 2); + } + + @Test public void test_41() { + List s = lineOfSight(13, 8, 1, 2); + assertTrue(s.size() == 19); + checkNode(s, 0, 13, 8); + checkNode(s, 1, 12, 8); + checkNode(s, 2, 12, 7); + checkNode(s, 3, 11, 7); + checkNode(s, 4, 10, 7); + checkNode(s, 5, 10, 6); + checkNode(s, 6, 9, 6); + checkNode(s, 7, 8, 6); + checkNode(s, 8, 8, 5); + checkNode(s, 9, 7, 5); + checkNode(s, 10, 6, 5); + checkNode(s, 11, 6, 4); + checkNode(s, 12, 5, 4); + checkNode(s, 13, 4, 4); + checkNode(s, 14, 4, 3); + checkNode(s, 15, 3, 3); + checkNode(s, 16, 2, 3); + checkNode(s, 17, 2, 2); + checkNode(s, 18, 1, 2); + } + + @Test public void test_42() { + List s = lineOfSight(13, 8, 8, 1); + assertTrue(s.size() == 8); + checkNode(s, 0, 13, 8); + checkNode(s, 1, 12, 7); + checkNode(s, 2, 12, 6); + checkNode(s, 3, 11, 5); + checkNode(s, 4, 10, 4); + checkNode(s, 5, 9, 3); + checkNode(s, 6, 9, 2); + checkNode(s, 7, 8, 1); + } + + @Test public void test_43() { + List s = lineOfSight(13, 8, 5, 1); + assertTrue(s.size() == 10); + checkNode(s, 0, 13, 8); + checkNode(s, 1, 12, 7); + checkNode(s, 2, 11, 6); + checkNode(s, 3, 10, 5); + checkNode(s, 4, 9, 5); + checkNode(s, 5, 9, 4); + checkNode(s, 6, 8, 4); + checkNode(s, 7, 7, 3); + checkNode(s, 8, 6, 2); + checkNode(s, 9, 5, 1); + } + + @Test public void test_44() { + List s = lineOfSight(13, 8, 2, 1); + assertTrue(s.size() == 12); + checkNode(s, 0, 13, 8); + checkNode(s, 1, 12, 7); + checkNode(s, 2, 11, 7); + checkNode(s, 3, 10, 6); + checkNode(s, 4, 9, 5); + checkNode(s, 5, 8, 5); + checkNode(s, 6, 7, 4); + checkNode(s, 7, 6, 4); + checkNode(s, 8, 5, 3); + checkNode(s, 9, 4, 2); + checkNode(s, 10, 3, 2); + checkNode(s, 11, 2, 1); + } + + @Test public void test_45() { + List s = lineOfSight(13, 8, 9, 0); + assertTrue(s.size() == 9); + checkNode(s, 0, 13, 8); + checkNode(s, 1, 12, 7); + checkNode(s, 2, 12, 6); + checkNode(s, 3, 11, 5); + checkNode(s, 4, 11, 4); + checkNode(s, 5, 10, 3); + checkNode(s, 6, 10, 2); + checkNode(s, 7, 9, 1); + checkNode(s, 8, 9, 0); + } + + @Test public void test_46() { + List s = lineOfSight(13, 8, 6, 0); + assertTrue(s.size() == 10); + checkNode(s, 0, 13, 8); + checkNode(s, 1, 12, 7); + checkNode(s, 2, 11, 6); + checkNode(s, 3, 10, 5); + checkNode(s, 4, 10, 4); + checkNode(s, 5, 9, 4); + checkNode(s, 6, 9, 3); + checkNode(s, 7, 8, 2); + checkNode(s, 8, 7, 1); + checkNode(s, 9, 6, 0); + } + + @Test public void test_47() { + List s = lineOfSight(13, 8, 3, 0); + assertTrue(s.size() == 11); + checkNode(s, 0, 13, 8); + checkNode(s, 1, 12, 7); + checkNode(s, 2, 11, 6); + checkNode(s, 3, 10, 6); + checkNode(s, 4, 9, 5); + checkNode(s, 5, 8, 4); + checkNode(s, 6, 7, 3); + checkNode(s, 7, 6, 2); + checkNode(s, 8, 5, 2); + checkNode(s, 9, 4, 1); + checkNode(s, 10, 3, 0); + } + + @Test public void test_48() { + List s = lineOfSight(13, 8, 0, 0); + assertTrue(s.size() == 14); + checkNode(s, 0, 13, 8); + checkNode(s, 1, 12, 7); + checkNode(s, 2, 11, 7); + checkNode(s, 3, 10, 6); + checkNode(s, 4, 9, 6); + checkNode(s, 5, 8, 5); + checkNode(s, 6, 7, 4); + checkNode(s, 7, 6, 4); + checkNode(s, 8, 5, 3); + checkNode(s, 9, 4, 2); + checkNode(s, 10, 3, 2); + checkNode(s, 11, 2, 1); + checkNode(s, 12, 1, 1); + checkNode(s, 13, 0, 0); + } + + // from top left + @Test public void test_49() { + List s = lineOfSight(4, 8, 5, 7); + assertTrue(s.size() == 4); + checkNode(s, 0, 4, 8); + checkNode(s, 1, 5, 8); + checkNode(s, 2, 4, 7); + checkNode(s, 3, 5, 7); + } + + @Test public void test_50() { + List s = lineOfSight(4, 8, 8, 7); + assertTrue(s.size() == 6); + checkNode(s, 0, 4, 8); + checkNode(s, 1, 5, 8); + checkNode(s, 2, 6, 8); + checkNode(s, 3, 6, 7); + checkNode(s, 4, 7, 7); + checkNode(s, 5, 8, 7); + } + + @Test public void test_51() { + List s = lineOfSight(4, 8, 11, 7); + assertTrue(s.size() == 10); + checkNode(s, 0, 4, 8); + checkNode(s, 1, 5, 8); + checkNode(s, 2, 6, 8); + checkNode(s, 3, 7, 8); + checkNode(s, 4, 7, 7); + checkNode(s, 5, 8, 8); + checkNode(s, 6, 8, 7); + checkNode(s, 7, 9, 7); + checkNode(s, 8, 10, 7); + checkNode(s, 9, 11, 7); + } + + @Test public void test_52() { + List s = lineOfSight(4, 8, 3, 6); + assertTrue(s.size() == 3); + checkNode(s, 0, 4, 8); + checkNode(s, 1, 4, 7); + checkNode(s, 2, 3, 6); + } + + @Test public void test_53() { + List s = lineOfSight(4, 8, 6, 6); + assertTrue(s.size() == 7); + checkNode(s, 0, 4, 8); + checkNode(s, 1, 5, 8); + checkNode(s, 2, 4, 7); + checkNode(s, 3, 5, 7); + checkNode(s, 4, 6, 7); + checkNode(s, 5, 5, 6); + checkNode(s, 6, 6, 6); + } + + @Test public void test_54() { + List s = lineOfSight(4, 8, 9, 6); + assertTrue(s.size() == 8); + checkNode(s, 0, 4, 8); + checkNode(s, 1, 5, 8); + checkNode(s, 2, 5, 7); + checkNode(s, 3, 6, 7); + checkNode(s, 4, 7, 7); + checkNode(s, 5, 8, 7); + checkNode(s, 6, 8, 6); + checkNode(s, 7, 9, 6); + } + + @Test public void test_55() { + List s = lineOfSight(4, 8, 12, 6); + assertTrue(s.size() == 11); + checkNode(s, 0, 4, 8); + checkNode(s, 1, 5, 8); + checkNode(s, 2, 6, 8); + checkNode(s, 3, 6, 7); + checkNode(s, 4, 7, 7); + checkNode(s, 5, 8, 7); + checkNode(s, 6, 9, 7); + checkNode(s, 7, 10, 7); + checkNode(s, 8, 10, 6); + checkNode(s, 9, 11, 6); + checkNode(s, 10, 12, 6); + } + + @Test public void test_56() { + List s = lineOfSight(4, 8, 7, 5); + assertTrue(s.size() == 10); + checkNode(s, 0, 4, 8); + checkNode(s, 1, 5, 8); + checkNode(s, 2, 4, 7); + checkNode(s, 3, 5, 7); + checkNode(s, 4, 6, 7); + checkNode(s, 5, 5, 6); + checkNode(s, 6, 6, 6); + checkNode(s, 7, 7, 6); + checkNode(s, 8, 6, 5); + checkNode(s, 9, 7, 5); + } + + @Test public void test_57() { + List s = lineOfSight(4, 8, 2, 4); + assertTrue(s.size() == 5); + checkNode(s, 0, 4, 8); + checkNode(s, 1, 4, 7); + checkNode(s, 2, 3, 6); + checkNode(s, 3, 3, 5); + checkNode(s, 4, 2, 4); + } + + @Test public void test_58() { + List s = lineOfSight(4, 8, 5, 4); + assertTrue(s.size() == 6); + checkNode(s, 0, 4, 8); + checkNode(s, 1, 4, 7); + checkNode(s, 2, 4, 6); + checkNode(s, 3, 5, 6); + checkNode(s, 4, 5, 5); + checkNode(s, 5, 5, 4); + } + + @Test public void test_59() { + List s = lineOfSight(4, 8, 8, 4); + assertTrue(s.size() == 13); + checkNode(s, 0, 4, 8); + checkNode(s, 1, 5, 8); + checkNode(s, 2, 4, 7); + checkNode(s, 3, 5, 7); + checkNode(s, 4, 6, 7); + checkNode(s, 5, 5, 6); + checkNode(s, 6, 6, 6); + checkNode(s, 7, 7, 6); + checkNode(s, 8, 6, 5); + checkNode(s, 9, 7, 5); + checkNode(s, 10, 8, 5); + checkNode(s, 11, 7, 4); + checkNode(s, 12, 8, 4); + } + + @Test public void test_60() { + List s = lineOfSight(4, 8, 11, 4); + assertTrue(s.size() == 12); + checkNode(s, 0, 4, 8); + checkNode(s, 1, 5, 8); + checkNode(s, 2, 5, 7); + checkNode(s, 3, 6, 7); + checkNode(s, 4, 7, 7); + checkNode(s, 5, 7, 6); + checkNode(s, 6, 8, 6); + checkNode(s, 7, 8, 5); + checkNode(s, 8, 9, 5); + checkNode(s, 9, 10, 5); + checkNode(s, 10, 10, 4); + checkNode(s, 11, 11, 4); + } + + @Test public void test_61() { + List s = lineOfSight(4, 8, 3, 3); + assertTrue(s.size() == 6); + checkNode(s, 0, 4, 8); + checkNode(s, 1, 4, 7); + checkNode(s, 2, 4, 6); + checkNode(s, 3, 3, 5); + checkNode(s, 4, 3, 4); + checkNode(s, 5, 3, 3); + } + + @Test public void test_62() { + List s = lineOfSight(4, 8, 6, 3); + assertTrue(s.size() == 8); + checkNode(s, 0, 4, 8); + checkNode(s, 1, 4, 7); + checkNode(s, 2, 5, 7); + checkNode(s, 3, 5, 6); + checkNode(s, 4, 5, 5); + checkNode(s, 5, 5, 4); + checkNode(s, 6, 6, 4); + checkNode(s, 7, 6, 3); + } + + @Test public void test_63() { + List s = lineOfSight(4, 8, 9, 3); + assertTrue(s.size() == 16); + checkNode(s, 0, 4, 8); + checkNode(s, 1, 5, 8); + checkNode(s, 2, 4, 7); + checkNode(s, 3, 5, 7); + checkNode(s, 4, 6, 7); + checkNode(s, 5, 5, 6); + checkNode(s, 6, 6, 6); + checkNode(s, 7, 7, 6); + checkNode(s, 8, 6, 5); + checkNode(s, 9, 7, 5); + checkNode(s, 10, 8, 5); + checkNode(s, 11, 7, 4); + checkNode(s, 12, 8, 4); + checkNode(s, 13, 9, 4); + checkNode(s, 14, 8, 3); + checkNode(s, 15, 9, 3); + } + + @Test public void test_64() { + List s = lineOfSight(4, 8, 1, 2); + assertTrue(s.size() == 7); + checkNode(s, 0, 4, 8); + checkNode(s, 1, 4, 7); + checkNode(s, 2, 3, 6); + checkNode(s, 3, 3, 5); + checkNode(s, 4, 2, 4); + checkNode(s, 5, 2, 3); + checkNode(s, 6, 1, 2); + } + + @Test public void test_65() { + List s = lineOfSight(4, 8, 10, 2); + assertTrue(s.size() == 19); + checkNode(s, 0, 4, 8); + checkNode(s, 1, 5, 8); + checkNode(s, 2, 4, 7); + checkNode(s, 3, 5, 7); + checkNode(s, 4, 6, 7); + checkNode(s, 5, 5, 6); + checkNode(s, 6, 6, 6); + checkNode(s, 7, 7, 6); + checkNode(s, 8, 6, 5); + checkNode(s, 9, 7, 5); + checkNode(s, 10, 8, 5); + checkNode(s, 11, 7, 4); + checkNode(s, 12, 8, 4); + checkNode(s, 13, 9, 4); + checkNode(s, 14, 8, 3); + checkNode(s, 15, 9, 3); + checkNode(s, 16, 10, 3); + checkNode(s, 17, 9, 2); + checkNode(s, 18, 10, 2); + } + + @Test public void test_66() { + List s = lineOfSight(4, 8, 2, 1); + assertTrue(s.size() == 8); + checkNode(s, 0, 4, 8); + checkNode(s, 1, 4, 7); + checkNode(s, 2, 3, 6); + checkNode(s, 3, 3, 5); + checkNode(s, 4, 3, 4); + checkNode(s, 5, 3, 3); + checkNode(s, 6, 2, 2); + checkNode(s, 7, 2, 1); + } + + @Test public void test_67() { + List s = lineOfSight(4, 8, 5, 1); + assertTrue(s.size() == 10); + checkNode(s, 0, 4, 8); + checkNode(s, 1, 4, 7); + checkNode(s, 2, 4, 6); + checkNode(s, 3, 4, 5); + checkNode(s, 4, 5, 5); + checkNode(s, 5, 4, 4); + checkNode(s, 6, 5, 4); + checkNode(s, 7, 5, 3); + checkNode(s, 8, 5, 2); + checkNode(s, 9, 5, 1); + } + + @Test public void test_68() { + List s = lineOfSight(4, 8, 8, 1); + assertTrue(s.size() == 12); + checkNode(s, 0, 4, 8); + checkNode(s, 1, 4, 7); + checkNode(s, 2, 5, 7); + checkNode(s, 3, 5, 6); + checkNode(s, 4, 5, 5); + checkNode(s, 5, 6, 5); + checkNode(s, 6, 6, 4); + checkNode(s, 7, 7, 4); + checkNode(s, 8, 7, 3); + checkNode(s, 9, 7, 2); + checkNode(s, 10, 8, 2); + checkNode(s, 11, 8, 1); + } + + @Test public void test_69() { + List s = lineOfSight(4, 8, 0, 0); + assertTrue(s.size() == 9); + checkNode(s, 0, 4, 8); + checkNode(s, 1, 4, 7); + checkNode(s, 2, 3, 6); + checkNode(s, 3, 3, 5); + checkNode(s, 4, 2, 4); + checkNode(s, 5, 2, 3); + checkNode(s, 6, 1, 2); + checkNode(s, 7, 1, 1); + checkNode(s, 8, 0, 0); + } + + @Test public void test_70() { + List s = lineOfSight(4, 8, 3, 0); + assertTrue(s.size() == 10); + checkNode(s, 0, 4, 8); + checkNode(s, 1, 4, 7); + checkNode(s, 2, 4, 6); + checkNode(s, 3, 4, 5); + checkNode(s, 4, 3, 4); + checkNode(s, 5, 4, 4); + checkNode(s, 6, 3, 3); + checkNode(s, 7, 3, 2); + checkNode(s, 8, 3, 1); + checkNode(s, 9, 3, 0); + } + + @Test public void test_71() { + List s = lineOfSight(4, 8, 6, 0); + assertTrue(s.size() == 11); + checkNode(s, 0, 4, 8); + checkNode(s, 1, 4, 7); + checkNode(s, 2, 4, 6); + checkNode(s, 3, 5, 6); + checkNode(s, 4, 5, 5); + checkNode(s, 5, 5, 4); + checkNode(s, 6, 5, 3); + checkNode(s, 7, 5, 2); + checkNode(s, 8, 6, 2); + checkNode(s, 9, 6, 1); + checkNode(s, 10, 6, 0); + } + + @Test public void test_72() { + List s = lineOfSight(4, 8, 9, 0); + assertTrue(s.size() == 14); + checkNode(s, 0, 4, 8); + checkNode(s, 1, 4, 7); + checkNode(s, 2, 5, 7); + checkNode(s, 3, 5, 6); + checkNode(s, 4, 6, 6); + checkNode(s, 5, 6, 5); + checkNode(s, 6, 6, 4); + checkNode(s, 7, 7, 4); + checkNode(s, 8, 7, 3); + checkNode(s, 9, 7, 2); + checkNode(s, 10, 8, 2); + checkNode(s, 11, 8, 1); + checkNode(s, 12, 9, 1); + checkNode(s, 13, 9, 0); + } + + // from bottom right + @Test public void test_73() { + List s = lineOfSight(9, 0, 8, 1); + assertTrue(s.size() == 4); + checkNode(s, 0, 9, 0); + checkNode(s, 1, 8, 0); + checkNode(s, 2, 9, 1); + checkNode(s, 3, 8, 1); + } + + @Test public void test_74() { + List s = lineOfSight(9, 0, 5, 1); + assertTrue(s.size() == 6); + checkNode(s, 0, 9, 0); + checkNode(s, 1, 8, 0); + checkNode(s, 2, 7, 0); + checkNode(s, 3, 7, 1); + checkNode(s, 4, 6, 1); + checkNode(s, 5, 5, 1); + } + + @Test public void test_75() { + List s = lineOfSight(9, 0, 2, 1); + assertTrue(s.size() == 10); + checkNode(s, 0, 9, 0); + checkNode(s, 1, 8, 0); + checkNode(s, 2, 7, 0); + checkNode(s, 3, 6, 0); + checkNode(s, 4, 6, 1); + checkNode(s, 5, 5, 0); + checkNode(s, 6, 5, 1); + checkNode(s, 7, 4, 1); + checkNode(s, 8, 3, 1); + checkNode(s, 9, 2, 1); + } + + @Test public void test_76() { + List s = lineOfSight(9, 0, 10, 2); + assertTrue(s.size() == 3); + checkNode(s, 0, 9, 0); + checkNode(s, 1, 9, 1); + checkNode(s, 2, 10, 2); + } + + @Test public void test_77() { + List s = lineOfSight(9, 0, 7, 2); + assertTrue(s.size() == 7); + checkNode(s, 0, 9, 0); + checkNode(s, 1, 8, 0); + checkNode(s, 2, 9, 1); + checkNode(s, 3, 8, 1); + checkNode(s, 4, 7, 1); + checkNode(s, 5, 8, 2); + checkNode(s, 6, 7, 2); + } + + @Test public void test_78() { + List s = lineOfSight(9, 0, 4, 2); + assertTrue(s.size() == 8); + checkNode(s, 0, 9, 0); + checkNode(s, 1, 8, 0); + checkNode(s, 2, 8, 1); + checkNode(s, 3, 7, 1); + checkNode(s, 4, 6, 1); + checkNode(s, 5, 5, 1); + checkNode(s, 6, 5, 2); + checkNode(s, 7, 4, 2); + } + + @Test public void test_79() { + List s = lineOfSight(9, 0, 1, 2); + assertTrue(s.size() == 11); + checkNode(s, 0, 9, 0); + checkNode(s, 1, 8, 0); + checkNode(s, 2, 7, 0); + checkNode(s, 3, 7, 1); + checkNode(s, 4, 6, 1); + checkNode(s, 5, 5, 1); + checkNode(s, 6, 4, 1); + checkNode(s, 7, 3, 1); + checkNode(s, 8, 3, 2); + checkNode(s, 9, 2, 2); + checkNode(s, 10, 1, 2); + } + + @Test public void test_80() { + List s = lineOfSight(9, 0, 6, 3); + assertTrue(s.size() == 10); + checkNode(s, 0, 9, 0); + checkNode(s, 1, 8, 0); + checkNode(s, 2, 9, 1); + checkNode(s, 3, 8, 1); + checkNode(s, 4, 7, 1); + checkNode(s, 5, 8, 2); + checkNode(s, 6, 7, 2); + checkNode(s, 7, 6, 2); + checkNode(s, 8, 7, 3); + checkNode(s, 9, 6, 3); + } + + @Test public void test_81() { + List s = lineOfSight(9, 0, 11, 4); + assertTrue(s.size() == 5); + checkNode(s, 0, 9, 0); + checkNode(s, 1, 9, 1); + checkNode(s, 2, 10, 2); + checkNode(s, 3, 10, 3); + checkNode(s, 4, 11, 4); + } + + @Test public void test_82() { + List s = lineOfSight(9, 0, 8, 4); + assertTrue(s.size() == 6); + checkNode(s, 0, 9, 0); + checkNode(s, 1, 9, 1); + checkNode(s, 2, 9, 2); + checkNode(s, 3, 8, 2); + checkNode(s, 4, 8, 3); + checkNode(s, 5, 8, 4); + } + + @Test public void test_83() { + List s = lineOfSight(9, 0, 5, 4); + assertTrue(s.size() == 13); + checkNode(s, 0, 9, 0); + checkNode(s, 1, 8, 0); + checkNode(s, 2, 9, 1); + checkNode(s, 3, 8, 1); + checkNode(s, 4, 7, 1); + checkNode(s, 5, 8, 2); + checkNode(s, 6, 7, 2); + checkNode(s, 7, 6, 2); + checkNode(s, 8, 7, 3); + checkNode(s, 9, 6, 3); + checkNode(s, 10, 5, 3); + checkNode(s, 11, 6, 4); + checkNode(s, 12, 5, 4); + } + + @Test public void test_84() { + List s = lineOfSight(9, 0, 2, 4); + assertTrue(s.size() == 12); + checkNode(s, 0, 9, 0); + checkNode(s, 1, 8, 0); + checkNode(s, 2, 8, 1); + checkNode(s, 3, 7, 1); + checkNode(s, 4, 6, 1); + checkNode(s, 5, 6, 2); + checkNode(s, 6, 5, 2); + checkNode(s, 7, 5, 3); + checkNode(s, 8, 4, 3); + checkNode(s, 9, 3, 3); + checkNode(s, 10, 3, 4); + checkNode(s, 11, 2, 4); + } + + @Test public void test_85() { + List s = lineOfSight(9, 0, 10, 5); + assertTrue(s.size() == 6); + checkNode(s, 0, 9, 0); + checkNode(s, 1, 9, 1); + checkNode(s, 2, 9, 2); + checkNode(s, 3, 10, 3); + checkNode(s, 4, 10, 4); + checkNode(s, 5, 10, 5); + } + + @Test public void test_86() { + List s = lineOfSight(9, 0, 7, 5); + assertTrue(s.size() == 8); + checkNode(s, 0, 9, 0); + checkNode(s, 1, 9, 1); + checkNode(s, 2, 8, 1); + checkNode(s, 3, 8, 2); + checkNode(s, 4, 8, 3); + checkNode(s, 5, 8, 4); + checkNode(s, 6, 7, 4); + checkNode(s, 7, 7, 5); + } + + @Test public void test_87() { + List s = lineOfSight(9, 0, 4, 5); + assertTrue(s.size() == 16); + checkNode(s, 0, 9, 0); + checkNode(s, 1, 8, 0); + checkNode(s, 2, 9, 1); + checkNode(s, 3, 8, 1); + checkNode(s, 4, 7, 1); + checkNode(s, 5, 8, 2); + checkNode(s, 6, 7, 2); + checkNode(s, 7, 6, 2); + checkNode(s, 8, 7, 3); + checkNode(s, 9, 6, 3); + checkNode(s, 10, 5, 3); + checkNode(s, 11, 6, 4); + checkNode(s, 12, 5, 4); + checkNode(s, 13, 4, 4); + checkNode(s, 14, 5, 5); + checkNode(s, 15, 4, 5); + } + + @Test public void test_88() { + List s = lineOfSight(9, 0, 12, 6); + assertTrue(s.size() == 7); + checkNode(s, 0, 9, 0); + checkNode(s, 1, 9, 1); + checkNode(s, 2, 10, 2); + checkNode(s, 3, 10, 3); + checkNode(s, 4, 11, 4); + checkNode(s, 5, 11, 5); + checkNode(s, 6, 12, 6); + } + + @Test public void test_89() { + List s = lineOfSight(9, 0, 3, 6); + assertTrue(s.size() == 19); + checkNode(s, 0, 9, 0); + checkNode(s, 1, 8, 0); + checkNode(s, 2, 9, 1); + checkNode(s, 3, 8, 1); + checkNode(s, 4, 7, 1); + checkNode(s, 5, 8, 2); + checkNode(s, 6, 7, 2); + checkNode(s, 7, 6, 2); + checkNode(s, 8, 7, 3); + checkNode(s, 9, 6, 3); + checkNode(s, 10, 5, 3); + checkNode(s, 11, 6, 4); + checkNode(s, 12, 5, 4); + checkNode(s, 13, 4, 4); + checkNode(s, 14, 5, 5); + checkNode(s, 15, 4, 5); + checkNode(s, 16, 3, 5); + checkNode(s, 17, 4, 6); + checkNode(s, 18, 3, 6); + } + + @Test public void test_90() { + List s = lineOfSight(9, 0, 11, 7); + assertTrue(s.size() == 8); + checkNode(s, 0, 9, 0); + checkNode(s, 1, 9, 1); + checkNode(s, 2, 10, 2); + checkNode(s, 3, 10, 3); + checkNode(s, 4, 10, 4); + checkNode(s, 5, 10, 5); + checkNode(s, 6, 11, 6); + checkNode(s, 7, 11, 7); + } + + @Test public void test_91() { + List s = lineOfSight(9, 0, 8, 7); + assertTrue(s.size() == 10); + checkNode(s, 0, 9, 0); + checkNode(s, 1, 9, 1); + checkNode(s, 2, 9, 2); + checkNode(s, 3, 9, 3); + checkNode(s, 4, 8, 3); + checkNode(s, 5, 9, 4); + checkNode(s, 6, 8, 4); + checkNode(s, 7, 8, 5); + checkNode(s, 8, 8, 6); + checkNode(s, 9, 8, 7); + } + + @Test public void test_92() { + List s = lineOfSight(9, 0, 5, 7); + assertTrue(s.size() == 12); + checkNode(s, 0, 9, 0); + checkNode(s, 1, 9, 1); + checkNode(s, 2, 8, 1); + checkNode(s, 3, 8, 2); + checkNode(s, 4, 8, 3); + checkNode(s, 5, 7, 3); + checkNode(s, 6, 7, 4); + checkNode(s, 7, 6, 4); + checkNode(s, 8, 6, 5); + checkNode(s, 9, 6, 6); + checkNode(s, 10, 5, 6); + checkNode(s, 11, 5, 7); + } + + @Test public void test_93() { + List s = lineOfSight(9, 0, 13, 8); + assertTrue(s.size() == 9); + checkNode(s, 0, 9, 0); + checkNode(s, 1, 9, 1); + checkNode(s, 2, 10, 2); + checkNode(s, 3, 10, 3); + checkNode(s, 4, 11, 4); + checkNode(s, 5, 11, 5); + checkNode(s, 6, 12, 6); + checkNode(s, 7, 12, 7); + checkNode(s, 8, 13, 8); + } + + @Test public void test_94() { + List s = lineOfSight(9, 0, 10, 8); + assertTrue(s.size() == 10); + checkNode(s, 0, 9, 0); + checkNode(s, 1, 9, 1); + checkNode(s, 2, 9, 2); + checkNode(s, 3, 9, 3); + checkNode(s, 4, 10, 4); + checkNode(s, 5, 9, 4); + checkNode(s, 6, 10, 5); + checkNode(s, 7, 10, 6); + checkNode(s, 8, 10, 7); + checkNode(s, 9, 10, 8); + } + + @Test public void test_95() { + List s = lineOfSight(9, 0, 7, 8); + assertTrue(s.size() == 11); + checkNode(s, 0, 9, 0); + checkNode(s, 1, 9, 1); + checkNode(s, 2, 9, 2); + checkNode(s, 3, 8, 2); + checkNode(s, 4, 8, 3); + checkNode(s, 5, 8, 4); + checkNode(s, 6, 8, 5); + checkNode(s, 7, 8, 6); + checkNode(s, 8, 7, 6); + checkNode(s, 9, 7, 7); + checkNode(s, 10, 7, 8); + } + + @Test public void test_96() { + List s = lineOfSight(9, 0, 4, 8); + assertTrue(s.size() == 14); + checkNode(s, 0, 9, 0); + checkNode(s, 1, 9, 1); + checkNode(s, 2, 8, 1); + checkNode(s, 3, 8, 2); + checkNode(s, 4, 7, 2); + checkNode(s, 5, 7, 3); + checkNode(s, 6, 7, 4); + checkNode(s, 7, 6, 4); + checkNode(s, 8, 6, 5); + checkNode(s, 9, 6, 6); + checkNode(s, 10, 5, 6); + checkNode(s, 11, 5, 7); + checkNode(s, 12, 4, 7); + checkNode(s, 13, 4, 8); + } +} diff --git a/core/test/ch/asynk/tankontank/BoardUtils.java b/core/test/ch/asynk/tankontank/BoardUtils.java deleted file mode 100644 index a0b5a1b..0000000 --- a/core/test/ch/asynk/tankontank/BoardUtils.java +++ /dev/null @@ -1,197 +0,0 @@ -package ch.asynk.rustanddust; - -import java.util.List; -import java.util.ArrayList; -import java.util.HashSet; - -import org.junit.Test; -import org.junit.Before; - -import ch.asynk.rustanddust.engine.Tile; -import ch.asynk.rustanddust.engine.Path; - -import static org.junit.Assert.assertTrue; - -public class BoardUtils -{ - private Helpers.FakeBoard b; - private Helpers.FakeSearchBoard sb; - - @Before - public void initialize() - { - int cols = 10; - int rows = 9; - int mvt = 3; - b = new Helpers.FakeBoard(cols, rows, 3); - sb = new Helpers.FakeSearchBoard(b, cols, rows); - } - - private void assertTile(Tile t, int col, int row) - { - assertTrue(t.getCol() == col); - assertTrue(t.getRow() == row); - } - - @Test - public void testPaths() - { - int n = b.buildPathBuilder(2, 2, 4, 3); - - assertTrue(b.pathBuilder.distance == 2); - assertTrue(n == 8); - - for(int p = 0; p < n; p++) { - - Path path = b.pathBuilder.getPath(p); - int z = path.tiles.size(); - assertTrue(path.cost == (z + 1)); - - Tile t; - int i = 0; - if (z == 1) { - t = path.tiles.get(i); - assertTrue(t.getCol() == 3); - assertTrue((t.getRow() == 2) || (t.getRow() == 3));; - } else if (z == 2) { - t = path.tiles.get(i); - if (t.getCol() == 2) { - i += 1; - if (t.getRow() == 1) { - t = path.tiles.get(i); - assertTile(t, 3, 2); - } else { - assert(t.getRow()== 3); - t = path.tiles.get(i); - assertTile(t, 3, 3); - } - } else if (t.getCol() == 3) { - i += 1; - if (t.getRow() == 2) { - t = path.tiles.get(i); - if (t.getCol() == 3) - assert(t.getRow()== 3); - else { - assertTile(t, 4, 2); - } - } else { - assert(t.getRow() == 3); - t = path.tiles.get(i); - if (t.getCol() == 3) - assert(t.getRow() == 2); - else { - assertTile(t, 4, 4); - } - } - } else { - assertTrue(false); - } - } else { - assertTrue(false); - } - } - } - - @Test - public void testPathSet() - { - int n = b.buildPathBuilder(2, 2, 3, 3); - assertTrue(n == 1); - - n = b.buildPathBuilder(2, 2, 4, 3); - assertTrue(n == 8); - - n = b.togglePoint(3, 3); - assertTrue(n == 1); - - n = b.buildPathBuilder(2, 2, 5, 3); - assertTrue(n == 3); - - n = b.togglePoint(3, 3); - assertTrue(n == 1); - - n = b.togglePoint(3, 3); - assertTrue(n == 3); - - n = b.togglePoint(3, 2); - assertTrue(n == 2); - - n = b.togglePoint(4, 2); - assertTrue(n == 1); - - } - - @Test - public void testDistance() - { - assertTrue(sb.distance(6, 4, 6, 4) == 0); - assertTrue(sb.distance(6, 4, 5, 4) == 1); - assertTrue(sb.distance(6, 4, 6, 5) == 1); - assertTrue(sb.distance(6, 4, 7, 5) == 1); - assertTrue(sb.distance(6, 4, 7, 4) == 1); - assertTrue(sb.distance(6, 4, 6, 3) == 1); - assertTrue(sb.distance(6, 4, 5, 3) == 1); - assertTrue(sb.distance(6, 4, 4, 4) == 2); - assertTrue(sb.distance(6, 4, 5, 5) == 2); - assertTrue(sb.distance(6, 4, 6, 6) == 2); - assertTrue(sb.distance(6, 4, 7, 6) == 2); - assertTrue(sb.distance(6, 4, 8, 6) == 2); - assertTrue(sb.distance(6, 4, 8, 5) == 2); - assertTrue(sb.distance(6, 4, 8, 4) == 2); - assertTrue(sb.distance(6, 4, 7, 3) == 2); - assertTrue(sb.distance(6, 4, 6, 2) == 2); - assertTrue(sb.distance(6, 4, 5, 2) == 2); - assertTrue(sb.distance(6, 4, 4, 2) == 2); - assertTrue(sb.distance(6, 4, 4, 3) == 2); - - assertTrue(sb.distance(6, 4, 9, 7) == 3); - assertTrue(sb.distance(6, 4, 10, 8) == 4); - assertTrue(sb.distance(6, 4, 6, 1) == 3); - assertTrue(sb.distance(6, 4, 9, 6) == 3); - assertTrue(sb.distance(6, 4, 9, 5) == 3); - assertTrue(sb.distance(6, 4, 10, 6) == 4); - assertTrue(sb.distance(6, 4, 3, 1) == 3); - assertTrue(sb.distance(6, 4, 2, 0) == 4); - - assertTrue(sb.distance(6, 4, 9, 4) == 3); - assertTrue(sb.distance(6, 4, 8, 4) == 2); - assertTrue(sb.distance(6, 4, 9, 5) == 3); - assertTrue(sb.distance(6, 4, 10, 5) == 4); - assertTrue(sb.distance(6, 4, 10, 4) == 4); - assertTrue(sb.distance(6, 4, 9, 3) == 4); - assertTrue(sb.distance(6, 4, 8, 3) == 3); - - assertTrue(sb.distance(6, 4, 8, 2) == 4); - assertTrue(sb.distance(6, 4, 7, 2) == 3); - assertTrue(sb.distance(6, 4, 8, 3) == 3); - assertTrue(sb.distance(6, 4, 9, 3) == 4); - assertTrue(sb.distance(6, 4, 9, 2) == 5); - assertTrue(sb.distance(6, 4, 8, 1) == 5); - assertTrue(sb.distance(6, 4, 7, 1) == 4); - - assertTrue(sb.distance(6, 4, 2, 2) == 4); - assertTrue(sb.distance(6, 4, 1, 2) == 5); - assertTrue(sb.distance(6, 4, 2, 3) == 4); - assertTrue(sb.distance(6, 4, 3, 3) == 3); - assertTrue(sb.distance(6, 4, 3, 2) == 3); - assertTrue(sb.distance(6, 4, 2, 1) == 4); - assertTrue(sb.distance(6, 4, 1, 1) == 5); - - assertTrue(sb.distance(6, 4, 5, 7) == 4); - assertTrue(sb.distance(6, 4, 4, 7) == 5); - assertTrue(sb.distance(6, 4, 5, 8) == 5); - assertTrue(sb.distance(6, 4, 6, 8) == 4); - assertTrue(sb.distance(6, 4, 6, 7) == 3); - assertTrue(sb.distance(6, 4, 5, 6) == 3); - assertTrue(sb.distance(6, 4, 4, 6) == 4); - - assertTrue(sb.distance(6, 4, 8, 8) == 4); - assertTrue(sb.distance(6, 4, 7, 8) == 4); - assertTrue(sb.distance(6, 4, 1, 1) == 5); - assertTrue(sb.distance(6, 4, 7, 0) == 5); - assertTrue(sb.distance(6, 4, 9, 8) == 4); - assertTrue(sb.distance(6, 4, 8, 7) == 3); - assertTrue(sb.distance(6, 4, 7, 7) == 3); - } - -} diff --git a/core/test/ch/asynk/tankontank/Helpers.java b/core/test/ch/asynk/tankontank/Helpers.java deleted file mode 100644 index 818f1a0..0000000 --- a/core/test/ch/asynk/tankontank/Helpers.java +++ /dev/null @@ -1,144 +0,0 @@ -package ch.asynk.rustanddust; - -import java.util.List; -import java.util.ArrayList; -import java.util.HashSet; - -import ch.asynk.rustanddust.engine.Pawn; -import ch.asynk.rustanddust.engine.Tile; -import ch.asynk.rustanddust.engine.Board; -import ch.asynk.rustanddust.engine.Orientation; -import ch.asynk.rustanddust.engine.SearchBoard; -import ch.asynk.rustanddust.engine.PathBuilder; - -public class Helpers -{ - public static class FakePawn extends Pawn - { - private int mvt; - public FakePawn (int mvt) - { - this.mvt = mvt; - } - - @Override public int getMovementPoints() { return mvt; } - @Override public int getRoadMarchBonus() { return 1; } - @Override public int getAngleOfAttack() { return 0; } - @Override public int getFlankSides() { return 0; } - @Override public int getDefense(Tile tile) { return 8; } - @Override public int getEngagementRangeFrom(Tile tile) { return 3; } - - @Override public boolean isA(PawnId id) { return true; } - @Override public boolean isA(PawnType type) { return true; } - @Override public boolean isHq() { return true; } - @Override public boolean isHqOf(Pawn other) { return true; } - @Override public boolean isUnit() { return true; } - @Override public boolean isHardTarget() { return true; } - @Override public boolean isEnemy(Pawn other) { return true; } - - @Override public boolean canMove() { return true; } - @Override public boolean canRotate() { return true; } - @Override public boolean canEngage() { return true; } - @Override public boolean canEngage(Pawn other) { return true; } - @Override public boolean canAssistEngagementWithoutLos() { return true; } - - @Override public void move() { } - @Override public void engage() { } - - @Override public void reset() { } - @Override public void revertLastMove() { } - } - - public static class FakeTile extends Tile - { - public boolean offMap; - - public FakeTile(int col, int row) - { - super(col, row); - offMap = false; - } - - public FakeTile(int col, int row, boolean offMap) - { - super(col, row); - this.offMap = offMap; - } - - @Override public boolean isOffMap() - { - return offMap; - } - @Override public int exitCost() { return 1; } - @Override public int costFrom(Pawn pawn, Orientation side) { return 1; } - @Override public int defense() { return 0; } - - @Override public boolean isA(TileTerrain terrain) { return true; } - @Override public boolean road(Orientation side) { return false; } - @Override public boolean atLeastOneMove(Pawn pawn) { return true; } - @Override public boolean blockLineOfSightFrom(Tile from) { return false; } - } - - public static class FakeSearchBoard extends SearchBoard - { - public FakeSearchBoard(Board b, int cols, int rows) - { - super(b, cols, rows); - } - - public int distance(int col0, int row0, int col1, int row1) - { - return distance(getNode(col0, row0), getNode(col1, row1)); - } - } - - public static class FakeBoard extends Board - { - public FakePawn pawn; - public FakeTile fakeTiles[]; - public PathBuilder pathBuilder; - - public FakeBoard(int cols, int rows, int mvt) - { - super(cols, rows); - fakeTiles = new FakeTile[(cols + 2) * (rows + 2)]; - - int idx = 0; - for (int i = -1; i < (rows + 1); i++) { - for ( int j = -1; j < (cols + 1); j ++) { - boolean offmap = ((j < 0) || (i < 0) || (j >= cols) || (i >= rows)); - fakeTiles[idx] = new FakeTile((j + ((i + 1) / 2)), i, offmap); - idx += 1; - } - } - - fakeTiles[ 36 - 2].offMap = true; - fakeTiles[ 60 - 2].offMap = true; - fakeTiles[ 84 - 2].offMap = true; - fakeTiles[108 - 2].offMap = true; - - pawn = new FakePawn(mvt); - pathBuilder = new PathBuilder(this, 10, 20, 5, 10); - } - - @Override - public Tile getTile(int col, int row) - { - int i = getTileOffset(col, row); - if (i < 0) - return null; - return fakeTiles[i]; - } - - public int buildPathBuilder(int x0, int y0, int x1, int y1) - { - pathBuilder.init(pawn, getTile(x0, y0)); - return pathBuilder.build(getTile(x1, y1)); - } - - public int togglePoint(int x, int y) - { - return pathBuilder.toggleCtrlTile(getTile(x, y)); - } - } -} diff --git a/core/test/ch/asynk/tankontank/LineOfSightTest.java b/core/test/ch/asynk/tankontank/LineOfSightTest.java deleted file mode 100644 index 60b95ab..0000000 --- a/core/test/ch/asynk/tankontank/LineOfSightTest.java +++ /dev/null @@ -1,1421 +0,0 @@ -package ch.asynk.rustanddust; - -import java.util.List; - -import org.junit.Test; -import org.junit.Before; - -import ch.asynk.rustanddust.engine.SearchBoard; -import ch.asynk.rustanddust.engine.SearchBoard.Node; - -import static org.junit.Assert.assertTrue; - -public class LineOfSightTest -{ - private SearchBoard sb; - - @Before - public void initialize() - { - int cols = 10; - int rows = 9; - Helpers.FakeBoard fakeBoard = new Helpers.FakeBoard(cols, rows, 0); - sb = new SearchBoard(fakeBoard, cols, rows); - } - - private void checkNode(List l, int i, int col, int row) - { - Node n = l.get(i); - assertTrue(n.col == col); - assertTrue(n.row == row); - } - - private List lineOfSight(int x0, int y0, int x1, int y1) - { - return sb.lineOfSight(x0, y0, x1, y1, true); - } - - // from bottom left - @Test public void test_1() { - List s = lineOfSight(0, 0, 2, 1); - assertTrue(s.size() == 4); - checkNode(s, 0, 0, 0); - checkNode(s, 1, 1, 0); - checkNode(s, 2, 1, 1); - checkNode(s, 3, 2, 1); - } - - @Test public void test_2() { - List s = lineOfSight(0, 0, 5, 1); - assertTrue(s.size() == 6); - checkNode(s, 0, 0, 0); - checkNode(s, 1, 1, 0); - checkNode(s, 2, 2, 0); - checkNode(s, 3, 3, 1); - checkNode(s, 4, 4, 1); - checkNode(s, 5, 5, 1); - } - - @Test public void test_3() { - List s = lineOfSight(0, 0, 8, 1); - assertTrue(s.size() == 10); - checkNode(s, 0, 0, 0); - checkNode(s, 1, 1, 0); - checkNode(s, 2, 2, 0); - checkNode(s, 3, 3, 0); - checkNode(s, 4, 4, 1); - checkNode(s, 5, 4, 0); - checkNode(s, 6, 5, 1); - checkNode(s, 7, 6, 1); - checkNode(s, 8, 7, 1); - checkNode(s, 9, 8, 1); - } - - @Test public void test_4() { - List s = lineOfSight(0, 0, 1, 2); - assertTrue(s.size() == 3); - checkNode(s, 0, 0, 0); - checkNode(s, 1, 1, 1); - checkNode(s, 2, 1, 2); - } - - @Test public void test_5() { - List s = lineOfSight(0, 0, 4, 2); - assertTrue(s.size() == 7); - checkNode(s, 0, 0, 0); - checkNode(s, 1, 1, 0); - checkNode(s, 2, 1, 1); - checkNode(s, 3, 2, 1); - checkNode(s, 4, 3, 1); - checkNode(s, 5, 3, 2); - checkNode(s, 6, 4, 2); - } - - @Test public void test_6() { - List s = lineOfSight(0, 0, 7, 2); - assertTrue(s.size() == 8); - checkNode(s, 0, 0, 0); - checkNode(s, 1, 1, 0); - checkNode(s, 2, 2, 1); - checkNode(s, 3, 3, 1); - checkNode(s, 4, 4, 1); - checkNode(s, 5, 5, 1); - checkNode(s, 6, 6, 2); - checkNode(s, 7, 7, 2); - } - - @Test public void test_7() { - List s = lineOfSight(0, 0, 10, 2); - assertTrue(s.size() == 11); - checkNode(s, 0, 0, 0); - checkNode(s, 1, 1, 0); - checkNode(s, 2, 2, 0); - checkNode(s, 3, 3, 1); - checkNode(s, 4, 4, 1); - checkNode(s, 5, 5, 1); - checkNode(s, 6, 6, 1); - checkNode(s, 7, 7, 1); - checkNode(s, 8, 8, 2); - checkNode(s, 9, 9, 2); - checkNode(s, 10, 10, 2); - } - - @Test public void test_8() { - List s = lineOfSight(0, 0, 6, 3); - assertTrue(s.size() == 10); - checkNode(s, 0, 0, 0); - checkNode(s, 1, 1, 0); - checkNode(s, 2, 1, 1); - checkNode(s, 3, 2, 1); - checkNode(s, 4, 3, 1); - checkNode(s, 5, 3, 2); - checkNode(s, 6, 4, 2); - checkNode(s, 7, 5, 2); - checkNode(s, 8, 5, 3); - checkNode(s, 9, 6, 3); - } - - @Test public void test_9() { - List s = lineOfSight(0, 0, 2, 4); - assertTrue(s.size() == 5); - checkNode(s, 0, 0, 0); - checkNode(s, 1, 1, 1); - checkNode(s, 2, 1, 2); - checkNode(s, 3, 2, 3); - checkNode(s, 4, 2, 4); - } - - @Test public void test_10() { - List s = lineOfSight(0, 0, 5, 4); - assertTrue(s.size() == 6); - checkNode(s, 0, 0, 0); - checkNode(s, 1, 1, 1); - checkNode(s, 2, 2, 2); - checkNode(s, 3, 3, 2); - checkNode(s, 4, 4, 3); - checkNode(s, 5, 5, 4); - } - - @Test public void test_11() { - List s = lineOfSight(0, 0, 8, 4); - assertTrue(s.size() == 13); - checkNode(s, 0, 0, 0); - checkNode(s, 1, 1, 0); - checkNode(s, 2, 1, 1); - checkNode(s, 3, 2, 1); - checkNode(s, 4, 3, 1); - checkNode(s, 5, 3, 2); - checkNode(s, 6, 4, 2); - checkNode(s, 7, 5, 2); - checkNode(s, 8, 5, 3); - checkNode(s, 9, 6, 3); - checkNode(s, 10, 7, 3); - checkNode(s, 11, 7, 4); - checkNode(s, 12, 8, 4); - } - - @Test public void test_12() { - List s = lineOfSight(0, 0, 11, 4); - assertTrue(s.size() == 12); - checkNode(s, 0, 0, 0); - checkNode(s, 1, 1, 0); - checkNode(s, 2, 2, 1); - checkNode(s, 3, 3, 1); - checkNode(s, 4, 4, 1); - checkNode(s, 5, 5, 2); - checkNode(s, 6, 6, 2); - checkNode(s, 7, 7, 3); - checkNode(s, 8, 8, 3); - checkNode(s, 9, 9, 3); - checkNode(s, 10, 10, 4); - checkNode(s, 11, 11, 4); - } - - @Test public void test_13() { - List s = lineOfSight(0, 0, 4, 5); - assertTrue(s.size() == 6); - checkNode(s, 0, 0, 0); - checkNode(s, 1, 1, 1); - checkNode(s, 2, 2, 2); - checkNode(s, 3, 2, 3); - checkNode(s, 4, 3, 4); - checkNode(s, 5, 4, 5); - } - - @Test public void test_14() { - List s = lineOfSight(0, 0, 7, 5); - assertTrue(s.size() == 8); - checkNode(s, 0, 0, 0); - checkNode(s, 1, 1, 1); - checkNode(s, 2, 2, 1); - checkNode(s, 3, 3, 2); - checkNode(s, 4, 4, 3); - checkNode(s, 5, 5, 4); - checkNode(s, 6, 6, 4); - checkNode(s, 7, 7, 5); - } - - @Test public void test_15() { - List s = lineOfSight(0, 0, 10, 5); - assertTrue(s.size() == 16); - checkNode(s, 0, 0, 0); - checkNode(s, 1, 1, 0); - checkNode(s, 2, 1, 1); - checkNode(s, 3, 2, 1); - checkNode(s, 4, 3, 1); - checkNode(s, 5, 3, 2); - checkNode(s, 6, 4, 2); - checkNode(s, 7, 5, 2); - checkNode(s, 8, 5, 3); - checkNode(s, 9, 6, 3); - checkNode(s, 10, 7, 3); - checkNode(s, 11, 7, 4); - checkNode(s, 12, 8, 4); - checkNode(s, 13, 9, 4); - checkNode(s, 14, 9, 5); - checkNode(s, 15, 10, 5); - } - - @Test public void test_16() { - List s = lineOfSight(0, 0, 3, 6); - assertTrue(s.size() == 7); - checkNode(s, 0, 0, 0); - checkNode(s, 1, 1, 1); - checkNode(s, 2, 1, 2); - checkNode(s, 3, 2, 3); - checkNode(s, 4, 2, 4); - checkNode(s, 5, 3, 5); - checkNode(s, 6, 3, 6); - } - - @Test public void test_17() { - List s = lineOfSight(0, 0, 12, 6); - assertTrue(s.size() == 19); - checkNode(s, 0, 0, 0); - checkNode(s, 1, 1, 0); - checkNode(s, 2, 1, 1); - checkNode(s, 3, 2, 1); - checkNode(s, 4, 3, 1); - checkNode(s, 5, 3, 2); - checkNode(s, 6, 4, 2); - checkNode(s, 7, 5, 2); - checkNode(s, 8, 5, 3); - checkNode(s, 9, 6, 3); - checkNode(s, 10, 7, 3); - checkNode(s, 11, 7, 4); - checkNode(s, 12, 8, 4); - checkNode(s, 13, 9, 4); - checkNode(s, 14, 9, 5); - checkNode(s, 15, 10, 5); - checkNode(s, 16, 11, 5); - checkNode(s, 17, 11, 6); - checkNode(s, 18, 12, 6); - } - - @Test public void test_18() { - List s = lineOfSight(0, 0, 5, 7); - assertTrue(s.size() == 8); - checkNode(s, 0, 0, 0); - checkNode(s, 1, 1, 1); - checkNode(s, 2, 1, 2); - checkNode(s, 3, 2, 3); - checkNode(s, 4, 3, 4); - checkNode(s, 5, 4, 5); - checkNode(s, 6, 4, 6); - checkNode(s, 7, 5, 7); - } - - @Test public void test_19() { - List s = lineOfSight(0, 0, 8, 7); - assertTrue(s.size() == 10); - checkNode(s, 0, 0, 0); - checkNode(s, 1, 1, 1); - checkNode(s, 2, 2, 2); - checkNode(s, 3, 3, 3); - checkNode(s, 4, 4, 3); - checkNode(s, 5, 4, 4); - checkNode(s, 6, 5, 4); - checkNode(s, 7, 6, 5); - checkNode(s, 8, 7, 6); - checkNode(s, 9, 8, 7); - } - - @Test public void test_20() { - List s = lineOfSight(0, 0, 11, 7); - assertTrue(s.size() == 12); - checkNode(s, 0, 0, 0); - checkNode(s, 1, 1, 1); - checkNode(s, 2, 2, 1); - checkNode(s, 3, 3, 2); - checkNode(s, 4, 4, 3); - checkNode(s, 5, 5, 3); - checkNode(s, 6, 6, 4); - checkNode(s, 7, 7, 4); - checkNode(s, 8, 8, 5); - checkNode(s, 9, 9, 6); - checkNode(s, 10, 10, 6); - checkNode(s, 11, 11, 7); - } - - @Test public void test_21() { - List s = lineOfSight(0, 0, 4, 8); - assertTrue(s.size() == 9); - checkNode(s, 0, 0, 0); - checkNode(s, 1, 1, 1); - checkNode(s, 2, 1, 2); - checkNode(s, 3, 2, 3); - checkNode(s, 4, 2, 4); - checkNode(s, 5, 3, 5); - checkNode(s, 6, 3, 6); - checkNode(s, 7, 4, 7); - checkNode(s, 8, 4, 8); - } - - @Test public void test_22() { - List s = lineOfSight(0, 0, 7, 8); - assertTrue(s.size() == 10); - checkNode(s, 0, 0, 0); - checkNode(s, 1, 1, 1); - checkNode(s, 2, 2, 2); - checkNode(s, 3, 3, 3); - checkNode(s, 4, 3, 4); - checkNode(s, 5, 4, 4); - checkNode(s, 6, 4, 5); - checkNode(s, 7, 5, 6); - checkNode(s, 8, 6, 7); - checkNode(s, 9, 7, 8); - } - - @Test public void test_23() { - List s = lineOfSight(0, 0, 10, 8); - assertTrue(s.size() == 11); - checkNode(s, 0, 0, 0); - checkNode(s, 1, 1, 1); - checkNode(s, 2, 2, 2); - checkNode(s, 3, 3, 2); - checkNode(s, 4, 4, 3); - checkNode(s, 5, 5, 4); - checkNode(s, 6, 6, 5); - checkNode(s, 7, 7, 6); - checkNode(s, 8, 8, 6); - checkNode(s, 9, 9, 7); - checkNode(s, 10, 10, 8); - } - - @Test public void test_24() { - List s = lineOfSight(0, 0, 13, 8); - assertTrue(s.size() == 14); - checkNode(s, 0, 0, 0); - checkNode(s, 1, 1, 1); - checkNode(s, 2, 2, 1); - checkNode(s, 3, 3, 2); - checkNode(s, 4, 4, 2); - checkNode(s, 5, 5, 3); - checkNode(s, 6, 6, 4); - checkNode(s, 7, 7, 4); - checkNode(s, 8, 8, 5); - checkNode(s, 9, 9, 6); - checkNode(s, 10, 10, 6); - checkNode(s, 11, 11, 7); - checkNode(s, 12, 12, 7); - checkNode(s, 13, 13, 8); - } - - // from top right - @Test public void test_25() { - List s = lineOfSight(13, 8, 11, 7); - assertTrue(s.size() == 4); - checkNode(s, 0, 13, 8); - checkNode(s, 1, 12, 8); - checkNode(s, 2, 12, 7); - checkNode(s, 3, 11, 7); - } - - @Test public void test_26() { - List s = lineOfSight(13, 8, 8, 7); - assertTrue(s.size() == 6); - checkNode(s, 0, 13, 8); - checkNode(s, 1, 12, 8); - checkNode(s, 2, 11, 8); - checkNode(s, 3, 10, 7); - checkNode(s, 4, 9, 7); - checkNode(s, 5, 8, 7); - } - - @Test public void test_27() { - List s = lineOfSight(13, 8, 5, 7); - assertTrue(s.size() == 10); - checkNode(s, 0, 13, 8); - checkNode(s, 1, 12, 8); - checkNode(s, 2, 11, 8); - checkNode(s, 3, 10, 8); - checkNode(s, 4, 9, 7); - checkNode(s, 5, 9, 8); - checkNode(s, 6, 8, 7); - checkNode(s, 7, 7, 7); - checkNode(s, 8, 6, 7); - checkNode(s, 9, 5, 7); - } - - @Test public void test_28() { - List s = lineOfSight(13, 8, 12, 6); - assertTrue(s.size() == 3); - checkNode(s, 0, 13, 8); - checkNode(s, 1, 12, 7); - checkNode(s, 2, 12, 6); - } - - @Test public void test_29() { - List s = lineOfSight(13, 8, 9, 6); - assertTrue(s.size() == 7); - checkNode(s, 0, 13, 8); - checkNode(s, 1, 12, 8); - checkNode(s, 2, 12, 7); - checkNode(s, 3, 11, 7); - checkNode(s, 4, 10, 7); - checkNode(s, 5, 10, 6); - checkNode(s, 6, 9, 6); - } - - @Test public void test_30() { - List s = lineOfSight(13, 8, 6, 6); - assertTrue(s.size() == 8); - checkNode(s, 0, 13, 8); - checkNode(s, 1, 12, 8); - checkNode(s, 2, 11, 7); - checkNode(s, 3, 10, 7); - checkNode(s, 4, 9, 7); - checkNode(s, 5, 8, 7); - checkNode(s, 6, 7, 6); - checkNode(s, 7, 6, 6); - } - - @Test public void test_31() { - List s = lineOfSight(13, 8, 3, 6); - assertTrue(s.size() == 11); - checkNode(s, 0, 13, 8); - checkNode(s, 1, 12, 8); - checkNode(s, 2, 11, 8); - checkNode(s, 3, 10, 7); - checkNode(s, 4, 9, 7); - checkNode(s, 5, 8, 7); - checkNode(s, 6, 7, 7); - checkNode(s, 7, 6, 7); - checkNode(s, 8, 5, 6); - checkNode(s, 9, 4, 6); - checkNode(s, 10, 3, 6); - } - - @Test public void test_32() { - List s = lineOfSight(13, 8, 7, 5); - assertTrue(s.size() == 10); - checkNode(s, 0, 13, 8); - checkNode(s, 1, 12, 8); - checkNode(s, 2, 12, 7); - checkNode(s, 3, 11, 7); - checkNode(s, 4, 10, 7); - checkNode(s, 5, 10, 6); - checkNode(s, 6, 9, 6); - checkNode(s, 7, 8, 6); - checkNode(s, 8, 8, 5); - checkNode(s, 9, 7, 5); - } - - @Test public void test_33() { - List s = lineOfSight(13, 8, 11, 4); - assertTrue(s.size() == 5); - checkNode(s, 0, 13, 8); - checkNode(s, 1, 12, 7); - checkNode(s, 2, 12, 6); - checkNode(s, 3, 11, 5); - checkNode(s, 4, 11, 4); - } - - @Test public void test_34() { - List s = lineOfSight(13, 8, 8, 4); - assertTrue(s.size() == 6); - checkNode(s, 0, 13, 8); - checkNode(s, 1, 12, 7); - checkNode(s, 2, 11, 6); - checkNode(s, 3, 10, 6); - checkNode(s, 4, 9, 5); - checkNode(s, 5, 8, 4); - } - - @Test public void test_35() { - List s = lineOfSight(13, 8, 5, 4); - assertTrue(s.size() == 13); - checkNode(s, 0, 13, 8); - checkNode(s, 1, 12, 8); - checkNode(s, 2, 12, 7); - checkNode(s, 3, 11, 7); - checkNode(s, 4, 10, 7); - checkNode(s, 5, 10, 6); - checkNode(s, 6, 9, 6); - checkNode(s, 7, 8, 6); - checkNode(s, 8, 8, 5); - checkNode(s, 9, 7, 5); - checkNode(s, 10, 6, 5); - checkNode(s, 11, 6, 4); - checkNode(s, 12, 5, 4); - } - - @Test public void test_36() { - List s = lineOfSight(13, 8, 2, 4); - assertTrue(s.size() == 12); - checkNode(s, 0, 13, 8); - checkNode(s, 1, 12, 8); - checkNode(s, 2, 11, 7); - checkNode(s, 3, 10, 7); - checkNode(s, 4, 9, 7); - checkNode(s, 5, 8, 6); - checkNode(s, 6, 7, 6); - checkNode(s, 7, 6, 5); - checkNode(s, 8, 5, 5); - checkNode(s, 9, 4, 5); - checkNode(s, 10, 3, 4); - checkNode(s, 11, 2, 4); - } - - @Test public void test_37() { - List s = lineOfSight(13, 8, 9, 3); - assertTrue(s.size() == 6); - checkNode(s, 0, 13, 8); - checkNode(s, 1, 12, 7); - checkNode(s, 2, 11, 6); - checkNode(s, 3, 11, 5); - checkNode(s, 4, 10, 4); - checkNode(s, 5, 9, 3); - } - - @Test public void test_38() { - List s = lineOfSight(13, 8, 6, 3); - assertTrue(s.size() == 8); - checkNode(s, 0, 13, 8); - checkNode(s, 1, 12, 7); - checkNode(s, 2, 11, 7); - checkNode(s, 3, 10, 6); - checkNode(s, 4, 9, 5); - checkNode(s, 5, 8, 4); - checkNode(s, 6, 7, 4); - checkNode(s, 7, 6, 3); - } - - @Test public void test_39() { - List s = lineOfSight(13, 8, 3, 3); - assertTrue(s.size() == 16); - checkNode(s, 0, 13, 8); - checkNode(s, 1, 12, 8); - checkNode(s, 2, 12, 7); - checkNode(s, 3, 11, 7); - checkNode(s, 4, 10, 7); - checkNode(s, 5, 10, 6); - checkNode(s, 6, 9, 6); - checkNode(s, 7, 8, 6); - checkNode(s, 8, 8, 5); - checkNode(s, 9, 7, 5); - checkNode(s, 10, 6, 5); - checkNode(s, 11, 6, 4); - checkNode(s, 12, 5, 4); - checkNode(s, 13, 4, 4); - checkNode(s, 14, 4, 3); - checkNode(s, 15, 3, 3); - } - - @Test public void test_40() { - List s = lineOfSight(13, 8, 10, 2); - assertTrue(s.size() == 7); - checkNode(s, 0, 13, 8); - checkNode(s, 1, 12, 7); - checkNode(s, 2, 12, 6); - checkNode(s, 3, 11, 5); - checkNode(s, 4, 11, 4); - checkNode(s, 5, 10, 3); - checkNode(s, 6, 10, 2); - } - - @Test public void test_41() { - List s = lineOfSight(13, 8, 1, 2); - assertTrue(s.size() == 19); - checkNode(s, 0, 13, 8); - checkNode(s, 1, 12, 8); - checkNode(s, 2, 12, 7); - checkNode(s, 3, 11, 7); - checkNode(s, 4, 10, 7); - checkNode(s, 5, 10, 6); - checkNode(s, 6, 9, 6); - checkNode(s, 7, 8, 6); - checkNode(s, 8, 8, 5); - checkNode(s, 9, 7, 5); - checkNode(s, 10, 6, 5); - checkNode(s, 11, 6, 4); - checkNode(s, 12, 5, 4); - checkNode(s, 13, 4, 4); - checkNode(s, 14, 4, 3); - checkNode(s, 15, 3, 3); - checkNode(s, 16, 2, 3); - checkNode(s, 17, 2, 2); - checkNode(s, 18, 1, 2); - } - - @Test public void test_42() { - List s = lineOfSight(13, 8, 8, 1); - assertTrue(s.size() == 8); - checkNode(s, 0, 13, 8); - checkNode(s, 1, 12, 7); - checkNode(s, 2, 12, 6); - checkNode(s, 3, 11, 5); - checkNode(s, 4, 10, 4); - checkNode(s, 5, 9, 3); - checkNode(s, 6, 9, 2); - checkNode(s, 7, 8, 1); - } - - @Test public void test_43() { - List s = lineOfSight(13, 8, 5, 1); - assertTrue(s.size() == 10); - checkNode(s, 0, 13, 8); - checkNode(s, 1, 12, 7); - checkNode(s, 2, 11, 6); - checkNode(s, 3, 10, 5); - checkNode(s, 4, 9, 5); - checkNode(s, 5, 9, 4); - checkNode(s, 6, 8, 4); - checkNode(s, 7, 7, 3); - checkNode(s, 8, 6, 2); - checkNode(s, 9, 5, 1); - } - - @Test public void test_44() { - List s = lineOfSight(13, 8, 2, 1); - assertTrue(s.size() == 12); - checkNode(s, 0, 13, 8); - checkNode(s, 1, 12, 7); - checkNode(s, 2, 11, 7); - checkNode(s, 3, 10, 6); - checkNode(s, 4, 9, 5); - checkNode(s, 5, 8, 5); - checkNode(s, 6, 7, 4); - checkNode(s, 7, 6, 4); - checkNode(s, 8, 5, 3); - checkNode(s, 9, 4, 2); - checkNode(s, 10, 3, 2); - checkNode(s, 11, 2, 1); - } - - @Test public void test_45() { - List s = lineOfSight(13, 8, 9, 0); - assertTrue(s.size() == 9); - checkNode(s, 0, 13, 8); - checkNode(s, 1, 12, 7); - checkNode(s, 2, 12, 6); - checkNode(s, 3, 11, 5); - checkNode(s, 4, 11, 4); - checkNode(s, 5, 10, 3); - checkNode(s, 6, 10, 2); - checkNode(s, 7, 9, 1); - checkNode(s, 8, 9, 0); - } - - @Test public void test_46() { - List s = lineOfSight(13, 8, 6, 0); - assertTrue(s.size() == 10); - checkNode(s, 0, 13, 8); - checkNode(s, 1, 12, 7); - checkNode(s, 2, 11, 6); - checkNode(s, 3, 10, 5); - checkNode(s, 4, 10, 4); - checkNode(s, 5, 9, 4); - checkNode(s, 6, 9, 3); - checkNode(s, 7, 8, 2); - checkNode(s, 8, 7, 1); - checkNode(s, 9, 6, 0); - } - - @Test public void test_47() { - List s = lineOfSight(13, 8, 3, 0); - assertTrue(s.size() == 11); - checkNode(s, 0, 13, 8); - checkNode(s, 1, 12, 7); - checkNode(s, 2, 11, 6); - checkNode(s, 3, 10, 6); - checkNode(s, 4, 9, 5); - checkNode(s, 5, 8, 4); - checkNode(s, 6, 7, 3); - checkNode(s, 7, 6, 2); - checkNode(s, 8, 5, 2); - checkNode(s, 9, 4, 1); - checkNode(s, 10, 3, 0); - } - - @Test public void test_48() { - List s = lineOfSight(13, 8, 0, 0); - assertTrue(s.size() == 14); - checkNode(s, 0, 13, 8); - checkNode(s, 1, 12, 7); - checkNode(s, 2, 11, 7); - checkNode(s, 3, 10, 6); - checkNode(s, 4, 9, 6); - checkNode(s, 5, 8, 5); - checkNode(s, 6, 7, 4); - checkNode(s, 7, 6, 4); - checkNode(s, 8, 5, 3); - checkNode(s, 9, 4, 2); - checkNode(s, 10, 3, 2); - checkNode(s, 11, 2, 1); - checkNode(s, 12, 1, 1); - checkNode(s, 13, 0, 0); - } - - // from top left - @Test public void test_49() { - List s = lineOfSight(4, 8, 5, 7); - assertTrue(s.size() == 4); - checkNode(s, 0, 4, 8); - checkNode(s, 1, 5, 8); - checkNode(s, 2, 4, 7); - checkNode(s, 3, 5, 7); - } - - @Test public void test_50() { - List s = lineOfSight(4, 8, 8, 7); - assertTrue(s.size() == 6); - checkNode(s, 0, 4, 8); - checkNode(s, 1, 5, 8); - checkNode(s, 2, 6, 8); - checkNode(s, 3, 6, 7); - checkNode(s, 4, 7, 7); - checkNode(s, 5, 8, 7); - } - - @Test public void test_51() { - List s = lineOfSight(4, 8, 11, 7); - assertTrue(s.size() == 10); - checkNode(s, 0, 4, 8); - checkNode(s, 1, 5, 8); - checkNode(s, 2, 6, 8); - checkNode(s, 3, 7, 8); - checkNode(s, 4, 7, 7); - checkNode(s, 5, 8, 8); - checkNode(s, 6, 8, 7); - checkNode(s, 7, 9, 7); - checkNode(s, 8, 10, 7); - checkNode(s, 9, 11, 7); - } - - @Test public void test_52() { - List s = lineOfSight(4, 8, 3, 6); - assertTrue(s.size() == 3); - checkNode(s, 0, 4, 8); - checkNode(s, 1, 4, 7); - checkNode(s, 2, 3, 6); - } - - @Test public void test_53() { - List s = lineOfSight(4, 8, 6, 6); - assertTrue(s.size() == 7); - checkNode(s, 0, 4, 8); - checkNode(s, 1, 5, 8); - checkNode(s, 2, 4, 7); - checkNode(s, 3, 5, 7); - checkNode(s, 4, 6, 7); - checkNode(s, 5, 5, 6); - checkNode(s, 6, 6, 6); - } - - @Test public void test_54() { - List s = lineOfSight(4, 8, 9, 6); - assertTrue(s.size() == 8); - checkNode(s, 0, 4, 8); - checkNode(s, 1, 5, 8); - checkNode(s, 2, 5, 7); - checkNode(s, 3, 6, 7); - checkNode(s, 4, 7, 7); - checkNode(s, 5, 8, 7); - checkNode(s, 6, 8, 6); - checkNode(s, 7, 9, 6); - } - - @Test public void test_55() { - List s = lineOfSight(4, 8, 12, 6); - assertTrue(s.size() == 11); - checkNode(s, 0, 4, 8); - checkNode(s, 1, 5, 8); - checkNode(s, 2, 6, 8); - checkNode(s, 3, 6, 7); - checkNode(s, 4, 7, 7); - checkNode(s, 5, 8, 7); - checkNode(s, 6, 9, 7); - checkNode(s, 7, 10, 7); - checkNode(s, 8, 10, 6); - checkNode(s, 9, 11, 6); - checkNode(s, 10, 12, 6); - } - - @Test public void test_56() { - List s = lineOfSight(4, 8, 7, 5); - assertTrue(s.size() == 10); - checkNode(s, 0, 4, 8); - checkNode(s, 1, 5, 8); - checkNode(s, 2, 4, 7); - checkNode(s, 3, 5, 7); - checkNode(s, 4, 6, 7); - checkNode(s, 5, 5, 6); - checkNode(s, 6, 6, 6); - checkNode(s, 7, 7, 6); - checkNode(s, 8, 6, 5); - checkNode(s, 9, 7, 5); - } - - @Test public void test_57() { - List s = lineOfSight(4, 8, 2, 4); - assertTrue(s.size() == 5); - checkNode(s, 0, 4, 8); - checkNode(s, 1, 4, 7); - checkNode(s, 2, 3, 6); - checkNode(s, 3, 3, 5); - checkNode(s, 4, 2, 4); - } - - @Test public void test_58() { - List s = lineOfSight(4, 8, 5, 4); - assertTrue(s.size() == 6); - checkNode(s, 0, 4, 8); - checkNode(s, 1, 4, 7); - checkNode(s, 2, 4, 6); - checkNode(s, 3, 5, 6); - checkNode(s, 4, 5, 5); - checkNode(s, 5, 5, 4); - } - - @Test public void test_59() { - List s = lineOfSight(4, 8, 8, 4); - assertTrue(s.size() == 13); - checkNode(s, 0, 4, 8); - checkNode(s, 1, 5, 8); - checkNode(s, 2, 4, 7); - checkNode(s, 3, 5, 7); - checkNode(s, 4, 6, 7); - checkNode(s, 5, 5, 6); - checkNode(s, 6, 6, 6); - checkNode(s, 7, 7, 6); - checkNode(s, 8, 6, 5); - checkNode(s, 9, 7, 5); - checkNode(s, 10, 8, 5); - checkNode(s, 11, 7, 4); - checkNode(s, 12, 8, 4); - } - - @Test public void test_60() { - List s = lineOfSight(4, 8, 11, 4); - assertTrue(s.size() == 12); - checkNode(s, 0, 4, 8); - checkNode(s, 1, 5, 8); - checkNode(s, 2, 5, 7); - checkNode(s, 3, 6, 7); - checkNode(s, 4, 7, 7); - checkNode(s, 5, 7, 6); - checkNode(s, 6, 8, 6); - checkNode(s, 7, 8, 5); - checkNode(s, 8, 9, 5); - checkNode(s, 9, 10, 5); - checkNode(s, 10, 10, 4); - checkNode(s, 11, 11, 4); - } - - @Test public void test_61() { - List s = lineOfSight(4, 8, 3, 3); - assertTrue(s.size() == 6); - checkNode(s, 0, 4, 8); - checkNode(s, 1, 4, 7); - checkNode(s, 2, 4, 6); - checkNode(s, 3, 3, 5); - checkNode(s, 4, 3, 4); - checkNode(s, 5, 3, 3); - } - - @Test public void test_62() { - List s = lineOfSight(4, 8, 6, 3); - assertTrue(s.size() == 8); - checkNode(s, 0, 4, 8); - checkNode(s, 1, 4, 7); - checkNode(s, 2, 5, 7); - checkNode(s, 3, 5, 6); - checkNode(s, 4, 5, 5); - checkNode(s, 5, 5, 4); - checkNode(s, 6, 6, 4); - checkNode(s, 7, 6, 3); - } - - @Test public void test_63() { - List s = lineOfSight(4, 8, 9, 3); - assertTrue(s.size() == 16); - checkNode(s, 0, 4, 8); - checkNode(s, 1, 5, 8); - checkNode(s, 2, 4, 7); - checkNode(s, 3, 5, 7); - checkNode(s, 4, 6, 7); - checkNode(s, 5, 5, 6); - checkNode(s, 6, 6, 6); - checkNode(s, 7, 7, 6); - checkNode(s, 8, 6, 5); - checkNode(s, 9, 7, 5); - checkNode(s, 10, 8, 5); - checkNode(s, 11, 7, 4); - checkNode(s, 12, 8, 4); - checkNode(s, 13, 9, 4); - checkNode(s, 14, 8, 3); - checkNode(s, 15, 9, 3); - } - - @Test public void test_64() { - List s = lineOfSight(4, 8, 1, 2); - assertTrue(s.size() == 7); - checkNode(s, 0, 4, 8); - checkNode(s, 1, 4, 7); - checkNode(s, 2, 3, 6); - checkNode(s, 3, 3, 5); - checkNode(s, 4, 2, 4); - checkNode(s, 5, 2, 3); - checkNode(s, 6, 1, 2); - } - - @Test public void test_65() { - List s = lineOfSight(4, 8, 10, 2); - assertTrue(s.size() == 19); - checkNode(s, 0, 4, 8); - checkNode(s, 1, 5, 8); - checkNode(s, 2, 4, 7); - checkNode(s, 3, 5, 7); - checkNode(s, 4, 6, 7); - checkNode(s, 5, 5, 6); - checkNode(s, 6, 6, 6); - checkNode(s, 7, 7, 6); - checkNode(s, 8, 6, 5); - checkNode(s, 9, 7, 5); - checkNode(s, 10, 8, 5); - checkNode(s, 11, 7, 4); - checkNode(s, 12, 8, 4); - checkNode(s, 13, 9, 4); - checkNode(s, 14, 8, 3); - checkNode(s, 15, 9, 3); - checkNode(s, 16, 10, 3); - checkNode(s, 17, 9, 2); - checkNode(s, 18, 10, 2); - } - - @Test public void test_66() { - List s = lineOfSight(4, 8, 2, 1); - assertTrue(s.size() == 8); - checkNode(s, 0, 4, 8); - checkNode(s, 1, 4, 7); - checkNode(s, 2, 3, 6); - checkNode(s, 3, 3, 5); - checkNode(s, 4, 3, 4); - checkNode(s, 5, 3, 3); - checkNode(s, 6, 2, 2); - checkNode(s, 7, 2, 1); - } - - @Test public void test_67() { - List s = lineOfSight(4, 8, 5, 1); - assertTrue(s.size() == 10); - checkNode(s, 0, 4, 8); - checkNode(s, 1, 4, 7); - checkNode(s, 2, 4, 6); - checkNode(s, 3, 4, 5); - checkNode(s, 4, 5, 5); - checkNode(s, 5, 4, 4); - checkNode(s, 6, 5, 4); - checkNode(s, 7, 5, 3); - checkNode(s, 8, 5, 2); - checkNode(s, 9, 5, 1); - } - - @Test public void test_68() { - List s = lineOfSight(4, 8, 8, 1); - assertTrue(s.size() == 12); - checkNode(s, 0, 4, 8); - checkNode(s, 1, 4, 7); - checkNode(s, 2, 5, 7); - checkNode(s, 3, 5, 6); - checkNode(s, 4, 5, 5); - checkNode(s, 5, 6, 5); - checkNode(s, 6, 6, 4); - checkNode(s, 7, 7, 4); - checkNode(s, 8, 7, 3); - checkNode(s, 9, 7, 2); - checkNode(s, 10, 8, 2); - checkNode(s, 11, 8, 1); - } - - @Test public void test_69() { - List s = lineOfSight(4, 8, 0, 0); - assertTrue(s.size() == 9); - checkNode(s, 0, 4, 8); - checkNode(s, 1, 4, 7); - checkNode(s, 2, 3, 6); - checkNode(s, 3, 3, 5); - checkNode(s, 4, 2, 4); - checkNode(s, 5, 2, 3); - checkNode(s, 6, 1, 2); - checkNode(s, 7, 1, 1); - checkNode(s, 8, 0, 0); - } - - @Test public void test_70() { - List s = lineOfSight(4, 8, 3, 0); - assertTrue(s.size() == 10); - checkNode(s, 0, 4, 8); - checkNode(s, 1, 4, 7); - checkNode(s, 2, 4, 6); - checkNode(s, 3, 4, 5); - checkNode(s, 4, 3, 4); - checkNode(s, 5, 4, 4); - checkNode(s, 6, 3, 3); - checkNode(s, 7, 3, 2); - checkNode(s, 8, 3, 1); - checkNode(s, 9, 3, 0); - } - - @Test public void test_71() { - List s = lineOfSight(4, 8, 6, 0); - assertTrue(s.size() == 11); - checkNode(s, 0, 4, 8); - checkNode(s, 1, 4, 7); - checkNode(s, 2, 4, 6); - checkNode(s, 3, 5, 6); - checkNode(s, 4, 5, 5); - checkNode(s, 5, 5, 4); - checkNode(s, 6, 5, 3); - checkNode(s, 7, 5, 2); - checkNode(s, 8, 6, 2); - checkNode(s, 9, 6, 1); - checkNode(s, 10, 6, 0); - } - - @Test public void test_72() { - List s = lineOfSight(4, 8, 9, 0); - assertTrue(s.size() == 14); - checkNode(s, 0, 4, 8); - checkNode(s, 1, 4, 7); - checkNode(s, 2, 5, 7); - checkNode(s, 3, 5, 6); - checkNode(s, 4, 6, 6); - checkNode(s, 5, 6, 5); - checkNode(s, 6, 6, 4); - checkNode(s, 7, 7, 4); - checkNode(s, 8, 7, 3); - checkNode(s, 9, 7, 2); - checkNode(s, 10, 8, 2); - checkNode(s, 11, 8, 1); - checkNode(s, 12, 9, 1); - checkNode(s, 13, 9, 0); - } - - // from bottom right - @Test public void test_73() { - List s = lineOfSight(9, 0, 8, 1); - assertTrue(s.size() == 4); - checkNode(s, 0, 9, 0); - checkNode(s, 1, 8, 0); - checkNode(s, 2, 9, 1); - checkNode(s, 3, 8, 1); - } - - @Test public void test_74() { - List s = lineOfSight(9, 0, 5, 1); - assertTrue(s.size() == 6); - checkNode(s, 0, 9, 0); - checkNode(s, 1, 8, 0); - checkNode(s, 2, 7, 0); - checkNode(s, 3, 7, 1); - checkNode(s, 4, 6, 1); - checkNode(s, 5, 5, 1); - } - - @Test public void test_75() { - List s = lineOfSight(9, 0, 2, 1); - assertTrue(s.size() == 10); - checkNode(s, 0, 9, 0); - checkNode(s, 1, 8, 0); - checkNode(s, 2, 7, 0); - checkNode(s, 3, 6, 0); - checkNode(s, 4, 6, 1); - checkNode(s, 5, 5, 0); - checkNode(s, 6, 5, 1); - checkNode(s, 7, 4, 1); - checkNode(s, 8, 3, 1); - checkNode(s, 9, 2, 1); - } - - @Test public void test_76() { - List s = lineOfSight(9, 0, 10, 2); - assertTrue(s.size() == 3); - checkNode(s, 0, 9, 0); - checkNode(s, 1, 9, 1); - checkNode(s, 2, 10, 2); - } - - @Test public void test_77() { - List s = lineOfSight(9, 0, 7, 2); - assertTrue(s.size() == 7); - checkNode(s, 0, 9, 0); - checkNode(s, 1, 8, 0); - checkNode(s, 2, 9, 1); - checkNode(s, 3, 8, 1); - checkNode(s, 4, 7, 1); - checkNode(s, 5, 8, 2); - checkNode(s, 6, 7, 2); - } - - @Test public void test_78() { - List s = lineOfSight(9, 0, 4, 2); - assertTrue(s.size() == 8); - checkNode(s, 0, 9, 0); - checkNode(s, 1, 8, 0); - checkNode(s, 2, 8, 1); - checkNode(s, 3, 7, 1); - checkNode(s, 4, 6, 1); - checkNode(s, 5, 5, 1); - checkNode(s, 6, 5, 2); - checkNode(s, 7, 4, 2); - } - - @Test public void test_79() { - List s = lineOfSight(9, 0, 1, 2); - assertTrue(s.size() == 11); - checkNode(s, 0, 9, 0); - checkNode(s, 1, 8, 0); - checkNode(s, 2, 7, 0); - checkNode(s, 3, 7, 1); - checkNode(s, 4, 6, 1); - checkNode(s, 5, 5, 1); - checkNode(s, 6, 4, 1); - checkNode(s, 7, 3, 1); - checkNode(s, 8, 3, 2); - checkNode(s, 9, 2, 2); - checkNode(s, 10, 1, 2); - } - - @Test public void test_80() { - List s = lineOfSight(9, 0, 6, 3); - assertTrue(s.size() == 10); - checkNode(s, 0, 9, 0); - checkNode(s, 1, 8, 0); - checkNode(s, 2, 9, 1); - checkNode(s, 3, 8, 1); - checkNode(s, 4, 7, 1); - checkNode(s, 5, 8, 2); - checkNode(s, 6, 7, 2); - checkNode(s, 7, 6, 2); - checkNode(s, 8, 7, 3); - checkNode(s, 9, 6, 3); - } - - @Test public void test_81() { - List s = lineOfSight(9, 0, 11, 4); - assertTrue(s.size() == 5); - checkNode(s, 0, 9, 0); - checkNode(s, 1, 9, 1); - checkNode(s, 2, 10, 2); - checkNode(s, 3, 10, 3); - checkNode(s, 4, 11, 4); - } - - @Test public void test_82() { - List s = lineOfSight(9, 0, 8, 4); - assertTrue(s.size() == 6); - checkNode(s, 0, 9, 0); - checkNode(s, 1, 9, 1); - checkNode(s, 2, 9, 2); - checkNode(s, 3, 8, 2); - checkNode(s, 4, 8, 3); - checkNode(s, 5, 8, 4); - } - - @Test public void test_83() { - List s = lineOfSight(9, 0, 5, 4); - assertTrue(s.size() == 13); - checkNode(s, 0, 9, 0); - checkNode(s, 1, 8, 0); - checkNode(s, 2, 9, 1); - checkNode(s, 3, 8, 1); - checkNode(s, 4, 7, 1); - checkNode(s, 5, 8, 2); - checkNode(s, 6, 7, 2); - checkNode(s, 7, 6, 2); - checkNode(s, 8, 7, 3); - checkNode(s, 9, 6, 3); - checkNode(s, 10, 5, 3); - checkNode(s, 11, 6, 4); - checkNode(s, 12, 5, 4); - } - - @Test public void test_84() { - List s = lineOfSight(9, 0, 2, 4); - assertTrue(s.size() == 12); - checkNode(s, 0, 9, 0); - checkNode(s, 1, 8, 0); - checkNode(s, 2, 8, 1); - checkNode(s, 3, 7, 1); - checkNode(s, 4, 6, 1); - checkNode(s, 5, 6, 2); - checkNode(s, 6, 5, 2); - checkNode(s, 7, 5, 3); - checkNode(s, 8, 4, 3); - checkNode(s, 9, 3, 3); - checkNode(s, 10, 3, 4); - checkNode(s, 11, 2, 4); - } - - @Test public void test_85() { - List s = lineOfSight(9, 0, 10, 5); - assertTrue(s.size() == 6); - checkNode(s, 0, 9, 0); - checkNode(s, 1, 9, 1); - checkNode(s, 2, 9, 2); - checkNode(s, 3, 10, 3); - checkNode(s, 4, 10, 4); - checkNode(s, 5, 10, 5); - } - - @Test public void test_86() { - List s = lineOfSight(9, 0, 7, 5); - assertTrue(s.size() == 8); - checkNode(s, 0, 9, 0); - checkNode(s, 1, 9, 1); - checkNode(s, 2, 8, 1); - checkNode(s, 3, 8, 2); - checkNode(s, 4, 8, 3); - checkNode(s, 5, 8, 4); - checkNode(s, 6, 7, 4); - checkNode(s, 7, 7, 5); - } - - @Test public void test_87() { - List s = lineOfSight(9, 0, 4, 5); - assertTrue(s.size() == 16); - checkNode(s, 0, 9, 0); - checkNode(s, 1, 8, 0); - checkNode(s, 2, 9, 1); - checkNode(s, 3, 8, 1); - checkNode(s, 4, 7, 1); - checkNode(s, 5, 8, 2); - checkNode(s, 6, 7, 2); - checkNode(s, 7, 6, 2); - checkNode(s, 8, 7, 3); - checkNode(s, 9, 6, 3); - checkNode(s, 10, 5, 3); - checkNode(s, 11, 6, 4); - checkNode(s, 12, 5, 4); - checkNode(s, 13, 4, 4); - checkNode(s, 14, 5, 5); - checkNode(s, 15, 4, 5); - } - - @Test public void test_88() { - List s = lineOfSight(9, 0, 12, 6); - assertTrue(s.size() == 7); - checkNode(s, 0, 9, 0); - checkNode(s, 1, 9, 1); - checkNode(s, 2, 10, 2); - checkNode(s, 3, 10, 3); - checkNode(s, 4, 11, 4); - checkNode(s, 5, 11, 5); - checkNode(s, 6, 12, 6); - } - - @Test public void test_89() { - List s = lineOfSight(9, 0, 3, 6); - assertTrue(s.size() == 19); - checkNode(s, 0, 9, 0); - checkNode(s, 1, 8, 0); - checkNode(s, 2, 9, 1); - checkNode(s, 3, 8, 1); - checkNode(s, 4, 7, 1); - checkNode(s, 5, 8, 2); - checkNode(s, 6, 7, 2); - checkNode(s, 7, 6, 2); - checkNode(s, 8, 7, 3); - checkNode(s, 9, 6, 3); - checkNode(s, 10, 5, 3); - checkNode(s, 11, 6, 4); - checkNode(s, 12, 5, 4); - checkNode(s, 13, 4, 4); - checkNode(s, 14, 5, 5); - checkNode(s, 15, 4, 5); - checkNode(s, 16, 3, 5); - checkNode(s, 17, 4, 6); - checkNode(s, 18, 3, 6); - } - - @Test public void test_90() { - List s = lineOfSight(9, 0, 11, 7); - assertTrue(s.size() == 8); - checkNode(s, 0, 9, 0); - checkNode(s, 1, 9, 1); - checkNode(s, 2, 10, 2); - checkNode(s, 3, 10, 3); - checkNode(s, 4, 10, 4); - checkNode(s, 5, 10, 5); - checkNode(s, 6, 11, 6); - checkNode(s, 7, 11, 7); - } - - @Test public void test_91() { - List s = lineOfSight(9, 0, 8, 7); - assertTrue(s.size() == 10); - checkNode(s, 0, 9, 0); - checkNode(s, 1, 9, 1); - checkNode(s, 2, 9, 2); - checkNode(s, 3, 9, 3); - checkNode(s, 4, 8, 3); - checkNode(s, 5, 9, 4); - checkNode(s, 6, 8, 4); - checkNode(s, 7, 8, 5); - checkNode(s, 8, 8, 6); - checkNode(s, 9, 8, 7); - } - - @Test public void test_92() { - List s = lineOfSight(9, 0, 5, 7); - assertTrue(s.size() == 12); - checkNode(s, 0, 9, 0); - checkNode(s, 1, 9, 1); - checkNode(s, 2, 8, 1); - checkNode(s, 3, 8, 2); - checkNode(s, 4, 8, 3); - checkNode(s, 5, 7, 3); - checkNode(s, 6, 7, 4); - checkNode(s, 7, 6, 4); - checkNode(s, 8, 6, 5); - checkNode(s, 9, 6, 6); - checkNode(s, 10, 5, 6); - checkNode(s, 11, 5, 7); - } - - @Test public void test_93() { - List s = lineOfSight(9, 0, 13, 8); - assertTrue(s.size() == 9); - checkNode(s, 0, 9, 0); - checkNode(s, 1, 9, 1); - checkNode(s, 2, 10, 2); - checkNode(s, 3, 10, 3); - checkNode(s, 4, 11, 4); - checkNode(s, 5, 11, 5); - checkNode(s, 6, 12, 6); - checkNode(s, 7, 12, 7); - checkNode(s, 8, 13, 8); - } - - @Test public void test_94() { - List s = lineOfSight(9, 0, 10, 8); - assertTrue(s.size() == 10); - checkNode(s, 0, 9, 0); - checkNode(s, 1, 9, 1); - checkNode(s, 2, 9, 2); - checkNode(s, 3, 9, 3); - checkNode(s, 4, 10, 4); - checkNode(s, 5, 9, 4); - checkNode(s, 6, 10, 5); - checkNode(s, 7, 10, 6); - checkNode(s, 8, 10, 7); - checkNode(s, 9, 10, 8); - } - - @Test public void test_95() { - List s = lineOfSight(9, 0, 7, 8); - assertTrue(s.size() == 11); - checkNode(s, 0, 9, 0); - checkNode(s, 1, 9, 1); - checkNode(s, 2, 9, 2); - checkNode(s, 3, 8, 2); - checkNode(s, 4, 8, 3); - checkNode(s, 5, 8, 4); - checkNode(s, 6, 8, 5); - checkNode(s, 7, 8, 6); - checkNode(s, 8, 7, 6); - checkNode(s, 9, 7, 7); - checkNode(s, 10, 7, 8); - } - - @Test public void test_96() { - List s = lineOfSight(9, 0, 4, 8); - assertTrue(s.size() == 14); - checkNode(s, 0, 9, 0); - checkNode(s, 1, 9, 1); - checkNode(s, 2, 8, 1); - checkNode(s, 3, 8, 2); - checkNode(s, 4, 7, 2); - checkNode(s, 5, 7, 3); - checkNode(s, 6, 7, 4); - checkNode(s, 7, 6, 4); - checkNode(s, 8, 6, 5); - checkNode(s, 9, 6, 6); - checkNode(s, 10, 5, 6); - checkNode(s, 11, 5, 7); - checkNode(s, 12, 4, 7); - checkNode(s, 13, 4, 8); - } -} diff --git a/desktop/src/ch/asynk/rustanddust/desktop/DesktopLauncher.java b/desktop/src/ch/asynk/rustanddust/desktop/DesktopLauncher.java new file mode 100644 index 0000000..61f2fbc --- /dev/null +++ b/desktop/src/ch/asynk/rustanddust/desktop/DesktopLauncher.java @@ -0,0 +1,18 @@ +package ch.asynk.rustanddust.desktop; + +import com.badlogic.gdx.backends.lwjgl.LwjglApplication; +import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration; +import com.badlogic.gdx.Files; +import ch.asynk.rustanddust.RustAndDust; + +public class DesktopLauncher { + public static void main (String[] arg) { + LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); + config.title = "Dust And Rust"; + config.width = 1024; + config.height = 768; + // config.fullscreen = true; + config.addIcon("data/icon.png", Files.FileType.Internal); + new LwjglApplication(new RustAndDust(), config); + } +} diff --git a/desktop/src/ch/asynk/tankontank/desktop/DesktopLauncher.java b/desktop/src/ch/asynk/tankontank/desktop/DesktopLauncher.java deleted file mode 100644 index 0a63b0d..0000000 --- a/desktop/src/ch/asynk/tankontank/desktop/DesktopLauncher.java +++ /dev/null @@ -1,18 +0,0 @@ -package ch.asynk.rustanddust.desktop; - -import com.badlogic.gdx.backends.lwjgl.LwjglApplication; -import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration; -import com.badlogic.gdx.Files; -import ch.asynk.rustanddust.RustAndDust; - -public class DesktopLauncher { - public static void main (String[] arg) { - LwjglApplicationConfiguration config = new LwjglApplicationConfiguration(); - config.title = "Creeping Armor"; - config.width = 1024; - config.height = 768; - // config.fullscreen = true; - config.addIcon("data/icon.png", Files.FileType.Internal); - new LwjglApplication(new RustAndDust(), config); - } -} diff --git a/html/src/ch/asynk/rustanddust/GdxDefinition.gwt.xml b/html/src/ch/asynk/rustanddust/GdxDefinition.gwt.xml new file mode 100644 index 0000000..08f74c0 --- /dev/null +++ b/html/src/ch/asynk/rustanddust/GdxDefinition.gwt.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/html/src/ch/asynk/rustanddust/GdxDefinitionSuperdev.gwt.xml b/html/src/ch/asynk/rustanddust/GdxDefinitionSuperdev.gwt.xml new file mode 100644 index 0000000..1a592f2 --- /dev/null +++ b/html/src/ch/asynk/rustanddust/GdxDefinitionSuperdev.gwt.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/html/src/ch/asynk/rustanddust/client/HtmlLauncher.java b/html/src/ch/asynk/rustanddust/client/HtmlLauncher.java new file mode 100644 index 0000000..a0e7ea0 --- /dev/null +++ b/html/src/ch/asynk/rustanddust/client/HtmlLauncher.java @@ -0,0 +1,19 @@ +package ch.asynk.rustanddust.client; + +import com.badlogic.gdx.ApplicationListener; +import com.badlogic.gdx.backends.gwt.GwtApplication; +import com.badlogic.gdx.backends.gwt.GwtApplicationConfiguration; +import ch.asynk.rustanddust.RustAndDust; + +public class HtmlLauncher extends GwtApplication { + + @Override + public GwtApplicationConfiguration getConfig () { + return new GwtApplicationConfiguration(480, 320); + } + + @Override + public ApplicationListener getApplicationListener () { + return new RustAndDust(); + } +} \ No newline at end of file diff --git a/html/src/ch/asynk/tankontank/GdxDefinition.gwt.xml b/html/src/ch/asynk/tankontank/GdxDefinition.gwt.xml deleted file mode 100644 index 08f74c0..0000000 --- a/html/src/ch/asynk/tankontank/GdxDefinition.gwt.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/html/src/ch/asynk/tankontank/GdxDefinitionSuperdev.gwt.xml b/html/src/ch/asynk/tankontank/GdxDefinitionSuperdev.gwt.xml deleted file mode 100644 index 1a592f2..0000000 --- a/html/src/ch/asynk/tankontank/GdxDefinitionSuperdev.gwt.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/html/src/ch/asynk/tankontank/client/HtmlLauncher.java b/html/src/ch/asynk/tankontank/client/HtmlLauncher.java deleted file mode 100644 index a0e7ea0..0000000 --- a/html/src/ch/asynk/tankontank/client/HtmlLauncher.java +++ /dev/null @@ -1,19 +0,0 @@ -package ch.asynk.rustanddust.client; - -import com.badlogic.gdx.ApplicationListener; -import com.badlogic.gdx.backends.gwt.GwtApplication; -import com.badlogic.gdx.backends.gwt.GwtApplicationConfiguration; -import ch.asynk.rustanddust.RustAndDust; - -public class HtmlLauncher extends GwtApplication { - - @Override - public GwtApplicationConfiguration getConfig () { - return new GwtApplicationConfiguration(480, 320); - } - - @Override - public ApplicationListener getApplicationListener () { - return new RustAndDust(); - } -} \ No newline at end of file diff --git a/ios/src/ch/asynk/rustanddust/IOSLauncher.java b/ios/src/ch/asynk/rustanddust/IOSLauncher.java new file mode 100644 index 0000000..df242cf --- /dev/null +++ b/ios/src/ch/asynk/rustanddust/IOSLauncher.java @@ -0,0 +1,22 @@ +package ch.asynk.rustanddust; + +import org.robovm.apple.foundation.NSAutoreleasePool; +import org.robovm.apple.uikit.UIApplication; + +import com.badlogic.gdx.backends.iosrobovm.IOSApplication; +import com.badlogic.gdx.backends.iosrobovm.IOSApplicationConfiguration; +import ch.asynk.rustanddust.RustAndDust; + +public class IOSLauncher extends IOSApplication.Delegate { + @Override + protected IOSApplication createApplication() { + IOSApplicationConfiguration config = new IOSApplicationConfiguration(); + return new IOSApplication(new RustAndDust(), config); + } + + public static void main(String[] argv) { + NSAutoreleasePool pool = new NSAutoreleasePool(); + UIApplication.main(argv, null, IOSLauncher.class); + pool.close(); + } +} \ No newline at end of file diff --git a/ios/src/ch/asynk/tankontank/IOSLauncher.java b/ios/src/ch/asynk/tankontank/IOSLauncher.java deleted file mode 100644 index df242cf..0000000 --- a/ios/src/ch/asynk/tankontank/IOSLauncher.java +++ /dev/null @@ -1,22 +0,0 @@ -package ch.asynk.rustanddust; - -import org.robovm.apple.foundation.NSAutoreleasePool; -import org.robovm.apple.uikit.UIApplication; - -import com.badlogic.gdx.backends.iosrobovm.IOSApplication; -import com.badlogic.gdx.backends.iosrobovm.IOSApplicationConfiguration; -import ch.asynk.rustanddust.RustAndDust; - -public class IOSLauncher extends IOSApplication.Delegate { - @Override - protected IOSApplication createApplication() { - IOSApplicationConfiguration config = new IOSApplicationConfiguration(); - return new IOSApplication(new RustAndDust(), config); - } - - public static void main(String[] argv) { - NSAutoreleasePool pool = new NSAutoreleasePool(); - UIApplication.main(argv, null, IOSLauncher.class); - pool.close(); - } -} \ No newline at end of file -- cgit v1.1-2-g2b99