Beispiel #1
0
    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]);
    }
Beispiel #2
0
 public override void _visit(FreeShape shape)
 {
     shape.forEachCell((x, y, sameShape) => {
         //FreeShape ogni cella vale 1
         Gizmos.color = Color.white;
         Vector3 pos  = new Vector3(x, 0, y * -1);
         Gizmos.DrawCube(pos, Vector3.one);
     });
 }
    public void walkableCell_ExcludingCellNextToWall_corr3x3()
    {
        FreeShape shape = new FreeShape();

        shape.add(new Cell(0, 0));
        shape.add(new Cell(0, 1));
        shape.add(new Cell(0, 2));
        shape.add(new Cell(1, 0));
        shape.add(new Cell(1, 1));
        shape.add(new Cell(1, 2));
        shape.add(new Cell(2, 0));
        shape.add(new Cell(2, 1));
        shape.add(new Cell(2, 2));

        Cell[] result = shape.walkableCells(true);
        Assert.AreEqual(1, result.Length);
        Assert.AreEqual(new Cell(1, 1), result[0]);
    }
    public void walkableCell_corr3x3()
    {
        //  F F F
        //  F F F
        //  F F F
        FreeShape shape = new FreeShape();

        shape.add(new Cell(0, 0));
        shape.add(new Cell(0, 1));
        shape.add(new Cell(0, 2));
        shape.add(new Cell(1, 0));
        shape.add(new Cell(1, 1));
        shape.add(new Cell(1, 2));
        shape.add(new Cell(2, 0));
        shape.add(new Cell(2, 1));
        shape.add(new Cell(2, 2));

        Cell[] result = shape.walkableCells(false);
        Assert.AreEqual(9, result.Length);
    }
Beispiel #5
0
    public void linkingRoomAndCorridor_case1()
    {
        CaveBoard board = new CaveBoard(40, 40);

        IXShape room1  = new RectShape(new Cell(0, 0), new OIGrid(5, 5));
        IXShape room2  = new RectShape(new Cell(0, 0), new OIGrid(5, 5));
        IXShape corr12 = new FreeShape();

        board.addRoom(room1);
        board.addCorridor(corr12);
        board.addRoom(room2);

        Assert.IsNull(room1.getIncoming());
        Assert.AreEqual(room1.getOutcoming(), corr12);

        Assert.AreEqual(corr12.getIncoming(), room1);
        Assert.AreEqual(corr12.getOutcoming(), room2);

        Assert.AreEqual(room2.getIncoming(), corr12);
        Assert.IsNull(room2.getOutcoming());
    }
Beispiel #6
0
    public static FreeShape createCorrShape(IXShape roomA, IXShape roomB, int corrWidth)
    {
        CellPair    pair     = roomA.shortestCellPair(roomB);
        List <Cell> line     = GetLine(pair.cell1, pair.cell2);
        FreeShape   corrAtoB = new FreeShape();

        foreach (Cell each in line)
        {
            List <Cell> vCells = DrawCircle(each, corrWidth);
            //To avoid cell overlapping between rooms with corridor
            foreach (Cell vEach in vCells)
            {
                if (!roomA.hasCellAbsValue(vEach, XTile.FLOOR) &&
                    !roomB.hasCellAbsValue(vEach, XTile.FLOOR))
                {
                    corrAtoB.add(vEach);
                }
            }
        }
        return(corrAtoB);
    }
    public void edge_corr3x3()
    {
        //  F F F
        //  F F F
        //  F F F
        FreeShape shape = new FreeShape();

        shape.add(new Cell(0, 0));
        shape.add(new Cell(0, 1));
        shape.add(new Cell(0, 2));
        shape.add(new Cell(1, 0));
        shape.add(new Cell(1, 1));
        shape.add(new Cell(1, 2));
        shape.add(new Cell(2, 0));
        shape.add(new Cell(2, 1));
        shape.add(new Cell(2, 2));

        List <Cell> result = shape.edge();

        Assert.AreEqual(8, result.Count);
        Assert.IsFalse(result.Contains(new Cell(1, 1)));
    }
Beispiel #8
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);
    }
Beispiel #9
0
    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);
    }
 public override void _visit(FreeShape aShape)
 {
     System.Console.WriteLine("FreeShape " + _varName + " = new FreeShape();");
     printSetMethod(aShape);
 }
Beispiel #11
0
 public virtual void _visit(FreeShape aShape)
 {
 }
Beispiel #12
0
 public virtual void visit(FreeShape aShape)
 {
     _visit(aShape as FreeShape);
     _visit(aShape as IXShape);
 }