public void plotting_boardWithOneRectShape() { CaveBoard board = new CaveBoard(6, 6); IXShape room = new RectShape(new Cell(2, 2), new OIGrid(2, 2)); room.setCellValue(0, 0, XTile.FLOOR); room.setCellValue(0, 1, XTile.FLOOR); room.setCellValue(1, 0, XTile.FLOOR); room.setCellValue(1, 1, XTile.FLOOR); board.addRoom(room); int[,] expected = new int[6, 6] { { 0, 0, 0, 0, 0, 0 }, { 0, 0, 1, 1, 0, 0 }, { 0, 1, 0, 0, 1, 0 }, { 0, 1, 0, 0, 1, 0 }, { 0, 0, 1, 1, 0, 0 }, { 0, 0, 0, 0, 0, 0 } }; ZeroOneCavePlotter plotter = new ZeroOneCavePlotter(); plotter.applyOn(board); Assert.IsTrue(XTestUtils.areEquals(expected, plotter.result())); }
public void absCellsFacingIncoming_case2() { RectShape shape = new RectShape(new Cell(0, 5), new OIGrid(5, 5)); shape.setCellValue(0, 0, XTile.FLOOR); shape.setCellValue(0, 1, XTile.FLOOR); shape.setCellValue(0, 2, XTile.FLOOR); shape.setCellValue(1, 0, XTile.FLOOR); shape.setCellValue(1, 1, XTile.FLOOR); shape.setCellValue(1, 2, XTile.FLOOR); shape.setCellValue(2, 0, XTile.FLOOR); shape.setCellValue(2, 1, XTile.FLOOR); shape.setCellValue(2, 2, XTile.FLOOR); FreeShape inShape = new FreeShape(); inShape.setCellValue(0, 2, XTile.FLOOR); inShape.setCellValue(1, 2, XTile.FLOOR); inShape.setCellValue(0, 3, XTile.FLOOR); inShape.setCellValue(1, 3, XTile.FLOOR); inShape.setCellValue(0, 4, XTile.FLOOR); inShape.setCellValue(1, 4, XTile.FLOOR); shape.setIncoming(inShape); Cell[] result = shape.absCellsFacingIncoming(); Assert.AreEqual(2, result.Length); Assert.AreEqual(new Cell(0, 5), result[0]); Assert.AreEqual(new Cell(1, 5), result[1]); }
public void walkableCell_leftVertexAt00() { RectShape shape = new RectShape(new Cell(0, 0), new OIGrid(10, 10)); shape.setCellValue(3, 1, XTile.FLOOR); shape.setCellValue(3, 2, XTile.FLOOR); shape.setCellValue(3, 3, XTile.FLOOR); Cell[] result = shape.walkableCells(false); Assert.AreEqual(3, result.Length); Assert.AreEqual(new Cell(3, 1), result[0]); Assert.AreEqual(new Cell(3, 2), result[1]); Assert.AreEqual(new Cell(3, 3), result[2]); }
public void countingFloorRegions() { RectShape shape = new RectShape(new Cell(0, 0), new OIGrid(10, 10)); Assert.AreEqual(0, shape.regionsNumber()); shape.setCellValue(1, 1, XTile.FLOOR); Assert.AreEqual(1, shape.regionsNumber()); shape.setCellValue(3, 1, XTile.FLOOR); shape.setCellValue(3, 2, XTile.FLOOR); shape.setCellValue(3, 3, XTile.FLOOR); Assert.AreEqual(2, shape.regionsNumber()); }
public void hasCellAbsValue() { RectShape shape = new RectShape(new Cell(2, 2), new OIGrid(5, 5)); shape.setCellValue(1, 1, XTile.FLOOR); Assert.IsFalse(shape.hasCellAbsValue(new Cell(1, 1), XTile.FLOOR)); Assert.IsTrue(shape.hasCellAbsValue(new Cell(3, 3), XTile.FLOOR)); }
public void deleteRegionsButTheBiggest_withTwoRegions() { RectShape shape = new RectShape(new Cell(0, 0), new OIGrid(10, 10)); //REG 1 shape.setCellValue(1, 1, XTile.FLOOR); //REG 2s shape.setCellValue(3, 1, XTile.FLOOR); shape.setCellValue(3, 2, XTile.FLOOR); shape.setCellValue(3, 3, XTile.FLOOR); Assert.AreEqual(2, shape.regionsNumber()); shape.deleteRegionsButTheBiggest(); Assert.AreEqual(1, shape.regionsNumber()); Assert.IsTrue(shape.hasCellValue(1, 1, XTile.WALL)); Assert.IsTrue(shape.hasCellValue(3, 1, XTile.FLOOR)); Assert.IsTrue(shape.hasCellValue(3, 2, XTile.FLOOR)); Assert.IsTrue(shape.hasCellValue(3, 3, XTile.FLOOR)); }
public void walkableCell_ExcludingCellNextToWall_leftVertexAt11() { RectShape shape = new RectShape(new Cell(1, 1), new OIGrid(5, 5)); shape.setCellValue(1, 1, XTile.FLOOR); shape.setCellValue(1, 2, XTile.FLOOR); shape.setCellValue(1, 3, XTile.FLOOR); shape.setCellValue(2, 1, XTile.FLOOR); shape.setCellValue(2, 2, XTile.FLOOR); shape.setCellValue(2, 3, XTile.FLOOR); shape.setCellValue(3, 1, XTile.FLOOR); shape.setCellValue(3, 2, XTile.FLOOR); shape.setCellValue(3, 3, XTile.FLOOR); Cell[] result = shape.walkableCells(true); Assert.AreEqual(1, result.Length); Assert.AreEqual(new Cell(3, 3), result[0]); }
public void absCellsFacingIncoming_case3() { //RectShape roomA = new RectShape(new Cell(0, 0), new OIGrid(8, 8)); //RectShape roomB = new RectShape(new Cell(10, 10), new OIGrid(8, 8)); //XTestUtils.printForTest(25, roomA, roomB); RectShape room1 = new RectShape(new Cell(0, 0), new OIGrid(8, 8)); room1.setCellValue(0, 3, XTile.FLOOR); room1.setCellValue(0, 4, XTile.FLOOR); room1.setCellValue(0, 5, XTile.FLOOR); room1.setCellValue(0, 6, XTile.FLOOR); room1.setCellValue(1, 2, XTile.FLOOR); room1.setCellValue(1, 3, XTile.FLOOR); room1.setCellValue(1, 4, XTile.FLOOR); room1.setCellValue(1, 5, XTile.FLOOR); room1.setCellValue(1, 6, XTile.FLOOR); room1.setCellValue(1, 7, XTile.FLOOR); room1.setCellValue(2, 1, XTile.FLOOR); room1.setCellValue(2, 2, XTile.FLOOR); room1.setCellValue(2, 3, XTile.FLOOR); room1.setCellValue(2, 4, XTile.FLOOR); room1.setCellValue(2, 5, XTile.FLOOR); room1.setCellValue(2, 6, XTile.FLOOR); room1.setCellValue(2, 7, XTile.FLOOR); room1.setCellValue(3, 0, XTile.FLOOR); room1.setCellValue(3, 1, XTile.FLOOR); room1.setCellValue(3, 2, XTile.FLOOR); room1.setCellValue(3, 3, XTile.FLOOR); room1.setCellValue(3, 4, XTile.FLOOR); room1.setCellValue(3, 5, XTile.FLOOR); room1.setCellValue(3, 6, XTile.FLOOR); room1.setCellValue(3, 7, XTile.FLOOR); room1.setCellValue(4, 0, XTile.FLOOR); room1.setCellValue(4, 1, XTile.FLOOR); room1.setCellValue(4, 2, XTile.FLOOR); room1.setCellValue(4, 3, XTile.FLOOR); room1.setCellValue(4, 4, XTile.FLOOR); room1.setCellValue(4, 5, XTile.FLOOR); room1.setCellValue(4, 6, XTile.FLOOR); room1.setCellValue(4, 7, XTile.FLOOR); room1.setCellValue(5, 0, XTile.FLOOR); room1.setCellValue(5, 1, XTile.FLOOR); room1.setCellValue(5, 2, XTile.FLOOR); room1.setCellValue(5, 3, XTile.FLOOR); room1.setCellValue(5, 4, XTile.FLOOR); room1.setCellValue(5, 5, XTile.FLOOR); room1.setCellValue(5, 6, XTile.FLOOR); room1.setCellValue(5, 7, XTile.FLOOR); room1.setCellValue(6, 0, XTile.FLOOR); room1.setCellValue(6, 1, XTile.FLOOR); room1.setCellValue(6, 2, XTile.FLOOR); room1.setCellValue(6, 3, XTile.FLOOR); room1.setCellValue(6, 4, XTile.FLOOR); room1.setCellValue(6, 5, XTile.FLOOR); room1.setCellValue(6, 6, XTile.FLOOR); room1.setCellValue(7, 1, XTile.FLOOR); room1.setCellValue(7, 2, XTile.FLOOR); room1.setCellValue(7, 3, XTile.FLOOR); room1.setCellValue(7, 4, XTile.FLOOR); room1.setCellValue(7, 5, XTile.FLOOR); FreeShape corr12 = new FreeShape(); corr12.setCellValue(4, 8, XTile.FLOOR); corr12.setCellValue(5, 8, XTile.FLOOR); corr12.setCellValue(5, 9, XTile.FLOOR); corr12.setCellValue(6, 7, XTile.FLOOR); corr12.setCellValue(6, 8, XTile.FLOOR); corr12.setCellValue(7, 7, XTile.FLOOR); corr12.setCellValue(6, 9, XTile.FLOOR); corr12.setCellValue(6, 10, XTile.FLOOR); corr12.setCellValue(7, 8, XTile.FLOOR); corr12.setCellValue(7, 9, XTile.FLOOR); corr12.setCellValue(8, 8, XTile.FLOOR); corr12.setCellValue(7, 10, XTile.FLOOR); corr12.setCellValue(7, 11, XTile.FLOOR); corr12.setCellValue(8, 9, XTile.FLOOR); corr12.setCellValue(8, 10, XTile.FLOOR); corr12.setCellValue(9, 9, XTile.FLOOR); corr12.setCellValue(8, 11, XTile.FLOOR); corr12.setCellValue(8, 12, XTile.FLOOR); corr12.setCellValue(9, 10, XTile.FLOOR); corr12.setCellValue(9, 11, XTile.FLOOR); corr12.setCellValue(10, 10, XTile.FLOOR); corr12.setCellValue(9, 12, XTile.FLOOR); corr12.setCellValue(9, 13, XTile.FLOOR); corr12.setCellValue(10, 11, XTile.FLOOR); corr12.setCellValue(10, 12, XTile.FLOOR); corr12.setCellValue(11, 11, XTile.FLOOR); corr12.setCellValue(10, 13, XTile.FLOOR); corr12.setCellValue(11, 12, XTile.FLOOR); corr12.setCellValue(12, 12, XTile.FLOOR); corr12.setIncoming(room1); room1.setOutcoming(corr12); RectShape room2 = new RectShape(new Cell(10, 10), new OIGrid(8, 8)); room2.setCellValue(0, 4, XTile.FLOOR); room2.setCellValue(0, 5, XTile.FLOOR); room2.setCellValue(1, 3, XTile.FLOOR); room2.setCellValue(1, 4, XTile.FLOOR); room2.setCellValue(1, 5, XTile.FLOOR); room2.setCellValue(1, 6, XTile.FLOOR); room2.setCellValue(2, 3, XTile.FLOOR); room2.setCellValue(2, 4, XTile.FLOOR); room2.setCellValue(2, 5, XTile.FLOOR); room2.setCellValue(2, 6, XTile.FLOOR); room2.setCellValue(3, 3, XTile.FLOOR); room2.setCellValue(3, 4, XTile.FLOOR); room2.setCellValue(3, 5, XTile.FLOOR); room2.setCellValue(3, 6, XTile.FLOOR); room2.setCellValue(3, 7, XTile.FLOOR); room2.setCellValue(4, 3, XTile.FLOOR); room2.setCellValue(4, 4, XTile.FLOOR); room2.setCellValue(4, 5, XTile.FLOOR); room2.setCellValue(4, 6, XTile.FLOOR); room2.setCellValue(4, 7, XTile.FLOOR); room2.setCellValue(5, 3, XTile.FLOOR); room2.setCellValue(5, 4, XTile.FLOOR); room2.setCellValue(5, 5, XTile.FLOOR); room2.setCellValue(5, 6, XTile.FLOOR); room2.setCellValue(5, 7, XTile.FLOOR); room2.setCellValue(6, 3, XTile.FLOOR); room2.setCellValue(6, 4, XTile.FLOOR); room2.setCellValue(6, 5, XTile.FLOOR); room2.setCellValue(6, 6, XTile.FLOOR); room2.setCellValue(6, 7, XTile.FLOOR); room2.setCellValue(7, 4, XTile.FLOOR); room2.setCellValue(7, 5, XTile.FLOOR); room2.setCellValue(7, 6, XTile.FLOOR); room2.setIncoming(corr12); corr12.setOutcoming(room2); Cell[] incomCells; Cell[] outcomCells; incomCells = room1.absCellsFacingIncoming(); Assert.AreEqual(0, incomCells.Length); outcomCells = room1.absCellsFacingOutcoming(); Assert.AreEqual(3, outcomCells.Length); Assert.AreEqual(new Cell(4, 7), outcomCells[0]); Assert.AreEqual(new Cell(5, 7), outcomCells[1]); Assert.AreEqual(new Cell(6, 6), outcomCells[2]); incomCells = room2.absCellsFacingIncoming(); Assert.AreEqual(3, incomCells.Length); Assert.AreEqual(new Cell(10, 14), incomCells[0]); Assert.AreEqual(new Cell(11, 13), incomCells[1]); Assert.AreEqual(new Cell(12, 13), incomCells[2]); outcomCells = room2.absCellsFacingOutcoming(); Assert.AreEqual(0, outcomCells.Length); }
public void cavegen_case1() { /* * CaveGenerator gen = new CaveGenerator(); * gen.setMapSize(40, 40); * gen.setRoomsNumberRange(3, 3); * gen.setRoomSizeRange(12, 15); * gen.setCorridorLengthRange(5, 7); * gen.setCorridorWidthRange(1, 3); * gen.setSeed(123456); * gen.setCellularFillChance(80); * gen.setCellularSmoothingSteps(5); * gen.setMapMargin(2); * gen.setPlotter(new ZeroOneFillerCavePlotter()); * XTestUtils.printForTest(gen.asBoard()); */ RectShape room1 = new RectShape(new Cell(2, 6), new OIGrid(12, 13)); room1.setCellValue(0, 6, XTile.FLOOR); room1.setCellValue(0, 7, XTile.FLOOR); room1.setCellValue(0, 8, XTile.FLOOR); room1.setCellValue(1, 4, XTile.FLOOR); room1.setCellValue(1, 5, XTile.FLOOR); room1.setCellValue(1, 6, XTile.FLOOR); room1.setCellValue(1, 7, XTile.FLOOR); room1.setCellValue(1, 8, XTile.FLOOR); room1.setCellValue(1, 9, XTile.FLOOR); room1.setCellValue(1, 10, XTile.FLOOR); room1.setCellValue(1, 11, XTile.FLOOR); room1.setCellValue(2, 3, XTile.FLOOR); room1.setCellValue(2, 4, XTile.FLOOR); room1.setCellValue(2, 5, XTile.FLOOR); room1.setCellValue(2, 6, XTile.FLOOR); room1.setCellValue(2, 7, XTile.FLOOR); room1.setCellValue(2, 8, XTile.FLOOR); room1.setCellValue(2, 9, XTile.FLOOR); room1.setCellValue(2, 10, XTile.FLOOR); room1.setCellValue(2, 11, XTile.FLOOR); room1.setCellValue(2, 12, XTile.FLOOR); room1.setCellValue(3, 2, XTile.FLOOR); room1.setCellValue(3, 3, XTile.FLOOR); room1.setCellValue(3, 4, XTile.FLOOR); room1.setCellValue(3, 5, XTile.FLOOR); room1.setCellValue(3, 6, XTile.FLOOR); room1.setCellValue(3, 7, XTile.FLOOR); room1.setCellValue(3, 8, XTile.FLOOR); room1.setCellValue(3, 9, XTile.FLOOR); room1.setCellValue(3, 10, XTile.FLOOR); room1.setCellValue(3, 11, XTile.FLOOR); room1.setCellValue(3, 12, XTile.FLOOR); room1.setCellValue(4, 1, XTile.FLOOR); room1.setCellValue(4, 2, XTile.FLOOR); room1.setCellValue(4, 3, XTile.FLOOR); room1.setCellValue(4, 4, XTile.FLOOR); room1.setCellValue(4, 5, XTile.FLOOR); room1.setCellValue(4, 6, XTile.FLOOR); room1.setCellValue(4, 7, XTile.FLOOR); room1.setCellValue(4, 8, XTile.FLOOR); room1.setCellValue(4, 9, XTile.FLOOR); room1.setCellValue(4, 10, XTile.FLOOR); room1.setCellValue(4, 11, XTile.FLOOR); room1.setCellValue(4, 12, XTile.FLOOR); room1.setCellValue(5, 0, XTile.FLOOR); room1.setCellValue(5, 1, XTile.FLOOR); room1.setCellValue(5, 2, XTile.FLOOR); room1.setCellValue(5, 3, XTile.FLOOR); room1.setCellValue(5, 4, XTile.FLOOR); room1.setCellValue(5, 5, XTile.FLOOR); room1.setCellValue(5, 6, XTile.FLOOR); room1.setCellValue(5, 7, XTile.FLOOR); room1.setCellValue(5, 8, XTile.FLOOR); room1.setCellValue(5, 9, XTile.FLOOR); room1.setCellValue(5, 10, XTile.FLOOR); room1.setCellValue(5, 11, XTile.FLOOR); room1.setCellValue(5, 12, XTile.FLOOR); room1.setCellValue(6, 0, XTile.FLOOR); room1.setCellValue(6, 1, XTile.FLOOR); room1.setCellValue(6, 2, XTile.FLOOR); room1.setCellValue(6, 3, XTile.FLOOR); room1.setCellValue(6, 4, XTile.FLOOR); room1.setCellValue(6, 5, XTile.FLOOR); room1.setCellValue(6, 6, XTile.FLOOR); room1.setCellValue(6, 7, XTile.FLOOR); room1.setCellValue(6, 8, XTile.FLOOR); room1.setCellValue(6, 9, XTile.FLOOR); room1.setCellValue(6, 10, XTile.FLOOR); room1.setCellValue(6, 11, XTile.FLOOR); room1.setCellValue(6, 12, XTile.FLOOR); room1.setCellValue(7, 0, XTile.FLOOR); room1.setCellValue(7, 1, XTile.FLOOR); room1.setCellValue(7, 2, XTile.FLOOR); room1.setCellValue(7, 3, XTile.FLOOR); room1.setCellValue(7, 4, XTile.FLOOR); room1.setCellValue(7, 5, XTile.FLOOR); room1.setCellValue(7, 6, XTile.FLOOR); room1.setCellValue(7, 7, XTile.FLOOR); room1.setCellValue(7, 8, XTile.FLOOR); room1.setCellValue(7, 9, XTile.FLOOR); room1.setCellValue(7, 10, XTile.FLOOR); room1.setCellValue(7, 11, XTile.FLOOR); room1.setCellValue(7, 12, XTile.FLOOR); room1.setCellValue(8, 0, XTile.FLOOR); room1.setCellValue(8, 1, XTile.FLOOR); room1.setCellValue(8, 2, XTile.FLOOR); room1.setCellValue(8, 3, XTile.FLOOR); room1.setCellValue(8, 4, XTile.FLOOR); room1.setCellValue(8, 5, XTile.FLOOR); room1.setCellValue(8, 6, XTile.FLOOR); room1.setCellValue(8, 7, XTile.FLOOR); room1.setCellValue(8, 8, XTile.FLOOR); room1.setCellValue(8, 9, XTile.FLOOR); room1.setCellValue(8, 10, XTile.FLOOR); room1.setCellValue(8, 11, XTile.FLOOR); room1.setCellValue(8, 12, XTile.FLOOR); room1.setCellValue(9, 0, XTile.FLOOR); room1.setCellValue(9, 1, XTile.FLOOR); room1.setCellValue(9, 2, XTile.FLOOR); room1.setCellValue(9, 3, XTile.FLOOR); room1.setCellValue(9, 4, XTile.FLOOR); room1.setCellValue(9, 5, XTile.FLOOR); room1.setCellValue(9, 6, XTile.FLOOR); room1.setCellValue(9, 7, XTile.FLOOR); room1.setCellValue(9, 8, XTile.FLOOR); room1.setCellValue(9, 9, XTile.FLOOR); room1.setCellValue(9, 10, XTile.FLOOR); room1.setCellValue(9, 11, XTile.FLOOR); room1.setCellValue(9, 12, XTile.FLOOR); room1.setCellValue(10, 0, XTile.FLOOR); room1.setCellValue(10, 1, XTile.FLOOR); room1.setCellValue(10, 2, XTile.FLOOR); room1.setCellValue(10, 3, XTile.FLOOR); room1.setCellValue(10, 4, XTile.FLOOR); room1.setCellValue(10, 5, XTile.FLOOR); room1.setCellValue(10, 6, XTile.FLOOR); room1.setCellValue(10, 7, XTile.FLOOR); room1.setCellValue(10, 8, XTile.FLOOR); room1.setCellValue(10, 9, XTile.FLOOR); room1.setCellValue(10, 10, XTile.FLOOR); room1.setCellValue(10, 11, XTile.FLOOR); room1.setCellValue(10, 12, XTile.FLOOR); room1.setCellValue(11, 1, XTile.FLOOR); room1.setCellValue(11, 2, XTile.FLOOR); room1.setCellValue(11, 3, XTile.FLOOR); room1.setCellValue(11, 9, XTile.FLOOR); room1.setCellValue(11, 10, XTile.FLOOR); room1.setCellValue(11, 11, XTile.FLOOR); FreeShape corr12 = new FreeShape(); corr12.setCellValue(13, 6, XTile.FLOOR); corr12.setCellValue(13, 10, XTile.FLOOR); corr12.setCellValue(14, 7, XTile.FLOOR); corr12.setCellValue(14, 8, XTile.FLOOR); corr12.setCellValue(14, 9, XTile.FLOOR); corr12.setCellValue(15, 8, XTile.FLOOR); corr12.setCellValue(14, 6, XTile.FLOOR); corr12.setCellValue(14, 10, XTile.FLOOR); corr12.setCellValue(15, 7, XTile.FLOOR); corr12.setCellValue(15, 9, XTile.FLOOR); corr12.setCellValue(16, 8, XTile.FLOOR); corr12.setCellValue(15, 6, XTile.FLOOR); corr12.setCellValue(15, 10, XTile.FLOOR); corr12.setCellValue(16, 7, XTile.FLOOR); corr12.setCellValue(16, 9, XTile.FLOOR); corr12.setCellValue(17, 8, XTile.FLOOR); corr12.setCellValue(16, 6, XTile.FLOOR); corr12.setCellValue(16, 10, XTile.FLOOR); corr12.setCellValue(17, 7, XTile.FLOOR); corr12.setCellValue(17, 9, XTile.FLOOR); corr12.setCellValue(18, 8, XTile.FLOOR); corr12.setCellValue(17, 6, XTile.FLOOR); corr12.setCellValue(17, 10, XTile.FLOOR); corr12.setCellValue(18, 7, XTile.FLOOR); corr12.setCellValue(18, 9, XTile.FLOOR); corr12.setCellValue(18, 6, XTile.FLOOR); corr12.setCellValue(18, 10, XTile.FLOOR); corr12.setCellValue(19, 7, XTile.FLOOR); corr12.setIncoming(room1); room1.setOutcoming(corr12); RectShape room2 = new RectShape(new Cell(19, 6), new OIGrid(14, 12)); room2.setCellValue(0, 2, XTile.FLOOR); room2.setCellValue(0, 3, XTile.FLOOR); room2.setCellValue(0, 4, XTile.FLOOR); room2.setCellValue(0, 5, XTile.FLOOR); room2.setCellValue(0, 6, XTile.FLOOR); room2.setCellValue(0, 7, XTile.FLOOR); room2.setCellValue(1, 1, XTile.FLOOR); room2.setCellValue(1, 2, XTile.FLOOR); room2.setCellValue(1, 3, XTile.FLOOR); room2.setCellValue(1, 4, XTile.FLOOR); room2.setCellValue(1, 5, XTile.FLOOR); room2.setCellValue(1, 6, XTile.FLOOR); room2.setCellValue(1, 7, XTile.FLOOR); room2.setCellValue(1, 8, XTile.FLOOR); room2.setCellValue(2, 1, XTile.FLOOR); room2.setCellValue(2, 2, XTile.FLOOR); room2.setCellValue(2, 3, XTile.FLOOR); room2.setCellValue(2, 4, XTile.FLOOR); room2.setCellValue(2, 5, XTile.FLOOR); room2.setCellValue(2, 6, XTile.FLOOR); room2.setCellValue(2, 7, XTile.FLOOR); room2.setCellValue(2, 8, XTile.FLOOR); room2.setCellValue(3, 0, XTile.FLOOR); room2.setCellValue(3, 1, XTile.FLOOR); room2.setCellValue(3, 2, XTile.FLOOR); room2.setCellValue(3, 3, XTile.FLOOR); room2.setCellValue(3, 4, XTile.FLOOR); room2.setCellValue(3, 5, XTile.FLOOR); room2.setCellValue(3, 6, XTile.FLOOR); room2.setCellValue(3, 7, XTile.FLOOR); room2.setCellValue(3, 8, XTile.FLOOR); room2.setCellValue(3, 9, XTile.FLOOR); room2.setCellValue(4, 0, XTile.FLOOR); room2.setCellValue(4, 1, XTile.FLOOR); room2.setCellValue(4, 2, XTile.FLOOR); room2.setCellValue(4, 3, XTile.FLOOR); room2.setCellValue(4, 4, XTile.FLOOR); room2.setCellValue(4, 5, XTile.FLOOR); room2.setCellValue(4, 6, XTile.FLOOR); room2.setCellValue(4, 7, XTile.FLOOR); room2.setCellValue(4, 8, XTile.FLOOR); room2.setCellValue(4, 9, XTile.FLOOR); room2.setCellValue(4, 10, XTile.FLOOR); room2.setCellValue(5, 0, XTile.FLOOR); room2.setCellValue(5, 1, XTile.FLOOR); room2.setCellValue(5, 2, XTile.FLOOR); room2.setCellValue(5, 3, XTile.FLOOR); room2.setCellValue(5, 4, XTile.FLOOR); room2.setCellValue(5, 5, XTile.FLOOR); room2.setCellValue(5, 6, XTile.FLOOR); room2.setCellValue(5, 7, XTile.FLOOR); room2.setCellValue(5, 8, XTile.FLOOR); room2.setCellValue(5, 9, XTile.FLOOR); room2.setCellValue(5, 10, XTile.FLOOR); room2.setCellValue(5, 11, XTile.FLOOR); room2.setCellValue(6, 0, XTile.FLOOR); room2.setCellValue(6, 1, XTile.FLOOR); room2.setCellValue(6, 2, XTile.FLOOR); room2.setCellValue(6, 3, XTile.FLOOR); room2.setCellValue(6, 4, XTile.FLOOR); room2.setCellValue(6, 5, XTile.FLOOR); room2.setCellValue(6, 6, XTile.FLOOR); room2.setCellValue(6, 7, XTile.FLOOR); room2.setCellValue(6, 8, XTile.FLOOR); room2.setCellValue(6, 9, XTile.FLOOR); room2.setCellValue(6, 10, XTile.FLOOR); room2.setCellValue(6, 11, XTile.FLOOR); room2.setCellValue(7, 0, XTile.FLOOR); room2.setCellValue(7, 1, XTile.FLOOR); room2.setCellValue(7, 2, XTile.FLOOR); room2.setCellValue(7, 3, XTile.FLOOR); room2.setCellValue(7, 4, XTile.FLOOR); room2.setCellValue(7, 5, XTile.FLOOR); room2.setCellValue(7, 6, XTile.FLOOR); room2.setCellValue(7, 7, XTile.FLOOR); room2.setCellValue(7, 8, XTile.FLOOR); room2.setCellValue(7, 9, XTile.FLOOR); room2.setCellValue(7, 10, XTile.FLOOR); room2.setCellValue(7, 11, XTile.FLOOR); room2.setCellValue(8, 1, XTile.FLOOR); room2.setCellValue(8, 2, XTile.FLOOR); room2.setCellValue(8, 3, XTile.FLOOR); room2.setCellValue(8, 4, XTile.FLOOR); room2.setCellValue(8, 5, XTile.FLOOR); room2.setCellValue(8, 6, XTile.FLOOR); room2.setCellValue(8, 7, XTile.FLOOR); room2.setCellValue(8, 8, XTile.FLOOR); room2.setCellValue(8, 9, XTile.FLOOR); room2.setCellValue(8, 10, XTile.FLOOR); room2.setCellValue(8, 11, XTile.FLOOR); room2.setCellValue(9, 1, XTile.FLOOR); room2.setCellValue(9, 2, XTile.FLOOR); room2.setCellValue(9, 3, XTile.FLOOR); room2.setCellValue(9, 4, XTile.FLOOR); room2.setCellValue(9, 5, XTile.FLOOR); room2.setCellValue(9, 6, XTile.FLOOR); room2.setCellValue(9, 7, XTile.FLOOR); room2.setCellValue(9, 8, XTile.FLOOR); room2.setCellValue(9, 9, XTile.FLOOR); room2.setCellValue(9, 10, XTile.FLOOR); room2.setCellValue(9, 11, XTile.FLOOR); room2.setCellValue(10, 0, XTile.FLOOR); room2.setCellValue(10, 1, XTile.FLOOR); room2.setCellValue(10, 2, XTile.FLOOR); room2.setCellValue(10, 3, XTile.FLOOR); room2.setCellValue(10, 4, XTile.FLOOR); room2.setCellValue(10, 5, XTile.FLOOR); room2.setCellValue(10, 6, XTile.FLOOR); room2.setCellValue(10, 7, XTile.FLOOR); room2.setCellValue(10, 8, XTile.FLOOR); room2.setCellValue(10, 9, XTile.FLOOR); room2.setCellValue(10, 10, XTile.FLOOR); room2.setCellValue(10, 11, XTile.FLOOR); room2.setCellValue(11, 0, XTile.FLOOR); room2.setCellValue(11, 1, XTile.FLOOR); room2.setCellValue(11, 2, XTile.FLOOR); room2.setCellValue(11, 3, XTile.FLOOR); room2.setCellValue(11, 4, XTile.FLOOR); room2.setCellValue(11, 5, XTile.FLOOR); room2.setCellValue(11, 6, XTile.FLOOR); room2.setCellValue(11, 7, XTile.FLOOR); room2.setCellValue(11, 8, XTile.FLOOR); room2.setCellValue(11, 9, XTile.FLOOR); room2.setCellValue(11, 10, XTile.FLOOR); room2.setCellValue(11, 11, XTile.FLOOR); room2.setCellValue(12, 0, XTile.FLOOR); room2.setCellValue(12, 1, XTile.FLOOR); room2.setCellValue(12, 2, XTile.FLOOR); room2.setCellValue(12, 3, XTile.FLOOR); room2.setCellValue(12, 4, XTile.FLOOR); room2.setCellValue(12, 5, XTile.FLOOR); room2.setCellValue(12, 6, XTile.FLOOR); room2.setCellValue(12, 7, XTile.FLOOR); room2.setCellValue(12, 8, XTile.FLOOR); room2.setCellValue(12, 9, XTile.FLOOR); room2.setCellValue(12, 10, XTile.FLOOR); room2.setCellValue(12, 11, XTile.FLOOR); room2.setCellValue(13, 1, XTile.FLOOR); room2.setCellValue(13, 2, XTile.FLOOR); room2.setCellValue(13, 3, XTile.FLOOR); room2.setCellValue(13, 4, XTile.FLOOR); room2.setCellValue(13, 5, XTile.FLOOR); room2.setCellValue(13, 6, XTile.FLOOR); room2.setCellValue(13, 7, XTile.FLOOR); room2.setCellValue(13, 8, XTile.FLOOR); room2.setCellValue(13, 9, XTile.FLOOR); room2.setCellValue(13, 10, XTile.FLOOR); room2.setIncoming(corr12); corr12.setOutcoming(room2); FreeShape corr34 = new FreeShape(); corr34.setCellValue(22, 17, XTile.FLOOR); corr34.setCellValue(23, 17, XTile.FLOOR); corr34.setCellValue(23, 18, XTile.FLOOR); corr34.setCellValue(24, 18, XTile.FLOOR); corr34.setCellValue(24, 19, XTile.FLOOR); corr34.setCellValue(25, 18, XTile.FLOOR); corr34.setCellValue(21, 18, XTile.FLOOR); corr34.setCellValue(22, 18, XTile.FLOOR); corr34.setCellValue(22, 19, XTile.FLOOR); corr34.setCellValue(23, 19, XTile.FLOOR); corr34.setCellValue(23, 20, XTile.FLOOR); corr34.setCellValue(20, 19, XTile.FLOOR); corr34.setCellValue(21, 19, XTile.FLOOR); corr34.setCellValue(21, 20, XTile.FLOOR); corr34.setCellValue(22, 20, XTile.FLOOR); corr34.setCellValue(22, 21, XTile.FLOOR); corr34.setCellValue(19, 20, XTile.FLOOR); corr34.setCellValue(20, 20, XTile.FLOOR); corr34.setCellValue(20, 21, XTile.FLOOR); corr34.setCellValue(21, 21, XTile.FLOOR); corr34.setCellValue(21, 22, XTile.FLOOR); corr34.setCellValue(18, 21, XTile.FLOOR); corr34.setCellValue(19, 21, XTile.FLOOR); corr34.setCellValue(20, 22, XTile.FLOOR); corr34.setIncoming(room2); room2.setOutcoming(corr34); ElliShape room3 = new ElliShape(new Cell(11, 21), new OIGrid(12, 15)); room3.setCellValue(1, 4, XTile.FLOOR); room3.setCellValue(1, 5, XTile.FLOOR); room3.setCellValue(1, 6, XTile.FLOOR); room3.setCellValue(2, 3, XTile.FLOOR); room3.setCellValue(2, 4, XTile.FLOOR); room3.setCellValue(2, 5, XTile.FLOOR); room3.setCellValue(2, 6, XTile.FLOOR); room3.setCellValue(2, 7, XTile.FLOOR); room3.setCellValue(3, 2, XTile.FLOOR); room3.setCellValue(3, 3, XTile.FLOOR); room3.setCellValue(3, 4, XTile.FLOOR); room3.setCellValue(3, 5, XTile.FLOOR); room3.setCellValue(3, 6, XTile.FLOOR); room3.setCellValue(3, 7, XTile.FLOOR); room3.setCellValue(3, 8, XTile.FLOOR); room3.setCellValue(3, 9, XTile.FLOOR); room3.setCellValue(3, 10, XTile.FLOOR); room3.setCellValue(4, 2, XTile.FLOOR); room3.setCellValue(4, 3, XTile.FLOOR); room3.setCellValue(4, 4, XTile.FLOOR); room3.setCellValue(4, 5, XTile.FLOOR); room3.setCellValue(4, 6, XTile.FLOOR); room3.setCellValue(4, 7, XTile.FLOOR); room3.setCellValue(4, 8, XTile.FLOOR); room3.setCellValue(4, 9, XTile.FLOOR); room3.setCellValue(4, 10, XTile.FLOOR); room3.setCellValue(4, 11, XTile.FLOOR); room3.setCellValue(4, 12, XTile.FLOOR); room3.setCellValue(4, 13, XTile.FLOOR); room3.setCellValue(5, 1, XTile.FLOOR); room3.setCellValue(5, 2, XTile.FLOOR); room3.setCellValue(5, 3, XTile.FLOOR); room3.setCellValue(5, 4, XTile.FLOOR); room3.setCellValue(5, 5, XTile.FLOOR); room3.setCellValue(5, 6, XTile.FLOOR); room3.setCellValue(5, 7, XTile.FLOOR); room3.setCellValue(5, 8, XTile.FLOOR); room3.setCellValue(5, 9, XTile.FLOOR); room3.setCellValue(5, 10, XTile.FLOOR); room3.setCellValue(5, 11, XTile.FLOOR); room3.setCellValue(5, 12, XTile.FLOOR); room3.setCellValue(5, 13, XTile.FLOOR); room3.setCellValue(5, 14, XTile.FLOOR); room3.setCellValue(6, 1, XTile.FLOOR); room3.setCellValue(6, 2, XTile.FLOOR); room3.setCellValue(6, 3, XTile.FLOOR); room3.setCellValue(6, 4, XTile.FLOOR); room3.setCellValue(6, 5, XTile.FLOOR); room3.setCellValue(6, 6, XTile.FLOOR); room3.setCellValue(6, 7, XTile.FLOOR); room3.setCellValue(6, 8, XTile.FLOOR); room3.setCellValue(6, 9, XTile.FLOOR); room3.setCellValue(6, 10, XTile.FLOOR); room3.setCellValue(6, 11, XTile.FLOOR); room3.setCellValue(6, 12, XTile.FLOOR); room3.setCellValue(6, 13, XTile.FLOOR); room3.setCellValue(6, 14, XTile.FLOOR); room3.setCellValue(7, 1, XTile.FLOOR); room3.setCellValue(7, 2, XTile.FLOOR); room3.setCellValue(7, 3, XTile.FLOOR); room3.setCellValue(7, 4, XTile.FLOOR); room3.setCellValue(7, 5, XTile.FLOOR); room3.setCellValue(7, 6, XTile.FLOOR); room3.setCellValue(7, 7, XTile.FLOOR); room3.setCellValue(7, 8, XTile.FLOOR); room3.setCellValue(7, 9, XTile.FLOOR); room3.setCellValue(7, 10, XTile.FLOOR); room3.setCellValue(7, 11, XTile.FLOOR); room3.setCellValue(7, 12, XTile.FLOOR); room3.setCellValue(7, 13, XTile.FLOOR); room3.setCellValue(8, 1, XTile.FLOOR); room3.setCellValue(8, 2, XTile.FLOOR); room3.setCellValue(8, 3, XTile.FLOOR); room3.setCellValue(8, 4, XTile.FLOOR); room3.setCellValue(8, 5, XTile.FLOOR); room3.setCellValue(8, 6, XTile.FLOOR); room3.setCellValue(8, 7, XTile.FLOOR); room3.setCellValue(8, 8, XTile.FLOOR); room3.setCellValue(8, 9, XTile.FLOOR); room3.setCellValue(8, 10, XTile.FLOOR); room3.setCellValue(8, 11, XTile.FLOOR); room3.setCellValue(8, 12, XTile.FLOOR); room3.setCellValue(8, 13, XTile.FLOOR); room3.setCellValue(9, 2, XTile.FLOOR); room3.setCellValue(9, 3, XTile.FLOOR); room3.setCellValue(9, 4, XTile.FLOOR); room3.setCellValue(9, 5, XTile.FLOOR); room3.setCellValue(9, 6, XTile.FLOOR); room3.setCellValue(9, 7, XTile.FLOOR); room3.setCellValue(9, 8, XTile.FLOOR); room3.setCellValue(9, 9, XTile.FLOOR); room3.setCellValue(9, 10, XTile.FLOOR); room3.setCellValue(9, 11, XTile.FLOOR); room3.setCellValue(9, 12, XTile.FLOOR); room3.setCellValue(9, 13, XTile.FLOOR); room3.setCellValue(10, 3, XTile.FLOOR); room3.setCellValue(10, 4, XTile.FLOOR); room3.setCellValue(10, 5, XTile.FLOOR); room3.setCellValue(10, 6, XTile.FLOOR); room3.setCellValue(10, 7, XTile.FLOOR); room3.setCellValue(10, 8, XTile.FLOOR); room3.setCellValue(10, 9, XTile.FLOOR); room3.setCellValue(10, 10, XTile.FLOOR); room3.setCellValue(10, 11, XTile.FLOOR); room3.setCellValue(10, 12, XTile.FLOOR); room3.setCellValue(11, 4, XTile.FLOOR); room3.setCellValue(11, 5, XTile.FLOOR); room3.setCellValue(11, 6, XTile.FLOOR); room3.setCellValue(11, 7, XTile.FLOOR); room3.setCellValue(11, 8, XTile.FLOOR); room3.setCellValue(11, 9, XTile.FLOOR); room3.setCellValue(11, 10, XTile.FLOOR); room3.setCellValue(11, 11, XTile.FLOOR); room3.setIncoming(corr34); corr34.setOutcoming(room3); Cell[] incCells; Cell[] outCells; incCells = room1.absCellsFacingIncoming(); outCells = room1.absCellsFacingOutcoming(); Assert.AreEqual(0, incCells.Length); Assert.AreEqual(5, outCells.Length); Assert.AreEqual(new Cell(12, 6), outCells[0]); Assert.AreEqual(new Cell(12, 10), outCells[1]); Assert.AreEqual(new Cell(13, 7), outCells[2]); Assert.AreEqual(new Cell(13, 8), outCells[3]); Assert.AreEqual(new Cell(13, 9), outCells[4]); incCells = room2.absCellsFacingIncoming(); outCells = room2.absCellsFacingOutcoming(); Assert.AreEqual(4, incCells.Length); Assert.AreEqual(new Cell(19, 8), incCells[0]); Assert.AreEqual(new Cell(19, 9), incCells[1]); Assert.AreEqual(new Cell(19, 10), incCells[2]); Assert.AreEqual(new Cell(20, 7), incCells[3]); Assert.AreEqual(3, outCells.Length); Assert.AreEqual(new Cell(23, 16), outCells[0]); Assert.AreEqual(new Cell(24, 17), outCells[1]); Assert.AreEqual(new Cell(25, 17), outCells[2]); incCells = room3.absCellsFacingIncoming(); outCells = room3.absCellsFacingOutcoming(); Assert.AreEqual(3, incCells.Length); Assert.AreEqual(new Cell(18, 22), incCells[0]); Assert.AreEqual(new Cell(19, 22), incCells[1]); Assert.AreEqual(new Cell(20, 23), incCells[2]); Assert.AreEqual(0, outCells.Length); }