25 lines
1 KiB
Markdown
25 lines
1 KiB
Markdown
---
|
|
custom_edit_url: https://github.com/rzmk/100-days-of-code/edit/main/projects/Day%2019/README.md
|
|
---
|
|
|
|
# Day 19 - Instances, State, and Higher Order Functions
|
|
|
|
- Built an etch-a-sketch while understanding higher order functions
|
|
- Simulated a turtle race with randomized steps using class instances
|
|
|
|
## Etch-a-Sketch
|
|
|
|

|
|
|
|
This etch-a-sketch uses higher order functions to run when keys are pressed on the keyboard.
|
|
- **w** - Move forwards
|
|
- **s** - Move backwards
|
|
- **a** - Turn left
|
|
- **d** - Turn right
|
|
- **c** - Reset etch-a-sketch
|
|
|
|
## The Great Turtle Race
|
|
|
|

|
|
|
|
The Great Turtle Race uses multiple instances of the Turtle object from [the turtle module](https://docs.python.org/3/library/turtle.html) that move by a random number of steps to the edge of the screen.
|