Computer Programming I

Bart by Lorenzo

A computer program is a series of instructions. The program tells the computer how to do something. For example, a computer can be taught how to draw Bart Simpson. This portrait, programmed by Lorenzo R., is composed entirely of line segments and arcs of circles. If Lorenzo tried to tell the computer "draw Bart's nose", the computer wouldn't understand. It's never heard of Bart Simpson before. However, the computer has been taught what a line is and what a circle is. Here is one line of the code that draws part of Bart's nose:

CIRCLE (113, 160), 19, 8, 1.57, 4.87

This code is written in the programming language known as QuickBASIC. When he wrote that code, Lorenzo had to choose appropriate numbers to get the nose to be the right size, color, and position.

One of the things that you do in Computer Programming I is to learn how to control what the computer does by choosing the right numerical values and using them in the proper order. The computer isn't very flexible. It expects things to be done in a certain way. If you don't follow that format, it gets confused and your program doesn't do what you want it to do.

Megaman by Yi(21K)

Here you see a portrait of Megaman by Yi D. In his program, Yi used line segments and circle arcs, as well as sections of ellipses in order to construct his drawing. You can see that he included a lot of detail. It took him about 150 lines of code in order to accomplish that. Here is one of the lines of code that he wrote:

PAINT (-53, -76), 4, 0

This code fills in the red color on Megaman's boot. Can you guess why Yi needed to use negative numbers as part of his code statement for the boot?

JasonFox by Gihan(21K)

Gihan A. took on a challenge when he decided to write a program to draw Jason Fox (from Fox Trot). Jason's hair has a lot of curves and lines, and Gihan wanted the different sections to match up nicely at the point of transition. It was difficult to do this by trial and error. To do it well, he needed to learn trigonometry. Here is some of Gihan's code:

CIRCLE (100, 120), 40, 14, 2.5, 5
yh = SIN(.64) * 40
xh = COS(.64) * 40
LINE (100 - xh, yh + 120)-(50, 160), 14

Those lines of code create this section of Jason's outline:

JasonDetail (2K)

If you know trig, see if you can figure out why Gihan choose to use .64 radians as the argument to his trig functions. (Hint: look above at the circle statement. Two of those numbers are also measured in radians.)