public class RectangleRoomFinder
extends java.lang.Object
RoomFinder
. You can execute
RectangleRoomsFinderTest
to see how it performs.A fancier room finder
Modifier and Type | Field and Description |
---|---|
protected char[][] |
dungeon |
protected int |
dungeonHeight |
protected int |
dungeonWidth |
protected java.util.Set<java.lang.Character> |
floors |
int |
minimumDiagonal
The minimum number of cells that the diagonal of a room must have.
|
boolean |
onlySquareRooms
true to restrict this to find square rooms |
Constructor and Description |
---|
RectangleRoomFinder(char[][] dungeon) |
Modifier and Type | Method and Description |
---|---|
boolean |
addFloorCharacter(char c)
Adds a character considered as a floor.
|
protected Rectangle |
extendRoom(boolean[][] assigneds,
Rectangle r,
Direction d) |
protected Rectangle |
extendRoomOnce(boolean[][] assigneds,
Rectangle r,
Direction d) |
java.util.List<Rectangle> |
findRectangles() |
protected boolean |
isFloor(char c) |
protected boolean |
isInDungeon(Coord c) |
boolean |
removeFloorCharacter(char c)
Removes a character from being considered as a floor.
|
protected final char[][] dungeon
protected final int dungeonWidth
protected final int dungeonHeight
protected final java.util.Set<java.lang.Character> floors
public int minimumDiagonal
public boolean onlySquareRooms
true
to restrict this
to find square roomspublic boolean addFloorCharacter(char c)
c
- true
if c
wasn't a floor character.public boolean removeFloorCharacter(char c)
c
- true
if c
was a floor character.public java.util.List<Rectangle> findRectangles()
protected Rectangle extendRoom(boolean[][] assigneds, Rectangle r, Direction d)
assigneds
- Cells already in a room.d
- A cardinal direction.r
extended to the direction d
, if
possible. r
itself if unaffected.protected Rectangle extendRoomOnce(boolean[][] assigneds, Rectangle r, Direction d)
assigneds
- Cells already in a room. This array is muted by this call.protected boolean isFloor(char c)
protected boolean isInDungeon(Coord c)
Copyright © Eben Howard 2012–2022. All rights reserved.