package mapgens import ( "context" "lab.zaar.be/thefish/alchemyst-go/engine/gamemap" "lab.zaar.be/thefish/alchemyst-go/engine/types" "lab.zaar.be/thefish/alchemyst-go/util" "lab.zaar.be/thefish/alchemyst-go/util/delaunay" ) func DelaunayPureGen(ctx context.Context, l *gamemap.Level) (*gamemap.Level, []gamemap.Room) { rng := util.NewRNG() //fill with walls for i := 0; i < l.W; i ++ { for j := 0; j < l.H; j++ { l.SetTileByXY(i, j, gamemap.NewWall()) } } rooms := GetRandomRoomList(rng, l, maxrooms, minRoomSize, maxRoomSize) BlitToLevel(l, rooms) centers := make([]types.Coords, 0) for _, room := range rooms { centers = append(centers, room.Center) } edges := delaunay.GetTriangles(centers, l.W, l.H) for _, edge := range edges { MedianStraight(rng, l, rooms, centers, edge) } return l, rooms }