Esempio n. 1
0
        private List <RoomTemplate> GetMediumRoomTemplates()
        {
            var roomTemplates = new List <RoomTemplate>();
            var doorMode      = new SimpleDoorMode(2, 2);

            roomTemplates.Add(new RoomTemplate(PolygonGrid2D.GetSquare(12), doorMode, transformations, name: "Square 12x12", repeatMode: repeatMode));
            roomTemplates.Add(new RoomTemplate(PolygonGrid2D.GetSquare(14), doorMode, transformations, name: "Square 14x14", repeatMode: repeatMode));
            roomTemplates.Add(new RoomTemplate(PolygonGrid2D.GetRectangle(10, 14), doorMode, transformations, name: "Rectangle 10x14", repeatMode: repeatMode));
            roomTemplates.Add(new RoomTemplate(PolygonGrid2D.GetRectangle(12, 15), doorMode, transformations, name: "Rectangle 12x15", repeatMode: repeatMode));

            //roomTemplates.Add(new RoomTemplate(
            //    new GridPolygonBuilder()
            //        .AddPoint(0, 0)
            //        .AddPoint(0, 16)
            //        .AddPoint(8, 16)
            //        .AddPoint(8, 8)
            //        .AddPoint(16, 8)
            //        .AddPoint(16, 0)
            //        .Build()
            //    , doorMode, transformations, name: "L-shape large", repeatMode: RepeatMode.NoRepeat));

            if (enhanceRoomTemplates)
            {
                roomTemplates.Add(new RoomTemplate(PolygonGrid2D.GetSquare(13), doorMode, transformations, name: "Square 13x13", repeatMode: repeatMode));
                roomTemplates.Add(new RoomTemplate(PolygonGrid2D.GetRectangle(10, 16), doorMode, transformations, name: "Rectangle 10x16", repeatMode: repeatMode));
            }

            return(roomTemplates);
        }
Esempio n. 2
0
        public void GetConfigurationSpaceOverCorridor_RoomShapesThatCannotBeCorrectlyConnected()
        {
            var roomShape1     = PolygonGrid2D.GetSquare(5);
            var roomDoorsMode1 = new SimpleDoorMode(1, 0);

            var roomShape2 = new PolygonGrid2DBuilder()
                             .AddPoint(0, 1)
                             .AddPoint(0, 2)
                             .AddPoint(2, 2)
                             .AddPoint(2, 0)
                             .AddPoint(1, 0)
                             .AddPoint(1, 1)
                             .Build();
            var roomDoorsMode2 = new ManualDoorMode(new List <OrthogonalLineGrid2D>()
            {
                new OrthogonalLineGrid2D(new Vector2Int(1, 1), new Vector2Int(0, 1)),
            });

            var corridor          = PolygonGrid2D.GetSquare(2);
            var corridorDoorsMode = new ManualDoorMode(new List <OrthogonalLineGrid2D>()
            {
                new OrthogonalLineGrid2D(new Vector2Int(0, 0), new Vector2Int(1, 0)),
                new OrthogonalLineGrid2D(new Vector2Int(0, 2), new Vector2Int(1, 2)),
            });

            var configurationSpace = generator.GetConfigurationSpaceOverCorridor(roomShape2, roomDoorsMode2, roomShape1,
                                                                                 roomDoorsMode1, corridor, corridorDoorsMode);

            Assert.That(configurationSpace.Lines.SelectMany(x => x.GetPoints()), Is.Empty);
        }
Esempio n. 3
0
        public void GetRoomTemplateInstances_RectangleAllRotations_ReturnsTwoInstances()
        {
            var roomShape = PolygonGrid2D.GetRectangle(5, 10);

            var doorsMode       = new SimpleDoorMode(1, 0);
            var transformations = new List <TransformationGrid2D>()
            {
                TransformationGrid2D.Identity, TransformationGrid2D.Rotate90, TransformationGrid2D.Rotate180, TransformationGrid2D.Rotate270
            };

            var roomTemplate = new RoomTemplate(roomShape, doorsMode, transformations);
            var instances    = generator.GetRoomTemplateInstances(roomTemplate);

            Assert.That(instances.Count, Is.EqualTo(2));

            var wideRectangle = instances[0];
            var tallRectangle = instances[1];

            if (wideRectangle.RoomShape.Equals(roomShape))
            {
                wideRectangle = instances[1];
                tallRectangle = instances[0];
            }

            Assert.That(tallRectangle.RoomShape, Is.EqualTo(PolygonGrid2D.GetRectangle(5, 10)));
            Assert.That(wideRectangle.RoomShape, Is.EqualTo(PolygonGrid2D.GetRectangle(10, 5)));
        }
Esempio n. 4
0
        public static RoomTemplate ToOldRoomTemplate(this RoomTemplateGrid2D roomTemplate)
        {
            var       doorMode    = roomTemplate.Doors;
            IDoorMode oldDoorMode = null;

            if (roomTemplate.RepeatMode == null)
            {
                throw new NotSupportedException("Null repeat mode is currently not supported");
            }

            if (doorMode is SimpleDoorModeGrid2D simpleDoorMode)
            {
                if (simpleDoorMode.DoorSocket != null)
                {
                    throw new NotSupportedException("Old room templates support only null sockets");
                }

                oldDoorMode = new SimpleDoorMode(simpleDoorMode.DoorLength, simpleDoorMode.CornerDistance);
            }
            else if (doorMode is ManualDoorModeGrid2D manualDoorMode)
            {
                if (manualDoorMode.Doors.Any(x => x.Socket != null))
                {
                    throw new NotSupportedException("Old room templates support only null sockets");
                }

                oldDoorMode = new ManualDoorMode(manualDoorMode.Doors.Select(x => new OrthogonalLineGrid2D(x.From, x.To)).ToList());
            }
            else
            {
                throw new ArgumentOutOfRangeException();
            }

            return(new RoomTemplate(roomTemplate.Outline, oldDoorMode, roomTemplate.AllowedTransformations, roomTemplate.RepeatMode.Value, roomTemplate.Name));
        }
        public void Rectangle_TwoOverlap()
        {
            var polygon           = PolygonGrid2D.GetRectangle(3, 5);
            var mode              = new SimpleDoorMode(1, 2);
            var doorPositions     = simpleModeHandler.GetDoorPositions(polygon, mode);
            var expectedPositions = new List <DoorLine>()
            {
                new DoorLine(new OrthogonalLineGrid2D(new Vector2Int(0, 2), new Vector2Int(0, 2), OrthogonalLineGrid2D.Direction.Top), 1),
                new DoorLine(new OrthogonalLineGrid2D(new Vector2Int(3, 3), new Vector2Int(3, 3), OrthogonalLineGrid2D.Direction.Bottom), 1),
            };

            Assert.IsTrue(doorPositions.SequenceEqualWithoutOrder(expectedPositions));
        }
Esempio n. 6
0
        public void GetRoomTemplateInstances_SquareAllTransformations_ReturnsOneInstance()
        {
            var roomShape       = PolygonGrid2D.GetSquare(10);
            var doorsMode       = new SimpleDoorMode(1, 0);
            var transformations = ((TransformationGrid2D[])Enum.GetValues(typeof(TransformationGrid2D))).ToList();

            var roomTemplate = new RoomTemplate(roomShape, doorsMode, transformations);
            var instances    = generator.GetRoomTemplateInstances(roomTemplate);

            Assert.That(instances.Count, Is.EqualTo(1));
            Assert.That(instances[0].RoomTemplate, Is.EqualTo(roomTemplate));
            Assert.That(instances[0].RoomShape, Is.EqualTo(roomShape));
            Assert.That(instances[0].Transformations, Is.EquivalentTo(transformations));
        }
        public void Rectangle_LengthZero()
        {
            var polygon           = PolygonGrid2D.GetRectangle(3, 5);
            var mode              = new SimpleDoorMode(0, 0);
            var doorPositions     = simpleModeHandler.GetDoorPositions(polygon, mode);
            var expectedPositions = new List <DoorLine>()
            {
                new DoorLine(new OrthogonalLineGrid2D(new Vector2Int(0, 0), new Vector2Int(0, 5)), 0),
                new DoorLine(new OrthogonalLineGrid2D(new Vector2Int(0, 5), new Vector2Int(3, 5)), 0),
                new DoorLine(new OrthogonalLineGrid2D(new Vector2Int(3, 5), new Vector2Int(3, 0)), 0),
                new DoorLine(new OrthogonalLineGrid2D(new Vector2Int(3, 0), new Vector2Int(0, 0)), 0),
            };

            Assert.IsTrue(doorPositions.SequenceEqualWithoutOrder(expectedPositions));
        }
Esempio n. 8
0
        public static List <RoomTemplate> GetRectangularRoomTemplates(Vector2Int scale)
        {
            var overlapScale    = Math.Min(scale.X, scale.Y);
            var doorMode        = new SimpleDoorMode(1 * overlapScale, 0);
            var transformations = TransformationGrid2DHelper.GetAllTransformationsOld().ToList();

            var squareRoom    = new RoomTemplate(PolygonGrid2D.GetSquare(6).Scale(scale), doorMode, transformations, name: "Square");
            var rectangleRoom = new RoomTemplate(PolygonGrid2D.GetRectangle(6, 9).Scale(scale), doorMode, transformations, name: "Rectangle");

            return(new List <RoomTemplate>()
            {
                squareRoom,
                rectangleRoom,
            });
        }
Esempio n. 9
0
        public MapDescription <int> GetMapDescription()
        {
            // Prepare room templates
            var doorMode = new SimpleDoorMode(1, 1);

            var squareRoom = new RoomTemplate(
                new PolygonGrid2DBuilder()
                .AddPoint(0, 0)
                .AddPoint(0, 8)
                .AddPoint(8, 8)
                .AddPoint(8, 0)
                .Build(),
                doorMode
                );

            var rectangleRoom = new RoomTemplate(
                PolygonGrid2D.GetRectangle(6, 10),
                doorMode,
                new List <TransformationGrid2D>()
            {
                TransformationGrid2D.Identity, TransformationGrid2D.Rotate90
            }
                );

            // Create room description
            var basicRoomDescription = new BasicRoomDescription(new List <RoomTemplate>()
            {
                squareRoom, rectangleRoom
            });

            // Create map description
            var mapDescription = new MapDescription <int>();

            // Add rooms
            mapDescription.AddRoom(0, basicRoomDescription);
            mapDescription.AddRoom(1, basicRoomDescription);
            mapDescription.AddRoom(2, basicRoomDescription);
            mapDescription.AddRoom(3, basicRoomDescription);

            // Add connections
            mapDescription.AddConnection(0, 1);
            mapDescription.AddConnection(0, 3);
            mapDescription.AddConnection(1, 2);
            mapDescription.AddConnection(2, 3);

            // Add room shapes
            return(mapDescription);
        }
