EECS 110 Recitation 1 Ionut Trestian Northwestern University

  • Slides: 18
Download presentation
EECS 110: Recitation #1: Ionut Trestian Northwestern University http: //cs. northwestern. edu/~akuzma/classes/EECS 110 -s

EECS 110: Recitation #1: Ionut Trestian Northwestern University http: //cs. northwestern. edu/~akuzma/classes/EECS 110 -s 09/

If statements (1) name = raw_input('Hi. . . what is your name? ') if

If statements (1) name = raw_input('Hi. . . what is your name? ') if name == 'Ionut': print 'x 1' # is it Ionut? else: print 'x 2' # in all other cases. . . print 'x 3' hw 0 pr 1. py Homework 0, problem 12

If statements (2) name = raw_input('Hi. . . what is your name? ') if

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

If statements (3) name = raw_input('Hi. . . what is your name? ') if

If statements (3) name = raw_input('Hi. . . what is your name? ') if name == 'Ionut': print 'x 1' # is it Ionut? elif name == 'Aleksandar': print 'x 2' else: print 'x 3' # in all other cases. . . print 'x 4' hw 0 pr 1. py Homework 0, problem 14

If statements (4) name = raw_input('Hi. . . what is your name? ') if

If statements (4) name = raw_input('Hi. . . what is your name? ') if name == 'Ionut': print 'x 1' elif name == 'Aleksandar': print 'x 2' else: print 'x 3' print 'x 4' 5

If statements (5) name = raw_input('Hi. . . what is your name? ') if

If statements (5) name = raw_input('Hi. . . what is your name? ') if name == 'Ionut': print 'x 1' # is it Ionut? elif name == 'Aleksandar': print 'x 2' elif name == 'Lisa': print 'x 3' else: print 'x 4' # in all other cases. . . print 'x 5' hw 0 pr 1. py Homework 0, problem 16

If statements (6) name = raw_input('Hi. . . what is your name? ') if

If statements (6) name = raw_input('Hi. . . what is your name? ') if name == 'Ionut‘: print 'x 1' elif name == 'Aleksandar’: print 'x 2' elif name == 'Lisa': print 'x 3' else: print 'x 4' print 'x 5' 7

Homework problems 3 and 4 Picobot walls Picobot area not covered (yet!) inspiration? area

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

Picobot walls Picobot area not covered (yet!) i. Robot's Roomba vacuum inspiration! area already

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

Surroundings Picobot can only sense things directly to the N, E, W, and S

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

Surroundings How many distinct surroundings are there? N E W S 24 == 16

Surroundings How many distinct surroundings are there? N E W S 24 == 16 possible … xxxx Nxxx x. Exx xx. Wx xxx. S NExx Nx. Wx x. Ex. S xx. WS NEWx NEx. S Nx. WS x. EWS Nxx. S NEWS (won’t happen)

State I am in state 0. My surroundings are xx. WS. Picobot's memory is

State I am in state 0. My surroundings are xx. WS. 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

Rules I am in state 0. My surroundings are xx. WS. Aha! I should

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

Wildcards I am in state 0. My surroundings are xx. WS. Aha! This matches

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

What will this set of rules do to Picobot? state surroundings 0 0 x***

What will this set of rules do to Picobot? state surroundings 0 0 x*** N*** 1 1 ***x ***S direction new state -> -> N X 0 1 -> -> S X 1 0 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.

To do Write rules that will always cover these two rooms. hw 0, Problem

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

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

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

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

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