Skip to content

Commit

Permalink
wip experimental
Browse files Browse the repository at this point in the history
  • Loading branch information
kostmo committed Sep 22, 2024
1 parent b98116b commit 3d3fe52
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module Swarm.Game.Scenario.Topography.Structure.Assembly (
)
where

import Debug.Trace (trace)
import Control.Arrow (left, (&&&))
import Control.Monad (when)
import Data.Coerce
Expand Down Expand Up @@ -122,14 +123,23 @@ overlayGridExpanded
-- The 'childAdjustedOrigin' is the sum of origin adjustments
-- to completely assemble some substructure.
(PositionedGrid childAdjustedOrigin overlayArea) =

Check warning on line 125 in src/swarm-topography/Swarm/Game/Scenario/Topography/Structure/Assembly.hs

View workflow job for this annotation

GitHub Actions / Haskell-CI - windows-latest - ghc-9.8.2

Defined but not used: ‘childAdjustedOrigin’
baseGrid <> positionedOverlay
trace (unwords [
"Merging base grid at position"
, show $ gridPosition baseGrid
, "with overlay grid at position"
, show $ gridPosition positionedOverlay
]) result
where
result = baseGrid <> positionedOverlay

reorientedOverlayCells = applyOrientationTransform orientation overlayArea

-- placementAdjustedByOrigin = (gridPosition baseGrid .+^ asVector yamlPlacementOffset) .-^ asVector childAdjustedOrigin
placementAdjustedByOrigin = yamlPlacementOffset

-- FIXME This experiment gives incorrect results
-- (examine "simultaneous-north-and-west-offset.yaml"):
placementAdjustedByOrigin = yamlPlacementOffset .-^ asVector childAdjustedOrigin
-- placementAdjustedByOrigin = yamlPlacementOffset .-^ asVector childAdjustedOrigin

positionedOverlay = PositionedGrid placementAdjustedByOrigin reorientedOverlayCells

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ zipGridRows ::
zipGridRows dims (OverlayPair paddedBaseRows paddedOverlayRows) =
mkGrid $ (pad2D paddedBaseRows . pad2D paddedOverlayRows) blankGrid
where
-- Right-bias; that is, take the last non-empty value
-- Right-biased; that is, takes the last non-empty value
pad2D = zipPadded $ zipPadded $ flip (<|>)
blankGrid = getRows $ fillGrid dims empty

Expand Down

0 comments on commit 3d3fe52

Please sign in to comment.