still not finding toilet bug

This commit is contained in:
nek0 2018-10-15 00:26:12 +02:00
parent c4c7541b71
commit d79d9b1ed9
4 changed files with 13 additions and 6 deletions

View file

@ -125,11 +125,18 @@ placeInteriorIO imat imgmat irp graph =
then A.log A.Debug ("no cluster placed") $ then A.log A.Debug ("no cluster placed") $
placeCluster g2 bnds (try + 1) mat rp appl placeCluster g2 bnds (try + 1) mat rp appl
else if else if
not (isReachable newmat [] (oldreaches ++ reaches) exits) any (`elem` (oldreaches))
(V2
<$> [pr .. pr + nrows cmat - 1]
<*> [pc .. pc + ncols cmat - 1])
then A.log A.Debug ("no cluster placed") $ then A.log A.Debug ("no cluster placed") $
placeCluster g2 bnds (try + 1) mat rp appl placeCluster g2 bnds (try + 1) mat rp appl
else A.log A.Debug ("placed cluster" ++ show appl) $ else if
placeCluster g2 bnds (try + 1) newmat newrp appl not (isReachable newmat [] (oldreaches ++ reaches) exits)
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 insertMat
:: Matrix (Maybe a) :: Matrix (Maybe a)

View file

@ -3,7 +3,7 @@ module Navigation where
import Affection as A import Affection as A
import Data.Matrix as M import Data.Matrix as M
import Data.Maybe (isJust) import Data.Maybe (isJust, catMaybes)
-- internal imports -- internal imports

View file

@ -97,5 +97,5 @@ instance Collidible ImgId where
[ Boundaries (14/36, 14/36) (22/36, 22/36) [ Boundaries (14/36, 14/36) (22/36, 22/36)
] ]
collisionObstacle ImgEmptyNoWalk = collisionObstacle ImgEmptyNoWalk =
[ Boundaries (0, 0) (1, 1) ] [ Boundaries (0, 0) (0.99, 0.99) ]
collisionObstacle _ = [] collisionObstacle _ = []

View file

@ -193,7 +193,7 @@ naviGraph imgmat animBounds (V2 r c) =
(\(V2 br bc, _) -> floor br == r + oor && floor bc == c + ooc) (\(V2 br bc, _) -> floor br == r + oor && floor bc == c + ooc)
animBounds)) animBounds))
[(0, cc), (rr, 0)]) [(0, cc), (rr, 0)])
then V2 (r + rr) (c + cc): acc then V2 (r + rr) (c + cc) : acc
else acc else acc
) )
[] []