Esempio n. 10
0
        public void GetConfigurationSpaceOverCorridor_SquareRoomLShapedCorridor()
        {
            var roomShape     = PolygonGrid2D.GetSquare(5);
            var roomDoorsMode = new SimpleDoorMode(1, 0);

            var corridor = new PolygonGrid2DBuilder()
                           .AddPoint(0, 1)
                           .AddPoint(0, 2)
                           .AddPoint(2, 2)
                           .AddPoint(2, 0)
                           .AddPoint(1, 0)
                           .AddPoint(1, 1)
                           .Build();

            var corridorDoorsMode = new ManualDoorMode(new List <OrthogonalLineGrid2D>()
            {
                new OrthogonalLineGrid2D(new Vector2Int(0, 1), new Vector2Int(0, 2)),
                new OrthogonalLineGrid2D(new Vector2Int(2, 0), new Vector2Int(1, 0)),
            });

            var expectedLines = new List <OrthogonalLineGrid2D>()
            {
                new OrthogonalLineGrid2D(new Vector2Int(-6, 2), new Vector2Int(-6, 6)), // Left side
                new OrthogonalLineGrid2D(new Vector2Int(-5, 2), new Vector2Int(-5, 6)),
                new OrthogonalLineGrid2D(new Vector2Int(-6, 6), new Vector2Int(-2, 6)), // Top side
                new OrthogonalLineGrid2D(new Vector2Int(-6, 5), new Vector2Int(-2, 5)),
                new OrthogonalLineGrid2D(new Vector2Int(2, -6), new Vector2Int(6, -6)), // Bottom side
                new OrthogonalLineGrid2D(new Vector2Int(2, -5), new Vector2Int(6, -5)),
                new OrthogonalLineGrid2D(new Vector2Int(5, -2), new Vector2Int(5, -6)), // Right side
                new OrthogonalLineGrid2D(new Vector2Int(6, -2), new Vector2Int(6, -6)),
            };

            var expectedPoints = expectedLines
                                 .SelectMany(x => x.GetPoints())
                                 .Distinct()
                                 .ToList();

            var configurationSpace = generator.GetConfigurationSpaceOverCorridor(roomShape, roomDoorsMode, roomShape,
                                                                                 roomDoorsMode, corridor, corridorDoorsMode);

            var configurationSpacePoints = configurationSpace
                                           .Lines
                                           .SelectMany(x => x.GetPoints())
                                           .ToList();

            Assert.That(configurationSpacePoints, Is.EquivalentTo(expectedPoints));
        }
Esempio n. 11
0
        public void GetRoomTemplateInstances_SquareIdentity_ReturnsOneInstance()
        {
            var roomShape       = PolygonGrid2D.GetSquare(10);
            var doorsMode       = new SimpleDoorMode(1, 0);
            var transformations = new List <TransformationGrid2D>()
            {
                TransformationGrid2D.Identity
            };

            var roomTemplate = new RoomTemplate(roomShape, doorsMode, transformations);
            var instances    = generator.GetRoomTemplateInstances(roomTemplate);

            Assert.That(instances.Count, Is.EqualTo(1));
            Assert.That(instances[0].RoomTemplate, Is.EqualTo(roomTemplate));
            Assert.That(instances[0].RoomShape, Is.EqualTo(roomShape));
            Assert.That(instances[0].Transformations, Is.EquivalentTo(transformations));
        }
Esempio n. 12
0
        public static List <RoomTemplate> GetBasicRoomTemplates(Vector2Int scale)
        {
            var overlapScale    = Math.Min(scale.X, scale.Y);
            var doorMode        = new SimpleDoorMode(1 * overlapScale, 0);
            var transformations = TransformationGrid2DHelper.GetAllTransformationsOld().ToList();

            var room1 = new RoomTemplate(
                new PolygonGrid2DBuilder()
                .AddPoint(0, 0)
                .AddPoint(0, 6)
                .AddPoint(3, 6)
                .AddPoint(3, 3)
                .AddPoint(6, 3)
                .AddPoint(6, 0)
                .Build().Scale(scale)
                , doorMode, transformations, name: "L-shape");
            var room2 = new RoomTemplate(
                new PolygonGrid2DBuilder()
                .AddPoint(0, 0)
                .AddPoint(0, 9)
                .AddPoint(3, 9)
                .AddPoint(3, 3)
                .AddPoint(6, 3)
                .AddPoint(6, 0)
                .Build().Scale(scale)
                , doorMode, transformations, name: "L-shape long");
            var room3 = new RoomTemplate(
                new PolygonGrid2DBuilder()
                .AddPoint(0, 0)
                .AddPoint(0, 3)
                .AddPoint(3, 3)
                .AddPoint(3, 6)
                .AddPoint(6, 6)
                .AddPoint(6, 3)
                .AddPoint(9, 3)
                .AddPoint(9, 0)
                .Build().Scale(scale)
                , doorMode, transformations, name: "T-shape");

            return(new List <RoomTemplate>(GetRectangularRoomTemplates(scale))
            {
                room1,
                room2,
                room3,
            });
        }
