I'm pretty sure negative moves are fine -- see `moves -= 100` later in this function. You won't get wrap-around, since there's an `if (moves < 0) return` short-circuit above this.