Skip to content

Instantly share code, notes, and snippets.

Created October 6, 2019 03:18
What would you like to do?
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment