Skip to content

Commit

Permalink
add note
Browse files Browse the repository at this point in the history
  • Loading branch information
byorgey committed Jan 13, 2024
1 parent 9849f63 commit 49bad3c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/swarm-engine/Swarm/Game/Location.hs
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ euclidean p1 p2 = norm (fromIntegral <$> (p2 .-. p1))
-- [P (V2 0 0), P (V2 0 1), P (V2 0 (-1)), P (V2 1 0), P (V2 1 1), P (V2 1 (-1))]
-- >>> map (\i -> length (getLocsInArea origin i)) [0..8]
-- [1,5,13,25,41,61,85,113,145]
--
-- See also @Swarm.Game.Step.Const.genDiamondSides@.
getLocsInArea :: Location -> Int32 -> [Location]
getLocsInArea loc r =
[loc .+^ V2 dx dy | x <- [0 .. r], y <- [0 .. r - x], dx <- nub [x, -x], dy <- nub [y, -y]]
Expand Down

0 comments on commit 49bad3c

Please sign in to comment.