Module 12 · In Studio · challenge 3 of 3 in this lesson

challenges/work/scrap_field.luau gives the same piles for the same seed and chunk, in any call order

A test in Studio grades it and prints a pass code.

Open

Level 3, Professional

Challenge

Start from the m14-ship tag in the game repo, then make the stock generator pass. It uses math.random and ignores the yard. Run it from the command bar with game.ServerScriptService.RunGameTests:Invoke("procedural-generation").

Start from
The game at milestone m14 (download)
Grade it
In Studio, press Play, then run game.ServerScriptService.RunGameTests:Invoke("procedural-generation") in the server command bar. Copy the pass code from Output.

Done means

  • challenges/work/scrap_field.luau gives the same piles for the same seed and chunk, in any call order
  • Seeds 7 and 8 give different fields
  • No pile inside the square around the centre: a pile is rejected when both its x and z are within 52 studs of 0, so (40, 40) fails even though it is more than 52 studs away in a straight line
  • Every pile is inside its chunk, sizes are 1 to 8, there are at most 48 per chunk, and the field is not empty

The Course Runner prints this code when the test passes.