exerciseJan25

exerciseJan25 - ask the user the number of steps they want...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
COMP202 Instructor: Ladan Mahabadi January 25, 2008 Tutorial Sessions: Write a program that prompts the user to enter the day of the week. The user can enter 1 through 5 representing Monday through Friday (you may assume that the user enters a valid value). Your program should proceed to display the tutorial schedules: Thursday: 14:30 - 16:30 Friday: 14:30 - 16:30 Monday: 13:30 - 15:30 Tuesday: 12:30 - 14:30 Wednesday: 16:30 - 18:30
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Robotic Fly: Imagine that you have a robotic fly (e.g. http://harvardmagazine.com/web/extras/robotic-fly ) that flies and sits on a grid with 9 cells. Your grid is a 3 X 3 grid in which Associated with each cell is a reward: Cells 1, 5, 9: + 5 Cells 3, 7: -5 Cells 2, 6: +1 Cells 4, 8: -1 Prompt the user where they want to start from (they user will enter a value between 1 & 9), then
Background image of page 2
This is the end of the preview. Sign up to access the rest of the 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

Page1 / 2

exerciseJan25 - ask the user the number of steps they want...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online