Sam's Class Turtle Hack Exercise

by Samuel Robinson

14 Jun 2017

For this assignment, I figured it would be easiest to go back and change some of the turtles in my clicky turtle “Turtle Raceway” game sketch. I added a class extension on Turtle called RacerTurtle, and used that to add a few extra things to these turtles’ initializations. That way, I could just tell all of them once to bring their pen up, hide, go to their starting line, and so on. I left the original code in, but commented it out, so you can see how much space was saved by just adding one subclass for four of my turtles. I imagine that, with more time, I could use classes (and lists and dictionaries) to go back and make this code much slimmer and more efficient.

Sam Robinson is a second-year MSLS student at UNC Chapel Hill's School of Information and Library Science. Find Samuel Robinson on Twitter, Github, and on the web.