## Updated Binky Reference

• binky.left() binky.right() binky.move() - drive around
• binky.paint('red') # or 'green' or 'blue'
• binky.front_clear()
-returns True or False
-indicating if the square in front can be moved to
-(a square with color can be moved to)
• binky.get_color()
-returns the color of the square binky is on: 'red' 'green' 'blue' or None if the square is not colored
-None is a special Python value for nothing

## If Statement

• If statement controls True/False if some lines run or not
• Three parts:
• ```if  <test>:
<lines>
```
• Many forms of test, but today we use only this:
• if binky.get_color() == 'red':
• == compares two values, (==, two equal signs)
• Compare does not use one equal sign (=)

If Demo If Demo

Solution code showing if/test/lines

```def if_demo(binky):
'Move forward until blocked, changing any blue squares to red'
while binky.front_clear():
if binky.get_color() == 'blue':
binky.paint('red')
binky.move()

```

## Def Revisit - Decomposition

• def recap - lines of code, a name, can "call" it (i.e. run)
• A great trick - decomposition
-problem has some repeated piece
-create def to solve that piece
-call your own def to solve that piece
-carve up the problem .. neat!

## 1. Blueish - Decomp First Exercise

Explain: a b at top, cases