Skip to content

Instantly share code, notes, and snippets.

@IntegerMan
Created October 6, 2019 03:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IntegerMan/8cb4e8f655e4069a20a3d95fbe7ec184 to your computer and use it in GitHub Desktop.
Save IntegerMan/8cb4e8f655e4069a20a3d95fbe7ec184 to your computer and use it in GitHub Desktop.
let hasInvalidlyPlacedItems (items: Actor array, maxX: int32, maxY: int32): bool =
let mutable hasIssues = false
for itemA in items do
// Don't allow items to spawn in corners
if (itemA.Pos.X = 1 || itemA.Pos.X = maxX) && (itemA.Pos.Y = 1 || itemA.Pos.Y = maxY) then
hasIssues <- true
for itemB in items do
if itemA <> itemB then
// Don't allow two objects to start next to each other
if isAdjacentTo itemA.Pos itemB.Pos then
hasIssues <- true
hasIssues
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment