This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void AddDoors(Level level) | |
{ | |
for (int y = RoomStart.Y - 1; y <= RoomStart.Y + Height; y++) | |
{ | |
for (int x = RoomStart.X-1; x <= RoomStart.X + Width; x ++) | |
{ | |
if (y != RoomStart.Y - 1 && y != RoomStart.Y + Height && x != RoomStart.X - 1 && x != RoomStart.X + Width) | |
continue; | |
if (y < 0) continue; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void connectRooms(List<Room> rooms) | |
{ | |
/* | |
Input: A non-empty connected weighted graph with vertices V and edges E (the weights can be negative). | |
Initialize: Vnew = {x}, where x is an arbitrary node (starting point) from V, Enew = {} | |
Repeat until Vnew = V: | |
Choose an edge {u, v} with minimal weight such that u is in Vnew and v is not | |
* (if there are multiple edges with the same weight, any of them may be picked) | |
Add v to Vnew, and {u, v} to Enew | |
Output: Vnew and Enew describe a minimal spanning tree |
NewerOlder