tink-a-tink-tink

This commit is contained in:
nek0 2018-02-14 18:32:05 +01:00
parent 40d706887e
commit 5ab26a1507

View File

@ -170,11 +170,26 @@ buildInnerWalls rng input =
then (col + 2, col + 2) then (col + 2, col + 2)
else (col + 3,maxCol - 3) else (col + 3,maxCol - 3)
) g1 ) g1
(nngen, nnmat) = doCross (nngen, nnmat) =
g2 if (cr - 2 > row && cr + 2 < maxRow)
(cr, cc) && (cc - 2 > col && cc + 2 < maxCol)
(Boundaries coord (maxRow, maxCol)) then
mat doCross
g2
(cr, cc)
(Boundaries coord (maxRow, maxCol))
mat
else
let btups = (,)
<$> [fst (coord) .. maxRow]
<*> [snd (coord) .. maxCol]
in
( g2
, foldl
(\acc coords ->
M.setElem (replaceTile (acc M.! coords) Offi) coords acc
) mat btups
)
doCross doCross
:: StdGen :: StdGen
-> (Int, Int) -> (Int, Int)
@ -212,13 +227,12 @@ buildInnerWalls rng input =
btups = (,) btups = (,)
<$> [fst (matmin b) .. fst (matmax b)] <$> [fst (matmin b) .. fst (matmax b)]
<*> [snd (matmin b) .. snd (matmax b)] <*> [snd (matmin b) .. snd (matmax b)]
in if trace ("bs: " ++ show (boundSize b)) (boundSize b) >= 16 in if boundSize b >= 16
then foldl then foldl
(\(agen, amat) (cr, nb) -> doCross agen cr nb amat) (\(agen, amat) (cr, nb) -> doCross agen cr nb amat)
(ngen, omat) (ngen, omat)
(zip crosses nbs) (zip crosses nbs)
else trace else
("built cross at " ++ show coord ++ " within " ++ show b)
(gen, omat) (gen, omat)
in (nngen, nnmat) in (nngen, nnmat)
| otherwise = (gn, mat) | otherwise = (gn, mat)