Reference to C
and from Scirra manual
CONSTANT are variable that are initialized ONCE at the beginning. They are supposed to hold unchanging values.
STATIC are variables that persist in a class or function between calls, but allow for the variable content to change.
Since maxCarrots can change he should be setting the it's toggle to static not const. Will this fix your problem? no idea, but it's what you should be doing to your maxCarrots variable as you need it to persist and change.
static = on
const = off