Lecture02 Note
Lecture02 Note
Lecture 2
Spring 2015
Zigzag1*
Hurdles1*
Newspaper delivery
Harvest1
Hurdles2
Harvest2*
Harvest3
>>>hubo =
>>>hubo.move() >>>hubo.turn_left
Robot()
# My first program
from cs1robots import *
create_world()
1
3
4
0
hubo.turn_left() hubo.move()
# turn right and move
hubo.move()
turn_right()
CCE20003 – Lecture 2 Handong Global University 15
PRACTICE USING FUNCTIONS 1
PROBLEM 1: ZIGZAG1*
Write a program zigzag.py that makes your robot visit
the entire world in a zigzag fashion.
PROBLEM2: HURDLES1*
Hubo has entered a hurdles race with obstacles as in the
world file hurdles1. Write a program that makes Hubo
follow the path indicated below in his way to picking up
a beeper, which is at grid(10,1).
PROBLEM 6: HARVEST2
Do Harvest1 using for-loops.
PROBLEM 7: HARVEST3
Load “worlds/harvest2.wld”
Pick up all beepers in this map?