C# Programming Challenge 8.21: Turtle Graphics Part 1/9 (Intro, Demonstrating finished app)


C# How To Program
C# Programming Challenge 8.21: Turtle Graphics Part 1/9 (Intro, creating C# classes, Demonstrating Finished App)

Intro to the project. Demonstrating what we’ll be creating. Creating our C# classes.

The Logo language made the concept of turtle graphics famous. Imagine a mechanical turtle that walks around the room under the control of a C# app. The turtle holds a pen in one of two positions—up or down. While the pen is down, the turtle traces out shapes as it moves, and while the pen is up, the turtle moves about freely with out writing any thing. In this problem, you’ll simulate the operation of the turtle and create a computerized sketchpad. Use a 20-by-20 rectangular array floor that’s initialized to 0. Read commands from an array that contains them. Keep track at all times of the current position of the turtle and whether the pen is currently up or down. Assume that the turtle always starts at position (0, 0) of the floor with its pen up.
The set of turtle commands your app must process are shown below. Suppose that the turtle is somewhere near the center of the floor. The following “app” would draw and display a 12-by-12 square, leaving the pen in the up position: 2 5,12 3 5,12 3 5,12 3 5,12 1 6 9 As the turtle moves with the pen down, set the appropriate elements of array floor to 1s.
When the 6 command (display the array) is given, wherever there’s a 1 in the array, display an asterisk or any character you choose.
Wherever there’s a 0, display a blank. Write an app to implement the turtle graphics capabilities discussed here. Write several turtle graphics apps to draw interesting shapes. Add other commands to increase the power of your turtle graphics language.

Learning to code? Follow my C# tutorials for beginners. I do a lot of C# programming challenges and C# projects as part of my homework – every day!
If you are learning to program, nothing beats solving real programming exercises and coding challenges.
So don’t forget to subscribe, as I release several programming videos every week!



Part 1:
Part 2:
Part 3:
Part 4:
Part 5:
Part 6:
Part 7:
Part 8:
Part 9:



  1. Nice example for console-based turtle graphics. You might check also my GUI-based C# tutrle graphics library here: https://github.com/nakov/TurtleGraphics.NET


Please enter your comment!
Please enter your name here