Day 6 - A Hacker Is Born
|MicroWorlds Version 2.0 for Windows 95|
OK, let's do a little programming. I think there are 2 ways you can change the color and size
of the pen that the turtle uses to draw with. Here is what the help says, which is the easy way.|
Nice and colorful for a Help Screen, isn't it. I told you the Help was good. It looks great when printed out too.
So, for the turtle on the right, I followed the instructions in 'Help' and then typed in the code you see at the bottom. I also 'hatched' another turtle and ran the same code by simply putting the cursor at the end of the line and pressing Enter. You can see the results.
Now I would like to see if I can achieve the same thing in code, meaning without using the drawing
center to select the pen color and size.|
I want to clear the screen so I take a long shot and type 'clear' in the Command Center (the code part at the bottom). I get a message "I don't know how to clear". So, I try clearscreen and get the message "I don't know how to clearscreen". So, I go to the online Help and try Find Clear and come up with 2 possibilities 'cg' which stands for Clear Graphics and Clean. So I type Clean and press enter. This cleans away the lines and leaves the turtles where they were. Then I try cg. This repositions the last turtle clicked on in the middle or 'home' position.
Now to try my little challenge of programming the pen color and size. While looking up Clean, I learned that 'cc' will clean the command center, i.e. erase the existing code, so I cc it. Below is a copy of what I then tried.
That setc looks like a strong possibility so I go to the Help screen which has a section called 'Vocabulary' I search on 'setc' and this is what I find:
Now armed with this new info, I click on the black turtle so it knows the following command is for him and I type setc "red and Bingo, it turns red! Rather than waste time 'hacking' on pensize, I will look it up in the vocabularly too. Here it is:
So now I think I am ready to program the Turtle in code rather than point and click.
Here it is
|We did it! We programmed the turtle! Okay folks, that seems like a great place to quit for today!|