Skip to content

Commit

Permalink
Restyled by fourmolu
Browse files Browse the repository at this point in the history
  • Loading branch information
restyled-commits committed Sep 16, 2024
1 parent 2cfc312 commit 12f8ae3
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ where
import Control.Arrow (left, (&&&))
import Control.Monad (when)
import Data.Coerce
import Debug.Trace
import Data.Either.Extra (maybeToEither)
import Data.Foldable (foldlM)
import Data.Map qualified as M
import Data.Set qualified as Set
import Data.Text (Text)
import Data.Text qualified as T
import Debug.Trace
import Linear.Affine
import Swarm.Game.Location
import Swarm.Game.Scenario.Topography.Area
Expand Down Expand Up @@ -50,14 +50,18 @@ overlaySingleStructure
let mergedWaypoints = inputWaypoints <> map (fmap $ placeOnArea overlayArea) overlayWaypoints
mergedPlacements = inputPlacements <> map (placeOnArea overlayArea) overlayPlacements
mergedArea2 = overlayGridExpanded (show sName) inputArea pose overlayArea
mergedArea = trace (unwords [
"For placement of"
, show sName
, "at loc"
, show loc
, "where input has offset"
, show $ offset pose
]) mergedArea2
mergedArea =
trace
( unwords
[ "For placement of"
, show sName
, "at loc"
, show loc
, "where input has offset"
, show $ offset pose
]
)
mergedArea2

return $ MergedStructure mergedArea mergedPlacements mergedWaypoints
where
Expand Down Expand Up @@ -107,7 +111,7 @@ mergeStructures inheritedStrucDefs parentPlacement (Structure origArea subStruct
-- * Grid manipulation

overlayGridExpanded ::
String ->
String ->
PositionedGrid (Maybe a) ->
Pose ->
PositionedGrid (Maybe a) ->
Expand All @@ -120,18 +124,21 @@ overlayGridExpanded
-- to completely assemble some substructure. However, we discard
-- this when we place a substructure into a new base grid.
(PositionedGrid childAdjustedOrigin overlayArea) =
trace (unwords [
"In overlayGridExpanded for"
, note
, "where childAdjustedOrigin ="
, show childAdjustedOrigin
, "and placementOffset ="
, show yamlPlacementOffset
, "and placementAdjustedByOrigin ="
, show placementAdjustedByOrigin
, ". New origin will be:"
, show $ gridPosition output
]) output
trace
( unwords
[ "In overlayGridExpanded for"
, note
, "where childAdjustedOrigin ="
, show childAdjustedOrigin
, "and placementOffset ="
, show yamlPlacementOffset
, "and placementAdjustedByOrigin ="
, show placementAdjustedByOrigin
, ". New origin will be:"
, show $ gridPosition output
]
)
output
where
output = baseGrid <> positionedOverlay
reorientedOverlayCells = applyOrientationTransform orientation overlayArea
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ module Swarm.Game.Scenario.Topography.Structure.Overlay (
) where

import Control.Applicative
import Debug.Trace
import Data.Function (on)
import Data.Int (Int32)
import Data.Tuple (swap)
import Debug.Trace
import Linear hiding (trace)
import Swarm.Game.Location
import Swarm.Game.Scenario.Topography.Area
Expand Down Expand Up @@ -116,14 +116,18 @@ instance (Alternative f) => Semigroup (PositionedGrid (f a)) where
clampedDelta = V2 (min 0 deltaX) (max 0 deltaY)
newOrigin2 = baseLoc .-^ clampedDelta

newOrigin = trace (unwords [
"COMBINING baseLoc"
, show baseLoc
, "with overlayLoc"
, show overlayLoc
, "to get"
, show newOrigin2
]) newOrigin2
newOrigin =
trace
( unwords
[ "COMBINING baseLoc"
, show baseLoc
, "with overlayLoc"
, show overlayLoc
, "to get"
, show newOrigin2
]
)
newOrigin2

paddedOverlayPair =
padSouthwest (overlayLoc .-. origin) $
Expand Down
16 changes: 8 additions & 8 deletions test/integration/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -440,14 +440,14 @@ testScenarioSolutions rs ui key =
[ testSolution Default "Testing/1535-ping/1535-in-range"
, testSolution Default "Testing/1535-ping/1535-out-of-range"
]
-- , testGroup
-- "Structure placement (#1780)"
-- [ testSolution Default "Testing/1780-structure-merge-expansion/nonoverlapping-structure-merge"
-- , testSolution Default "Testing/1780-structure-merge-expansion/root-map-expansion"
-- , testSolution Default "Testing/1780-structure-merge-expansion/structure-composition"
-- , testSolution Default "Testing/1780-structure-merge-expansion/sequential-placement"
-- ]
, testGroup
, -- , testGroup
-- "Structure placement (#1780)"
-- [ testSolution Default "Testing/1780-structure-merge-expansion/nonoverlapping-structure-merge"
-- , testSolution Default "Testing/1780-structure-merge-expansion/root-map-expansion"
-- , testSolution Default "Testing/1780-structure-merge-expansion/structure-composition"
-- , testSolution Default "Testing/1780-structure-merge-expansion/sequential-placement"
-- ]
testGroup
"Structure recognition (#1575)"
[ testSolution Default "Testing/1575-structure-recognizer/1575-browse-structures"
, testSolution Default "Testing/1575-structure-recognizer/1575-nested-structure-definition"
Expand Down

0 comments on commit 12f8ae3

Please sign in to comment.