Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is my proposed fix to Issue #418. Analogously to Issues #413, #414, and #419, the "problem" seems to be that the move generation logic sometimes tries to move pieces off the board. As with PR #426, the simplest solution is to expand the array with appropriate slack space, a technique used elsewhere for the same purpose. In each of the cases here we (apparently) need only ensure that there's enough slack to enable stepping one space outside the board, and for
move_diff_code
this only requires adding one additional row.As long as I was making the above change, I also took the liberty of abstracting the interface. No more remembering that we have to pass
abs(from - to)
; instead we'll just call a simple function that will do whatever is necessary.