CSC151 2007S, Class 06: Turtle Graphics Admin: * Once again, I will miss office hours today. * I should be in my office from 2:15-3:45 * Reading for Friday: Drawings as Values. * Reminders: * Quiz Friday morning (Scheme and GIMP basics) * Next HW to be assigned Friday, due following Wednesday. * Slight bug introduced into DrFu. Sorry. Should go away soon. Overview: * Modeling images through process: Turtle graphics. * Some historical notes. * Turtle graphics in DrFu. * Lab! ==Context and More== * How you describe images * Simplified instructions for moving a pen * Direction * Distance * Can be used for both drawing and for moving to another place to draw. * "So simple, even a turtle could do it" * These four operations are traditinoally called "turtle graphics" * Why we have turtle instructions in the first place: MIT * Papert (disciple of Piaget) focusing on "constructivism" * Papert built a language (LOGO) that, among other things, let you control a robotic turtle * Idea: If you don't have the turtle, simulate it on the screen * And show where's it been * Eventually: Drawing became its own goal == Key Turtle Operations in Scheme == * (turtle-new IMAGE) * (turtle-forward! TURTLE amt) * (turtle-turn! TURTLE amt) * (turtle-up! TURTLE) * (turtle-down! TURTLE)$a * (turtle-teleport! TURTLE col row) * (turtle-face! TURTLE direction) == Lab == ===Getting Started=== (define world (image-new 300 200)) (define max (turtle-new world)) ===Useful commands=== (turtle-set-brush! TURTLE BRUSH) (turtle-set-color! TURTLE COLOR) ===Some notes (for next class)=== * Why did you have trouble finding out where turtles start? * It's dangerous to build new turtles and images in the definitions window. * EXAMPLE * Why did the three triangles get drawn?