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/54426bc8508095325d46302094b5f380 to your computer and use it in GitHub Desktop.
Save IntegerMan/54426bc8508095325d46302094b5f380 to your computer and use it in GitHub Desktop.
let generate (maxX:int32, maxY:int32, getRandom): Actor array =
let mutable items: Actor array = buildItemsArray(maxX, maxY, getRandom)
// It's possible to generate items in invalid starting configurations. Make sure we don't do that.
while hasInvalidlyPlacedItems(items, maxX, maxY) do
items <- buildItemsArray(maxX, maxY, getRandom)
items
let makeWorld maxX maxY random =
let actors = generate(maxX, maxY, random)
{ MaxX = maxX
MaxY = maxY
Squirrel = actors.[0]
Tree = actors.[1]
Doggo = actors.[2]
Acorn = actors.[3]
Rabbit = actors.[4] }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment