Your Mission: Move Turtles
You used Python’s Turtle package in Chapter 1 (here), and you’ll use it again now. You’ll start by drawing a paper bag. All of the paper bags thus far have been rectangular. But now, you’ll get to experiment with other shapes too.
You’re going to put the turtle on the edge of the bag and let him walk. When he hill climbs or descends, he’ll consider a step left or right. He chooses whichever goes down from his current position, picking the best spot. When he can’t go down anymore, he’ll stop.
This is another greedy algorithm. You already know greedy algorithms can get stuck or miss optimal solutions. You considered thishere when picking the best feature to partition data in a decision tree. You’ll see how easily ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access