Lesson+2

**LESSON 2** //**Sequential statements: __graphics__**// Turing provides two ways to specifically locate text around the output screen. These are:

In addition, Turing provides several predefined functions which make positioning text easier. These are:
 * **locatexy** || this is used to move the cursor so that the next output from a put statement will be at the point (x,y) where the point (0,0) is the bottom left corner of the screen. (Graphics mode only) ||
 * **locate** || this is used to move the cursor so that the next output from a put statement will begin at (row, column) where row 1 is at the top of the screen and column 1 is the left side of the screen. (Text mode only) ||


 * **maxcol** || in text mode this function is used to determine the maximum number of columns on the screen ||
 * **maxrow** || in text mode this function is used to determine the maximum number of rows on a screen ||
 * **maxx** || in graphics mode this function is used to determine the maximum value of x along the x axis ||
 * **maxy** || in graphics mode this function is used to determine the maximum value of y along the y axis ||

Turing also has a number of predefined graphics functions. These are

Turing also has statement which you can use to program sound
 * <span style="color: #000080; font-family: Arial,Helvetica,sans-serif; font-size: 16px; margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">**drawdot** (x,y,c) || * where x & y are coordinates on a 2 dimensional plane
 * X controls position left and right
 * Y controls position up and down
 * c is a number from 1 to 256 representing a colour ||
 * <span style="color: #000080; font-family: Arial,Helvetica,sans-serif; font-size: 16px; margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">**drawline** (x1,y1,x2,y2,c) ||^  ||
 * <span style="color: #000080; font-family: Arial,Helvetica,sans-serif; font-size: 16px; margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">**drawbox** (x1,y1,x2,y2,c) ||^  ||
 * <span style="color: #000080; font-family: Arial,Helvetica,sans-serif; font-size: 16px; margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">**drawoval** (x,y, xradius, yradius,c) ||^  ||
 * <span style="color: #000080; font-family: Arial,Helvetica,sans-serif; font-size: 16px; margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">**drawarc** (x,y, xradius, yradius,angleI, angleF,c) ||^  ||


 * <span style="color: #0036ff; font-size: 10pt; margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">**sound (**//frequency//,//duration//) || The sound command produces sound using the frequency and duration of the sound. ||
 * <span style="color: #0036ff; font-size: 10pt; margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">**play (**"cde" ) || The **play** procedure takes strings containing characters that specify notes, rests, sharps, flats and duration. The notes are the letters a to g (or A to G). A rest is p (for pause). A sharp is **+** and a flat is **-**. The durations are 1 (whole note), 2 (half note), 4 (quarter note), 8 (eight note) and 6 (sixteenth note). The character > raises to the next octave and < lowers. For example, this is the way to play C and then C sharp one octave above middle C with a rest between them, all in sixteenth notes: **play**(">6cpc+"). Blanks can be used for readability and are ignored by **play**. ||

<span style="font-family: Arial,Helvetica,sans-serif; margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">** Task: ** <span style="color: #000080; display: block; font-family: Arial,Helvetica,sans-serif; text-align: left;">1) Modify Lesson 1 using a graphical display of the result as the output <span style="color: #000080; font-family: Arial,Helvetica,sans-serif; margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">2) Create a complex picture and centre it both vertically and horizontally on the screen. Animate at least one part of the picture.

<span style="color: #0000ff; margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">3) Integrate sound into your complex picture. <span style="display: block; font-family: Arial,Helvetica,sans-serif; text-align: center;">**Remember to use procedures for each discrete part of your program. To complete Part**
 * 2 you will need to use a loop**