eecs 110: recitation #1:
DESCRIPTION
EECS 110: Recitation #1:. Ionut Trestian Northwestern University. http://cs.northwestern.edu/~akuzma/classes/EECS110-s09/. If statements (1). name = raw_input ( 'Hi... what is your name? ' ) if name == 'Ionut' : # is it Ionut? print 'x1' - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: EECS 110: Recitation #1:](https://reader036.vdocuments.us/reader036/viewer/2022062500/56815a9c550346895dc81bc7/html5/thumbnails/1.jpg)
EECS 110: Recitation #1:
Ionut Trestian
Northwestern University
http://cs.northwestern.edu/~akuzma/classes/EECS110-s09/
![Page 2: EECS 110: Recitation #1:](https://reader036.vdocuments.us/reader036/viewer/2022062500/56815a9c550346895dc81bc7/html5/thumbnails/2.jpg)
If statements (1)
2
name = raw_input('Hi... what is your name? ')
if name == 'Ionut': # is it Ionut? print 'x1' else: # in all other cases... print 'x2'
print 'x3'
hw0pr1.py Homework 0, problem 1
![Page 3: EECS 110: Recitation #1:](https://reader036.vdocuments.us/reader036/viewer/2022062500/56815a9c550346895dc81bc7/html5/thumbnails/3.jpg)
If statements (2)
3
name = raw_input('Hi... what is your name? ')
if name == 'Ionut‘: print 'x1' else: print 'x2'
print 'x3'
![Page 4: EECS 110: Recitation #1:](https://reader036.vdocuments.us/reader036/viewer/2022062500/56815a9c550346895dc81bc7/html5/thumbnails/4.jpg)
If statements (3)
4
name = raw_input('Hi... what is your name? ')
if name == 'Ionut': # is it Ionut? print 'x1'
elif name == 'Aleksandar': print 'x2'
else: # in all other cases... print 'x3'
print 'x4'
hw0pr1.py Homework 0, problem 1
![Page 5: EECS 110: Recitation #1:](https://reader036.vdocuments.us/reader036/viewer/2022062500/56815a9c550346895dc81bc7/html5/thumbnails/5.jpg)
If statements (4)
5
name = raw_input('Hi... what is your name? ')
if name == 'Ionut': print 'x1'
elif name == 'Aleksandar': print 'x2'
else: print 'x3'
print 'x4'
![Page 6: EECS 110: Recitation #1:](https://reader036.vdocuments.us/reader036/viewer/2022062500/56815a9c550346895dc81bc7/html5/thumbnails/6.jpg)
If statements (5)
6
name = raw_input('Hi... what is your name? ')
if name == 'Ionut': # is it Ionut? print 'x1'
elif name == 'Aleksandar': print 'x2'
elif name == 'Lisa': print 'x3'
else: # in all other cases... print 'x4'
print 'x5'
hw0pr1.py Homework 0, problem 1
![Page 7: EECS 110: Recitation #1:](https://reader036.vdocuments.us/reader036/viewer/2022062500/56815a9c550346895dc81bc7/html5/thumbnails/7.jpg)
If statements (6)
7
name = raw_input('Hi... what is your name? ')
if name == 'Ionut‘: print 'x1'
elif name == 'Aleksandar’: print 'x2'
elif name == 'Lisa': print 'x3'
else: print 'x4'
print 'x5'
![Page 8: EECS 110: Recitation #1:](https://reader036.vdocuments.us/reader036/viewer/2022062500/56815a9c550346895dc81bc7/html5/thumbnails/8.jpg)
Homework problems 3 and 4
8
Picobot
area not covered
(yet!)
Picobotwalls
area already covered
Goal: whole-environment coverage with only local sensing…
inspiration?
![Page 9: EECS 110: Recitation #1:](https://reader036.vdocuments.us/reader036/viewer/2022062500/56815a9c550346895dc81bc7/html5/thumbnails/9.jpg)
Picobot
9
area not covered
(yet!)
Goal: whole-environment coverage with only local sensing…
area already covered
Picobotwalls
iRobot's Roomba vacuum
inspiration!
![Page 10: EECS 110: Recitation #1:](https://reader036.vdocuments.us/reader036/viewer/2022062500/56815a9c550346895dc81bc7/html5/thumbnails/10.jpg)
Surroundings
10
N
W E
S
Picobot can only sense things directly to the N, E, W, and S
For example, here its surroundings are
NxWxN E W S
Surroundings are always in NEWS order.
![Page 11: EECS 110: Recitation #1:](https://reader036.vdocuments.us/reader036/viewer/2022062500/56815a9c550346895dc81bc7/html5/thumbnails/11.jpg)
How many distinct surroundings are there?
N
EW
S
xxxx Nxxx xExx xxWx xxxS NExx NxWx NxxS
xEWx xExS xxWS NEWx NExS NxWS xEWS NEWS(won’t happen)
== 16 possible …24
Surroundings
![Page 12: EECS 110: Recitation #1:](https://reader036.vdocuments.us/reader036/viewer/2022062500/56815a9c550346895dc81bc7/html5/thumbnails/12.jpg)
State
Picobot's memory is a single number, called its state.
State is the internal context of computation.
State and surroundings represent everything the robot knows about the world
Picobot always starts in state 0.
I am in state 0. My surroundings
are xxWS.
![Page 13: EECS 110: Recitation #1:](https://reader036.vdocuments.us/reader036/viewer/2022062500/56815a9c550346895dc81bc7/html5/thumbnails/13.jpg)
Rules
Picobot moves according to a set of rules:
state
I am in state 0. My surroundings
are xxWS.
surroundings
0 xxWS 0N
direction new state
If I'm in state 0 seeing xxWS,
Then I move North, and change to state 0.
Aha!I should move N.
I should enter state 0.
![Page 14: EECS 110: Recitation #1:](https://reader036.vdocuments.us/reader036/viewer/2022062500/56815a9c550346895dc81bc7/html5/thumbnails/14.jpg)
Wildcards
Asterisks * are wild cards. They match walls or empty space:
0 x*** 0N
state surroundings direction new state
here, EWS may be wall or empty space
I am in state 0. My surroundings
are xxWS.Aha! This matches x***
![Page 15: EECS 110: Recitation #1:](https://reader036.vdocuments.us/reader036/viewer/2022062500/56815a9c550346895dc81bc7/html5/thumbnails/15.jpg)
What will this set of rules do to Picobot?
0 x*** 0N
0 N*** 1X
1 ***x 1S
1 ***S 0X
state surroundings direction new state
Picobot checks its rules from the top each time.
Only one rule is allowed per state and surroundings.
When it finds a matching rule, that rule runs.
->
->
->
->
![Page 16: EECS 110: Recitation #1:](https://reader036.vdocuments.us/reader036/viewer/2022062500/56815a9c550346895dc81bc7/html5/thumbnails/16.jpg)
To do Write rules that will always cover these two rooms.(separate sets of rules are encouraged…)
but your rules should work regardless of Picobot's starting location
hw0, Problem #3 hw0, Problem #4 (Extra)
![Page 17: EECS 110: Recitation #1:](https://reader036.vdocuments.us/reader036/viewer/2022062500/56815a9c550346895dc81bc7/html5/thumbnails/17.jpg)
Alter these "up & down" rules so that Picobot will traverse the empty room…
the empty room
![Page 18: EECS 110: Recitation #1:](https://reader036.vdocuments.us/reader036/viewer/2022062500/56815a9c550346895dc81bc7/html5/thumbnails/18.jpg)
Ideas for the maze?
the maze
Hold on to one wall !!