Report

Programming Class Logo Programming Fall 2011 – Session 4 Teacher: M. Taghizadeh Sobhan Highschool Logo Programming Procedure In the first lesson, we taught the turtle how to draw a square. We ended up with a procedure that looks like this: TO SQUARE REPEAT 4 [ FD 100 RT 90 ] END Teacher: M. Taghizadeh – Sobhan Highschool Logo Programming Procedure Drawing Squares of Any Size TO SQUARE REPEAT 4 [ FD 100 RT 90 ] END 100 ? Teacher: M. Taghizadeh – Sobhan Highschool Logo Programming Procedure Drawing Squares of Any Size FD 100 RT 135 BK 32 LT 75 ... 100 135 32 75 PARAMETER Teacher: M. Taghizadeh – Sobhan Highschool Logo Programming Procedure Drawing Squares of Any Size SQUARE 100 SQUARE 75 SQUARE 250 Teacher: M. Taghizadeh – Sobhan Highschool Logo Programming Procedure Drawing Squares of Any Size TO SQUARE :LENGTH REPEAT 4 [ FD :LENGTH RT 90 ] END Teacher: M. Taghizadeh – Sobhan Highschool Logo Programming Procedure Drawing Squares of Any Size PARAMETER TO SQUARE :LENGTH REPEAT 4 [ FD :LENGTH RT 90 ] END Teacher: M. Taghizadeh – Sobhan Highschool Logo Programming Procedure Drawing Squares of Any Size SQUARE 100 SQUARE 75 SQUARE 250 Teacher: M. Taghizadeh – Sobhan Highschool Logo Programming Procedure Drawing Squares of Any Size TO FUNCTION_NAME :PARAMETER ... ... (:PARAMETER) ... END Teacher: M. Taghizadeh – Sobhan Highschool Logo Programming Procedure Drawing Squares of Any Size REPEAT 10 [ SQUARE REPCOUNT * 10 ] Teacher: M. Taghizadeh – Sobhan Highschool Logo Programming Procedure Drawing Squares of Any Size REPEAT 10 [ SQUARE REPCOUNT * 10 ] PARAMETER Teacher: M. Taghizadeh – Sobhan Highschool Logo Programming Procedure Drawing Squares of Any Size REPEAT 10 [ SQUARE REPCOUNT * 10 ] SQUARE 1 * 10 = SQUARE 10 SQUARE 2 * 10 = SQUARE 20 SQUARE 3 * 10 = SQUARE 30 SQUARE 4 * 10 = SQUARE 40 SQUARE 5 * 10 = SQUARE 50 SQUARE 6 * 10 = SQUARE 60 SQUARE 7 * 10 = SQUARE 70 SQUARE 8 * 10 = SQUARE 80 SQUARE 9 * 10 = SQUARE 90 SQUARE 10 * 10 = SQUARE 100 Teacher: M. Taghizadeh – Sobhan Highschool Logo Programming Procedure Drawing Triangles of Any Size Teacher: M. Taghizadeh – Sobhan Highschool Logo Programming Procedure Drawing Triangles of Any Size TO TRI :LENGTH REPEAT 3[FD :LENGTH RT 120] END REPEAT 7 [ TRI REPCOUNT * 20 ] Teacher: M. Taghizadeh – Sobhan Highschool Logo Programming Procedure Drawing Polygon N-EDGE: REPEAT N [FD 100 RT 360/N ] 3 120 4 90 5 72 6 60 8 45 Teacher: M. Taghizadeh – Sobhan Highschool Logo Programming Procedure Drawing Polygon TO POLYGON :SIDE REPEAT :SIDE [ FD 100 RT 360/:SIDE ] END Teacher: M. Taghizadeh – Sobhan Highschool Logo Programming Procedure Drawing Polygon POLYGON 4 100 POLYGON 5 100 POLYGON 6 POLYGON 8 100 100 Teacher: M. Taghizadeh – Sobhan Highschool Logo Programming Procedure Drawing Polygon TO POLYGON :SIDE :LENGTH REPEAT :SIDE [ FD :LENGTH RT 360/:SIDE ] END Teacher: M. Taghizadeh – Sobhan Highschool Logo Programming Procedure Drawing Polygon MULTIPLE PARAMETER TO POLYGON :SIDE :LENGTH REPEAT :SIDE [ FD :LENGTH RT 360/:SIDE ] END Teacher: M. Taghizadeh – Sobhan Highschool Logo Programming Procedure Drawing Polygon POLYGON 4 100 POLYGON 5 20 POLYGON 6 75 POLYGON 8 120 20 100 75 120 Teacher: M. Taghizadeh – Sobhan Highschool Logo Programming Procedure Drawing Polygon Flower Number: 60 Polygon: 6-edge Repeat 60 [ Polygon 6 100 RT 60] Teacher: M. Taghizadeh – Sobhan Highschool Logo Programming Procedure Drawing Polygon Flower Number: 10 Polygon: 8-edge Repeat 10 [ Polygon 8 100 RT 36] Teacher: M. Taghizadeh – Sobhan Highschool Logo Programming Procedure Drawing Polygon Flower Number: 30 Polygon: 5-edge Repeat 30 [ Polygon 5 100 RT 12] Teacher: M. Taghizadeh – Sobhan Highschool Logo Programming Procedure Drawing Polygon Flower Number: 18 Polygon: 60-edge Repeat 18 [ Polygon 60 25 RT 20] Teacher: M. Taghizadeh – Sobhan Highschool Logo Programming Procedure Drawing Polygon Flower FLOWER: REPEAT N [ POLYGON ..... RT 360/N] Teacher: M. Taghizadeh – Sobhan Highschool Logo Programming Procedure Drawing Polygon Flower TO POLYGON :SIDE :LENGTH REPEAT :SIDE [ FD :LENGTH RT 360/:SIDE ] END TO POLYGONFLOWER :NUMBER :SIDE :LENGTH REPEAT :NUMBER [POLYGON :SIDE :LENGTH RT 360/:NUMBER] END Teacher: M. Taghizadeh – Sobhan Highschool Logo Programming Procedure Drawing Polygon Flower PolygonFlower 18 6 100 PolygonFlower 30 5 100 PolygonFlower 10 8 100 PolygonFlower 18 60 25 Teacher: M. Taghizadeh – Sobhan Highschool Logo Programming Procedure Saving Drawings Bitmap Save As Teacher: M. Taghizadeh – Sobhan Highschool Logo Programming Procedure Change Pen Color, Pen Size, Color Screen Set Pen Size Pen Color Screen Color Teacher: M. Taghizadeh – Sobhan Highschool The End Logo Programming Fall 2011 – Session 4 Teacher: M. Taghizadeh Sobhan Highschool