backspaces / agentscript

An Agent Based Modeling system (ABM)
http://backspaces.github.io/agentscript/
GNU General Public License v3.0
107 stars 14 forks source link

Add a helpful warning for non-int world size #23

Closed bennlich closed 3 years ago

bennlich commented 3 years ago

Currently, if you accidentally use a float for minX, maxX, minY, or maxY in your model constructor, this error gets thrown:

Uncaught (in promise) TypeError: Cannot read property 'rectCache' of undefined
    at Patches.patchRect (Patches.js:183)
    at Patches.patchRectXY (Patches.js:204)
    at Turtles.inPatchRectXY (Turtles.js:74)
    at Turtles.inPatchRect (Turtles.js:66)
    at Turtles.inRadius (Turtles.js:85)
    at LandingPageFlockModel.flock (FlockModel.js:42)
    at FlockModel.js:38
    at Turtles.ask (AgentSet.js:272)
    at LandingPageFlockModel.step [as step0] (FlockModel.js:37)
    at LandingPageFlockModel.stepAndTick (Model.js:110)

Would be nice to catch this upstream and print a more helpful error.

backspaces commented 3 years ago

Will do, great idea.

backspaces commented 3 years ago

Should be working now with a new commit.