# LPS : introduction to Logo

• ### Topic 1

Mythbuster Jr Wisdom

You learn more from  failure than instant success. Failure is always an option.

You are more likely to succeed if you can work effectively in a group.

Don't let anyone tell you you are to young to tinker or code.

You are always allowed to try this at home.

## Meet the turtle

 Over half a centurt ago, a man named Seymour Papert started to teach kids how to think in a special way using floor robots. His kids thought it looked like a turtle. The computer language that controlled the turtle was called Logo. Seymour worked in America for Lego and was part of the team that invented Lego Technics and the RCX, NXT then Ev3 robots.

## Set up the environment

 Set up the stage size required. hide Scratch cat sprite from Looks => hide To use the PEN load the PEN MODULE

## How many degrees in a circle

 You can research this for yourself but suffice to say it is probably due to there are 12 new moons in each cycle of the earth around the sun. Ancient astronomers and philosophers like tho ones immortalised by Raphael in the Sistene chapel promoted the idea of 360 degrees in a circle.

## Meet the Scratch cat, simple commands

 Simple commands are just one line statements when clicked forward back left right hide scratch cat show scratch cat print clear screen setxy [0 0] Hide Scratch cat and you have a Logo program. assignment using the commands fd, lt, rt, determine how many steps from HOME to the sides, top and bottom of the screen. using the commands fd, bk, lt and rt, draw a square and an eqilateral triangle What is special about an equilateral triangle?

## Meet the turtle : complex commands

 There is a saying in computing, if you have to do something three times, you can write code to do it once. Complex commands are where you join several simple commands together repeat 4[fd 100 rt 90] Note this obeys the total trip rule assignment draw a square and put an equilateral triangle on top so it looks like a house experiment the the following commands setpensize setpencolor

## Making a plan (algorithms)

 The word algorithm comes from the name of the 9th century Persian and Muslim mathematician Abu Abdullah Muhammad ibn Musa Al-Khwarizmi (Latinized Algoritmi), he was mathematician, astronomer and geographer during the Abbasid Caliphate, a scholar in the House of Wisdom in Baghdad. He is often considered one of the fathers of algebra. Also the creator of the numbers which we use today. The word means "step wise" and means the number of step needed to solve a problem. In the broader sense, Algorithms are written every day to guide others into solving problems. eg car manuals, computer books, policy documents. All algorithms. In coding, a program that uses the least number of steps in a solution is considered to be "elegant". Challenge Open a Google doc Write down the steps you would use to draw a box you could step out  Use procedural writing (Heading, Aim etc) to record your results Ask another student to use your algorithm.

## Absolute vs relative commands

 Algorithm 1. Make a tiny sprite using one dot in the editor. Perhaps make it red. 2. Load the pen extension for drawing tools 3. Use pen up and pen down commands to draw something, so we know it works. 4. Use gotoxy command to find the boundaries of the screen (how high, low, how left, right) 5. Make a Block called Box 6. Copy code so you know which quadrant has which coordinates. 7. Record your experiment

• ### Topic 13

draw a boat

draw intials

## Total trip theorem

 Using a turtle as a sprite, Papert provides the following definition for the "Total Turtle Trip Theorem" in Papert's 1980 book Mindstorms: Children, computers, and powerful ideas. "If a Turtle takes a trip around the boundary of any area and ends up in the state in which it started, then the sum of all turns will be 360 degrees" (page 76)

## Meet the turtle : subprocedures

 Here is a procedure from the moreblocks menu. It approximates the old Home command. You will need it in the coming exercises assignment. write a program using your new home command and simple commands that divides the screen into the four cartesian quadrants (graph paper)

## Making patterns

 a square repeated

## Manipulating variables

 Pupils at school enter the Science Teachers (STAWA) solar challenge. They race solar cars down a track powered only by a solar panel. To maximize the solar energy, we can determine the angle of the sun in the sky . This is done using a shadow stick. Measure the length the stick and its shadow and use trigonometry (atan function) to determine the angle. A function is a peice of code that takes in one or more inputs and delivers one result. This function designed to take in two inputs, assign them to variable names manipulate them into a meaningful format then run a built in function to determine information. We can then use geometry to set the solar panel on a solar car to get the optimum sunlight.

## Inputing variables, making decisions

 Perhaps the most powerful statement in the world. If something is true then execute this, else do the other. We could improve the code by looping it forever, or looping it until a condition is met and that exits the loop.

## Lists

 In another world, a list is called an array. An array is a way of writing data to a file and reading it back again.  It sets up an ordered list of data with each piece of data in a fixed position. e.g.(dog, cat, mouse, rabbit, chicken, duck) They are numbered in computer speak 0 - 5. Hence the third item, mouse, is referenced as 2 Phantom's faithful companion - Guran of the Bandar poison pygmy people Importing data into a list First, find or type out a list of comments. Here is a list of Old Jungle Sayings (OJS) from the great hero, the Phantom, Ghost Who Walks. Next, copy and past OJS into a text editor and export as a text file. Call it OJS.txt Next in Scratch create a list in Data. Name it Phantom. Tick the box next to the list so the empty list appears. Right click on the empty list and import the text file.  Use the random generator to display comments. First, you are prompted for a name, stored as a variable. Then, there are two lists, one that is inserted before the name and one after.The elements from the list are randomly picked and an operator called "concatenation" joins all three together. This is quite widely used. Mailmerge in word processing, student data banks for report writing, letter drops during political campaigns. Challenge Make your own generator.

## Using Scratch to help learn

 The objective of this is to develop a way to help teach vocabulary and definitions. First, we need to investigate the commands we will use. Draw the line in any color, then use the color picker in the touching color block to sense what is underneath Scratch cat. Other hints. You can make a graphic in another program like Paint box. Save it to the documents area then load it into your stage. Challenge : You are tasked with the creation of a teaching aid that ties something you are studying to an interactive graphic. Download, draw, capture or create an image that relates to your studies in school. Use nested if commands to get Scratch cat tell the user what he is pointing to. A type example is provided. Ideas for the project Explain a process like the water cycle Describe the eight planets The name of ten common objects in a foreign language (Italian) Name the parts of a computer Describe the data cycle Countries of the world, capital cities, currencies major imports and exports The names of different angles, polygons or shapes Where to research Google Youtube Scratch.mit.edu

## Using Scratch and Makey-makey for a Science Experiment

 Background Make-makey works very simply by closing a circuit so current can flow around a circuit. This relies on a circuit being completed between the Makey-makey, something that conducts electricity and a the earth. Task Using this knowledge, you are tasked with designing and building a testing device that determines whether an object is a conductor or an insulator.This can then be used in P-3 classes in their studies of electricity. Materials Conductive tape Core flute board Makey-makey kit Computer Don't forget to document your code, project and how to use the system.