The first task was to create a shapes.py file that would be used to create all the shape functions that would later be imported and used in the proceeding tasks and py files. Each shape function was to code one shape that could be drawn in a 20X20 area and the position and orientation of the turtle was to be coded to be the same at the beginning and end of drawing all the shapes.
The next task was to create a linear.py file that would import the shapes.py file in order to draw the shapes along a line and 20 pixels apart. Within this file a processString() function was to be created to enable a string to be entered, and a line of shapes to be drawn. Each shape was given a character, and a drawShape() function with if statements was created in order for shapes to be drawn by only entering one character into the string. For example, the shape triangle was given the character "t" so if the character in the string was a "t" then the abelisle_triangle() function was executed. Also, within the drawShape() function a sorry message was created so that if the user entered an incorrect character into the string, then the computer prompted them that it did not understand the character they entered. This task produced sceneA.
This task was to create a grid.py file that was basically the same as linear.py except for some changes to the processString() function. This function was altered to include a for loop and if statements in order to shift the turtle horizontally and vertically to create a grid of shapes instead of just one straight line. The grid was to include ten shapes in a row and as many rows as needed to completely draw the string that is entered. This was sceneB.
The final task was to find a partner and to import their shapes into a new linear2.py file in order to use their shape functions to make another line of shapes. New else if statements were added to the drawShape() function and a new string was to be made in order to make the new line of shapes. This was sceneC.
My grid drawing algorithm is to get the turtle to draw only ten shapes in a row and to space the shapes by forty pixels. In order to do this I will use for loops and if statements and the mod function of division. I need to be able to move the turtle vertically and horizontally in order to make the rows and columns of shapes.
My grid drawing algorithm was to use a for loop and let "i" stand for some element in the range of the length of the string that was entered. I then used if statements in order to get the turtle to draw only ten shapes in a row. This was done by using the mod function, or the remainder function of division. Then turtle commands were used in order to get the turtle to start a new row of shapes. This was done if the remainder of i/10 was equal to nine. The else statement is included because if the remainder is not nine then the turtle is to just continue drawing shapes that are forty pixels apart.
This algorithm works because it tells the drawing to continue drawing shapes in a row until there are ten shapes in the row. Then it is to start another row. This is made possible to code because of the mod function of division. The algorithm also works because turtle commands can be used in order to move and place the turtle in order to begin a new row in the proper place.
The extensions that I included were extending the conditional to allow for more shapes of my own. There are more than three shapes used in both sceneA and sceneB. I also added colors to the shapes. My first three shapes' colors and my partner's colors were structured, but all the additional shapes had random colors. My final extension was to incorporate my partner's shapes into my grid scene in addition to my linear scene. For this I created a new grid2.py file and altered my drawShape() function in order to have characters in the string that will draw her shapes as well as mine. This grid2.py file created sceneD.