Esempio n. 13
0
        private List <RoomTemplate> GetSmallRoomTemplates()
        {
            var roomTemplates = new List <RoomTemplate>();
            var doorMode      = new SimpleDoorMode(2, 1);

            roomTemplates.Add(new RoomTemplate(PolygonGrid2D.GetSquare(6), doorMode, transformations, name: "Square 6x6", repeatMode: repeatMode));
            roomTemplates.Add(new RoomTemplate(PolygonGrid2D.GetSquare(8), doorMode, transformations, name: "Square 8x8", repeatMode: repeatMode));
            roomTemplates.Add(new RoomTemplate(PolygonGrid2D.GetRectangle(6, 8), doorMode, transformations, name: "Rectangle 6x8", repeatMode: repeatMode));

            if (enhanceRoomTemplates)
            {
                roomTemplates.Add(new RoomTemplate(PolygonGrid2D.GetSquare(7), doorMode, transformations, name: "Square 7x7", repeatMode: repeatMode));
                roomTemplates.Add(new RoomTemplate(PolygonGrid2D.GetRectangle(5, 7), doorMode, transformations, name: "Rectangle 5x7", repeatMode: repeatMode));
            }

            return(roomTemplates);
        }
Esempio n. 14
0
        public void GetConfigurationSpaceOverCorridor_SquareRoomHorizontalCorridor()
        {
            var roomShape     = PolygonGrid2D.GetSquare(5);
            var roomDoorsMode = new SimpleDoorMode(1, 0);

            var corridor          = PolygonGrid2D.GetRectangle(2, 1);
            var corridorDoorsMode = new ManualDoorMode(new List <OrthogonalLineGrid2D>()
            {
                new OrthogonalLineGrid2D(new Vector2Int(0, 1), new Vector2Int(0, 0)),
                new OrthogonalLineGrid2D(new Vector2Int(2, 0), new Vector2Int(2, 1)),
            });

            var expectedLines = new List <OrthogonalLineGrid2D>()
            {
                new OrthogonalLineGrid2D(new Vector2Int(-7, -4), new Vector2Int(-7, 4)),
                new OrthogonalLineGrid2D(new Vector2Int(7, -4), new Vector2Int(7, 4)),
            };

            var configurationSpace = generator.GetConfigurationSpaceOverCorridor(roomShape, roomDoorsMode, roomShape,
                                                                                 roomDoorsMode, corridor, corridorDoorsMode);

            Assert.That(configurationSpace.Lines.SelectMany(x => x.GetPoints()), Is.EquivalentTo(expectedLines.SelectMany(x => x.GetPoints())));
        }
        public MapDescription <int> GetMapDescription()
        {
            // Create boss room template and room description
            var bossRoom = new RoomTemplate(
                new PolygonGrid2DBuilder()
                .AddPoint(2, 0).AddPoint(2, 1).AddPoint(1, 1).AddPoint(1, 2)
                .AddPoint(0, 2).AddPoint(0, 7).AddPoint(1, 7).AddPoint(1, 8)
                .AddPoint(2, 8).AddPoint(2, 9).AddPoint(7, 9).AddPoint(7, 8)
                .AddPoint(8, 8).AddPoint(8, 7).AddPoint(9, 7).AddPoint(9, 2)
                .AddPoint(8, 2).AddPoint(8, 1).AddPoint(7, 1).AddPoint(7, 0)
                .Build().Scale(new Vector2Int(2, 2)),
                new SimpleDoorMode(1, 1)
                );

            var bossRoomDescription = new BasicRoomDescription(new List <RoomTemplate>()
            {
                bossRoom
            });

            // Create basic room templates and room description
            var doorMode = new SimpleDoorMode(1, 1);

            var squareRoom = new RoomTemplate(
                PolygonGrid2D.GetSquare(8),
                doorMode
                );

            var rectangleRoom = new RoomTemplate(
                PolygonGrid2D.GetRectangle(6, 10),
                doorMode,
                new List <TransformationGrid2D>()
            {
                TransformationGrid2D.Identity, TransformationGrid2D.Rotate90
            }
                );

            var basicRoomDescription = new BasicRoomDescription(new List <RoomTemplate>()
            {
                squareRoom, rectangleRoom
            });

            // Create map description
            var mapDescription = new MapDescription <int>();

            // Get graph
            var graph = GraphsDatabase.GetExample2();

            // Add boss room
            mapDescription.AddRoom(8, bossRoomDescription);

            // Add other rooms
            foreach (var vertex in graph.Vertices.Where(x => x != 8))
            {
                mapDescription.AddRoom(vertex, basicRoomDescription);
            }

            // Add connections
            foreach (var connection in graph.Edges)
            {
                mapDescription.AddConnection(connection.From, connection.To);
            }

            return(mapDescription);
        }
