eliminating toilet bug
This commit is contained in:
parent
5ec3be4429
commit
c4c7541b71
3 changed files with 19 additions and 10 deletions
|
@ -1,5 +1,7 @@
|
|||
module Interior where
|
||||
|
||||
import qualified Affection as A
|
||||
|
||||
import Data.Matrix as M
|
||||
import qualified Data.Map.Strict as Map
|
||||
import Data.List as L
|
||||
|
@ -100,11 +102,14 @@ placeInteriorIO imat imgmat irp graph =
|
|||
newrp = rp ++ map (\(a, b, c) -> ReachPoint a b c)
|
||||
(zip3 reachtypes reaches reachdirs)
|
||||
in
|
||||
if try > 10 || fromIntegral freeRoom < size appl
|
||||
if try >= 10 || fromIntegral freeRoom <= size appl
|
||||
then (g2, (mat, rp))
|
||||
else
|
||||
if (pr + nrows cmat - 1 > fst (matmax bnds) ||
|
||||
pc + ncols cmat - 1 > snd (matmax bnds) ||
|
||||
if pr + nrows cmat - 1 > fst (matmax bnds) ||
|
||||
pc + ncols cmat - 1 > snd (matmax bnds)
|
||||
then A.log A.Debug ("no cluster placed") $
|
||||
placeCluster g2 bnds (try + 1) mat rp appl
|
||||
else if
|
||||
any (`notElem` clusterRoom appl)
|
||||
(M.toList (M.submatrix
|
||||
pr (pr + nrows cmat - 1)
|
||||
|
@ -116,11 +121,15 @@ placeInteriorIO imat imgmat irp graph =
|
|||
pr (pr + nrows cmat - 1)
|
||||
pc (pc + ncols cmat - 1)
|
||||
mat
|
||||
))) ||
|
||||
))
|
||||
then A.log A.Debug ("no cluster placed") $
|
||||
placeCluster g2 bnds (try + 1) mat rp appl
|
||||
else if
|
||||
not (isReachable newmat [] (oldreaches ++ reaches) exits)
|
||||
then placeCluster g2 bnds (try + 1) mat rp appl
|
||||
else placeCluster
|
||||
g2 bnds (try + 1) newmat newrp appl
|
||||
then A.log A.Debug ("no cluster placed") $
|
||||
placeCluster g2 bnds (try + 1) mat rp appl
|
||||
else A.log A.Debug ("placed cluster" ++ show appl) $
|
||||
placeCluster g2 bnds (try + 1) newmat newrp appl
|
||||
|
||||
insertMat
|
||||
:: Matrix (Maybe a)
|
||||
|
|
|
@ -27,7 +27,7 @@ data Cluster
|
|||
| ClusterPlant2
|
||||
| ClusterToilet
|
||||
| ClusterWatercooler
|
||||
deriving (Enum, Bounded)
|
||||
deriving (Enum, Bounded, Show)
|
||||
|
||||
clusterMat :: Cluster -> Matrix (Maybe ImgId)
|
||||
clusterMat ClusterBox1 =
|
||||
|
|
Loading…
Reference in a new issue