Generating Algorithm

Hi there,

I’m trying to add a feature to my game where a region is created dynamically using a combination of a pre-existing region.
This part of the game will be a sort of adventure where the place is different every time.

This is a picture of the original location, when called, the server would copy parts of this region and make an instance of a new region.

This new region will always have the coordinates [6, 6] as the starting room. Each room has a certain number of doors used to get across each room.

Here’s a picture of the new region and all the potential spots the rooms can be placed.

new DungeonFloor(new int[] { 8, 632 }, FloorType.BASE_FLOOR, new int[] { NORTH, SOUTH, EAST, WEST }),
		new DungeonFloor(new int[] { 8, 630 }, FloorType.BASE_FLOOR, new int[] { NORTH, SOUTH, WEST }),
		new DungeonFloor(new int[] { 8, 628 }, FloorType.BASE_FLOOR, new int[] { NORTH, SOUTH, }),
		new DungeonFloor(new int[] { 8, 626 }, FloorType.BASE_FLOOR, new int[] { SOUTH, WEST }),
		new DungeonFloor(new int[] { 8, 624 }, FloorType.BASE_FLOOR, new int[] { SOUTH }),

Here’s a picture of the dungeons.
The parameters are as follows
[] { regionX and regionY } // Used to copy the original location
Type of floor
The door directions of that original location

These are all the same room except the doors are different. Each room can be rotated to make the doors work.

The problem:
I need an algorithm that finds a starter floor with the correct number of doors, places it at (6, 6).
Places the best boss floor at any region
makes a map around the boss floor covering x number of rooms. x being a parameter that’s sent with the method call.
Spawns a room for the map coordinates, finding the best room (depending on the number of doors it has) and rotates it so it works out perfectly.

The code so far:


List<DungeonFloor> allFloors = Arrays.asList(DungeonRepository.DUNGEON_FLOORS);
List<DungeonFloor> starterRooms = new LinkedList<DungeonFloor>();

for (DungeonFloor floor : allFloors) {
	if (floors.type() == FloorType.BASE_FLOOR)
	starterFloors.add(floor);
}

Help ???