diff --git a/src/Floorplan.hs b/src/Floorplan.hs index 0f4601a..2e76392 100644 --- a/src/Floorplan.hs +++ b/src/Floorplan.hs @@ -122,10 +122,8 @@ placeHalls rng fc input = (fst (matmin b) + 10, fst (matmax b) - 10) agen (col, g2) = randomR (snd (matmin b) + 10, snd (matmax b) - 10) g1 - -- (nw, g3) = randomR (2, wmax) g2 (nbs, nmat) = buildHall cross 3 b amat in - -- if hallRatio nmat < 0.33 && wmax - 1 >= 2 if wmax - 1 >= 3 && all (\(Boundaries (minr, minc) (maxr, maxc)) -> maxr - minr > 3 && maxc - minc > 3) nbs @@ -311,24 +309,11 @@ buildFacilities -> Matrix TileState -> (StdGen, Matrix TileState) buildFacilities gen fc input = - -- let flood ts mat coords@(cr, cc) = - -- let cur = mat M.! coords - -- altered = M.setElem ts coords mat - -- in - -- if cur == ts || cur /= Offi - -- then mat - -- else foldl (flood ts) - -- altered - -- [ (cr + 1, cc) - -- , (cr - 1, cc) - -- , (cr, cc + 1) - -- , (cr, cc - 1) - -- ] let nearests = map (findNearestOffice input) (fcFacilities fc) in foldl (\(agen, acc) x -> let (numfac, ngen) = randomR (0 :: Int, 1 :: Int) agen facil = if numfac == 1 then Kitc else Toil - in (ngen, flood facil acc x) + in (ngen, facilFlood facil acc x) ) (gen, input) nearests facilFlood ts mat coords@(cr, cc) = @@ -337,7 +322,7 @@ facilFlood ts mat coords@(cr, cc) = in if cur == ts || cur /= Offi then mat - else foldl (flood ts) + else foldl (facilFlood ts) altered [ (cr + 1, cc) , (cr - 1, cc) @@ -543,9 +528,6 @@ findNeighbor (dir, _) bnds ingraph in case filtered of [a@(GRoom _ _ _ _)] -> Just a - -- if ts == neighTile row col - -- then Just a - -- else error "findNeighbor: Query Result does not match" [] -> Nothing _ -> error "findNeighbor: Non-singleton filter result"