This code:
sprinklerx = mid(sprinklermaxx+1,sprinklerminx-1,sprinklerx) |
is not equal to this:
if (sprinklerx>sprinklermaxx) sprinklerx = sprinklermaxx if (sprinklerx<sprinklerminx) sprinklerx = sprinklerminx |
Bug or what?
//edit: To elaborate, MID version always returns sprinklermaxx+1 for some reason, even if sprinklerx is 1. If we only had better debugging, like stepthrough, breakpoints...
P#13499 2015-09-01 13:42 ( Edited 2015-09-01 23:19)


The mid function assumes that the 1st argument is the lower bound, and the 3rd argument is the higher bound. I'll admit that this behavior isn't exactly what it says on the tin, and it should probably called something like "clamp" or fixed to work any way.
P#13502 2015-09-01 13:53 ( Edited 2015-09-01 17:53)
[Please log in to post a comment]