Esempio n. 16
0
        public MapDescription <int> GetMapDescription()
        {
            const bool useLongCorridors    = false;
            const bool useLShapedCorridors = false;
            const bool useWideCorridors    = false;

            // Create basic room templates and room description
            var doorMode = new SimpleDoorMode(1, 1);

            var squareRoom = new RoomTemplate(
                PolygonGrid2D.GetSquare(8),
                doorMode
                );

            var rectangleRoom = new RoomTemplate(
                PolygonGrid2D.GetRectangle(6, 10),
                doorMode,
                new List <TransformationGrid2D>()
            {
                TransformationGrid2D.Identity, TransformationGrid2D.Rotate90
            }
                );

            var basicRoomDescription = new BasicRoomDescription(new List <RoomTemplate>()
            {
                squareRoom, rectangleRoom
            });

            // Basic corridor shape
            var corridorRoom1x2 = new RoomTemplate(
                PolygonGrid2D.GetRectangle(1, 2),
                new ManualDoorMode(new List <OrthogonalLineGrid2D>()
            {
                new OrthogonalLineGrid2D(new Vector2Int(0, 0), new Vector2Int(1, 0)),
                new OrthogonalLineGrid2D(new Vector2Int(0, 2), new Vector2Int(1, 2))
            }),
                new List <TransformationGrid2D>()
            {
                TransformationGrid2D.Identity, TransformationGrid2D.Rotate90
            }
                );

            var corridorRoomDescription = new CorridorRoomDescription(new List <RoomTemplate>()
            {
                corridorRoom1x2
            });

            // Add longer corridor
            if (useLongCorridors)
            {
                var corridorRoom1x4 = new RoomTemplate(
                    PolygonGrid2D.GetRectangle(1, 4),
                    new ManualDoorMode(new List <OrthogonalLineGrid2D>()
                {
                    new OrthogonalLineGrid2D(new Vector2Int(0, 0), new Vector2Int(1, 0)),
                    new OrthogonalLineGrid2D(new Vector2Int(0, 4), new Vector2Int(1, 4))
                }),
                    new List <TransformationGrid2D>()
                {
                    TransformationGrid2D.Identity, TransformationGrid2D.Rotate90
                }
                    );

                corridorRoomDescription.RoomTemplates.Add(corridorRoom1x4);
            }

            // Add l-shaped corridor
            if (useLShapedCorridors)
            {
                var corridorRoomLShaped = new RoomTemplate(
                    new PolygonGrid2DBuilder()
                    .AddPoint(0, 2)
                    .AddPoint(0, 3)
                    .AddPoint(3, 3)
                    .AddPoint(3, 0)
                    .AddPoint(2, 0)
                    .AddPoint(2, 2)
                    .Build(),
                    new ManualDoorMode(new List <OrthogonalLineGrid2D>()
                {
                    new OrthogonalLineGrid2D(new Vector2Int(0, 2), new Vector2Int(0, 3)),
                    new OrthogonalLineGrid2D(new Vector2Int(2, 0), new Vector2Int(3, 0))
                }),
                    TransformationGrid2DHelper.GetAllTransformationsOld().ToList()
                    );

                corridorRoomDescription.RoomTemplates.Add(corridorRoomLShaped);
            }

            // Add wide corridor
            if (useWideCorridors)
            {
                var corridorWide = new RoomTemplate(
                    new PolygonGrid2DBuilder()
                    .AddPoint(1, 0)
                    .AddPoint(1, 1)
                    .AddPoint(0, 1)
                    .AddPoint(0, 4)
                    .AddPoint(1, 4)
                    .AddPoint(1, 5)
                    .AddPoint(2, 5)
                    .AddPoint(2, 4)
                    .AddPoint(3, 4)
                    .AddPoint(3, 1)
                    .AddPoint(2, 1)
                    .AddPoint(2, 0)
                    .Build(),
                    new ManualDoorMode(new List <OrthogonalLineGrid2D>()
                {
                    new OrthogonalLineGrid2D(new Vector2Int(1, 0), new Vector2Int(2, 0)),
                    new OrthogonalLineGrid2D(new Vector2Int(1, 5), new Vector2Int(2, 5))
                }),
                    TransformationGrid2DHelper.GetAllTransformationsOld().ToList()
                    );

                corridorRoomDescription.RoomTemplates.Add(corridorWide);
            }

            // Create map description
            var mapDescription = new MapDescription <int>();
            var graph          = GraphsDatabase.GetExample1();

            // Add non-corridor rooms
            foreach (var room in graph.Vertices)
            {
                mapDescription.AddRoom(room, basicRoomDescription);
            }

            // We need to somehow identify our corridor rooms
            // Here we simply number them and keep track which was the last used number
            var counter = graph.VerticesCount;

            foreach (var connection in graph.Edges)
            {
                if (true)
                {
                    if (true)
                    {
                        if (connection.From % 2 == 0 && connection.To % 2 == 0)
                        {
                            // We manually insert a new node between each neighboring nodes in the graph
                            mapDescription.AddRoom(counter, corridorRoomDescription);

                            // And instead of connecting the rooms directly, we connect them to the corridor room
                            mapDescription.AddConnection(connection.From, counter);
                            mapDescription.AddConnection(connection.To, counter);
                            counter++;
                        }
                        else
                        {
                            mapDescription.AddConnection(connection.From, connection.To);
                        }
                    }
                    else
                    {
                        var desc1 = new CorridorRoomDescription(new List <RoomTemplate>()
                        {
                            corridorRoomDescription.RoomTemplates[0]
                        });
                        var desc2 = new CorridorRoomDescription(new List <RoomTemplate>()
                        {
                            corridorRoomDescription.RoomTemplates[1]
                        });

                        // We manually insert a new node between each neighboring nodes in the graph
                        mapDescription.AddRoom(counter, connection.From % 2 == 0 && connection.To % 2 == 0 ? desc2 : desc1);

                        // And instead of connecting the rooms directly, we connect them to the corridor room
                        mapDescription.AddConnection(connection.From, counter);
                        mapDescription.AddConnection(connection.To, counter);
                        counter++;
                    }
                }
                else
                {
                    // We manually insert a new node between each neighboring nodes in the graph
                    mapDescription.AddRoom(counter, corridorRoomDescription);

                    // And instead of connecting the rooms directly, we connect them to the corridor room
                    mapDescription.AddConnection(connection.From, counter);
                    mapDescription.AddConnection(connection.To, counter);
                    counter++;
                }
            }

            return(mapDescription);
        }