This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: ask the user the number of steps they want the fly to move around. At each step, flip a 4-sided coin and move according to: 1. North 2. South 3. East 4. West At each move, check that its possible to move to that cell. For example, if your in cell 1, then moving West isnt possible. In situations such as this, announce to the user that the move has failed, prompt the current position, and prompt them with a choice of 1. North 2. South 3. East 4. West Move accordingly (you may assume here that the user moves the fly to a valid position). Since associated with each cell is a reward, update the flys accumulative reward at each step and display the total reward at the end. \...
View Full Document
- Winter '07