Class 6: April 11, 2008

From IPRE Wiki
Revision as of 08:17, 14 January 2009 by Mansi (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

We advanced with the concepts of loops and conditionals in this class by playing a number game, drawing different shapes and playing in a life-size maze. First, we reinforced the concepts by talking to the class and clarifying any confusions. Then we played a number game - the computer would choose a number and the students would try to guess it. If they guessed it right, then they won and the game ended; if not, the computer would tell them if the number is too high or too low accordingly. This taught them about if-else statements. Also, they were given only 10 tries - this taught them more about loops. Then we let the students play in the maze- they could steer their robots around by writing little programs and pick up objects that had been scattered along the way. We wrote a wall function that the students could use in their code to tell whether or not they see a wall. Then they could use their knowledge of if, else and loops to make their robots go around. After this activity, we allowed the students to make squares, triangles and rectangles - again with using conditional statements.

We defined wall as:

def wall(): 
		return getObstacle(1) > 4500

def heads(): 
		return flipCoin() == "heads" 

def flipCoin(): 

so that it could be used in the following manner:

def walk():
   if wall():
     if heads():
        turnLeft(0.7, 0.2)‏
        turnRight(0.7, 0.2)‏

Here are survey results from that class:

- 69.2% said their favorite part was playing in the maze; 30.8% the number game was their favorite; 23.1% enjoyed drawing the shapes most.
- When asked what their least favorite part of class was, 50.3% replied that they liked everything that was done in class. 
- When asked if they liked their robot:
    - 69.2% said that they did.
    - 23.1% said that it was OK.
    - 7.7% said that they did not like it.
- When asked if they liked this class more than last week's class:
    - 69.2% replied yes
    - 30.8% replied were neutral.
    - 0% replied no!
- 92.3% are excited to come and play with their robots next week. The rest are neutral, again a 0% no!

Here is some code that one of the students in the class wrote:

def maze():
    if wall():
        if heads():
            if wall():
            if wall():
        forward (0.1)‏

CREU Project Home.