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)
else (col + 3,maxCol - 3)
) g1
(nngen, nnmat) = doCross
g2
(cr, cc)
(Boundaries coord (maxRow, maxCol))
mat
(nngen, nnmat) =
if (cr - 2 > row && cr + 2 < maxRow)
&& (cc - 2 > col && cc + 2 < maxCol)
then
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
:: StdGen
-> (Int, Int)
@ -212,13 +227,12 @@ buildInnerWalls rng input =
btups = (,)
<$> [fst (matmin b) .. fst (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
(\(agen, amat) (cr, nb) -> doCross agen cr nb amat)
(ngen, omat)
(zip crosses nbs)
else trace
("built cross at " ++ show coord ++ " within " ++ show b)
else
(gen, omat)
in (nngen, nnmat)
| otherwise = (gn, mat)