Graphics Exercise #2
The first four programs are simple, and similar to some degree. After writing the first program and saving it as gr_ex1.t, perform a Save As ... under the file menu, and save your file as gr_ex2. From here simply modify your existing program to make the new one. In parts 5 and 6 we depart from filling the screen with patterns to trying to draw pictures in turing.
1. Write a program that fills the screen from left to right with a single random colour. Save your file as gr_ex1.t.
2. Write a program that fills every 20th column of the screen from left to right with a single random colour. Save your file as gr_ex2.t.
3. Write a program that fills the screen from bottom to top with a single random colour. Save your file as gr_ex3.t.
4. Write a program that fills every 20th row of the screen from bottom to top with a single random colour. Save your file as gr_ex4.t.
5. Draw a yellow happy face, with oval black eyes. Save as gr_ex5.t. To draw the mouth properly, you should take advantage of the following function:
drawarc(x, y, xRadius, yRadius, initialAngle, finalAngle, colour)
6. Draw a picture of a house. Save as gr_ex6.t. You may need to use the following function:
drawfill(x,y,fillColour,outlineColour)
If you draw an enclosed figure and you want to fill it with colour, use drawfill. The (x,y) position must be inside the object to be filled. The fillColour is the number corresponding to the colour you want to fill the object. The outlineColour is the colour of the outline that you want to fill (must be all the same colour).