CMPUT101 Lecture 1: BB intro.docx

122 views10 pages

Document Summary

World- grid of cells, robot in a cell, beepers in a cell. State of robot: position, direction, #beepers in each bag. 0) destroy_beeper: destroys a beeper at bb"s current location. turn_off: Draw a square: turn_left turn_left turn_left: create_beeper, move, create_beeper, move, create_beeper. 8: create_beeper, move, create_beeper, move, create_beeper, move do (#) { create_beeper. Subroutines (abstraction)= named code block define turn_right { do (3) { turn_left. Yes because the program is general for position. No because the program is not general for direction. } else { (random code c) (random code d) Is there at least one beeper in the cell? front_is_clear. Will bb hit a wall if it moves. Can put not in front of these has_beeper (0) facing_north. Write a program to remove a beeper if at least one exists and create a beeper if none exists in the cell b is in.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents