Presentation is loading. Please wait.

Presentation is loading. Please wait.

Ionut Trestian Northwestern University

Similar presentations


Presentation on theme: "Ionut Trestian Northwestern University"— Presentation transcript:

1 Ionut Trestian Northwestern University
EECS 110: Recitation #1: Ionut Trestian Northwestern University

2 If statements (1) hw0pr1.py Homework 0, problem 1
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

3 If statements (2) name = raw_input('Hi... what is your name? ')
if name == 'Ionut‘: print 'x1' else: print 'x2' print 'x3'

4 If statements (3) hw0pr1.py Homework 0, problem 1
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

5 If statements (4) name = raw_input('Hi... what is your name? ')
if name == 'Ionut': print 'x1' elif name == 'Aleksandar': print 'x2' else: print 'x3' print 'x4'

6 If statements (5) hw0pr1.py Homework 0, problem 1
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

7 If statements (6) 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'

8 Goal: whole-environment coverage with only local sensing…
Homework problems 3 and 4 walls Picobot Picobot area not covered (yet!) area already covered Goal: whole-environment coverage with only local sensing… inspiration?

9 Goal: whole-environment coverage with only local sensing…
Picobot walls Picobot area not covered (yet!) area already covered Goal: whole-environment coverage with only local sensing… iRobot's Roomba vacuum inspiration!

10 NxWx Surroundings N E W S
Picobot can only sense things directly to the N, E, W, and S N W E S For example, here its surroundings are NxWx Surroundings are always in NEWS order. N E W S

11 How many distinct surroundings are there?
24 == 16 possible … xxxx Nxxx xExx xxWx xxxS NExx NxWx NxxS xEWx xExS xxWS NEWx NExS NxWS xEWS NEWS (won’t happen)

12 State I am in state 0. My surroundings are xxWS. Picobot's memory is a single number, called its state. State is the internal context of computation. Picobot always starts in state 0. State and surroundings represent everything the robot knows about the world

13 Rules Aha! I should move N. I should enter state 0.
I am in state 0. My surroundings are xxWS. Aha! I should move N. I should enter state 0. Picobot moves according to a set of rules: state surroundings direction new state xxWS N If I'm in state 0 seeing xxWS, Then I move North, and change to state 0.

14 here, EWS may be wall or empty space
Wildcards I am in state 0. My surroundings are xxWS. Aha! This matches x*** Asterisks * are wild cards They match walls or empty space: state surroundings direction new state x*** N here, EWS may be wall or empty space

15 x*** -> N*** -> ***x -> ***S ->
What will this set of rules do to Picobot? state surroundings direction new state x*** -> N N*** -> X 1 1 ***x -> S 1 1 ***S -> X Picobot checks its rules from the top each time. When it finds a matching rule, that rule runs. Only one rule is allowed per state and surroundings.

16 To do hw0, Problem #3 hw0, Problem #4 (Extra)
Write rules that will always cover these two rooms. (separate sets of rules are encouraged…) hw0, Problem #3 hw0, Problem #4 (Extra) but your rules should work regardless of Picobot's starting location

17 Alter these "up & down" rules so that Picobot will traverse the empty room…

18 Ideas for the maze? Hold on to one wall !! the maze


Download ppt "Ionut Trestian Northwestern University"

Similar presentations


Ads by Google