Hello Daniel,
The following comments are additional to Peg's observation about the food deficit to the canine.
While not the cause of your illegal BP error, you will need to place the code that must execute multiple times within the "main loop" - within the loop forever block. Any code prior to this is normally intended to execute once only - except that your code seems to create another never-ending loop (assuming variable x remains at 1), and the following code will never be reached.
If you are sensing a mechanical pushbutton, you will also need to consider some de-bounce delay before re-testing the pushbutton state. Otherwise it would be possible for the reverse() function to execute multiple times for a single keypress, probably not what you intend.
Regards,
Mac