introduction to algorithms using netlogo. what’s an algorithm definitions of algorithm on the web:...

10
Introduction to Algorithms using Netlogo

Upload: jasmin-barber

Post on 02-Jan-2016

217 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Introduction to Algorithms using Netlogo. What’s an Algorithm Definitions of Algorithm on the Web: –A procedure or formula for solving a problem

Introduction to Algorithms using Netlogo

Page 2: Introduction to Algorithms using Netlogo. What’s an Algorithm Definitions of Algorithm on the Web: –A procedure or formula for solving a problem

What’s an Algorithm

• Definitions of Algorithm on the Web:– A procedure or formula for solving a problem.

www.cctvconsult.com/glossary.htm– A set of instructions or procedures for solving a

problem. www.davcomuk.co.uk/files/tech/glossary.htm

– An unambiguous formula or set of rules for solving a problem in a finite number of steps. Algorithms for encryption are usually called Ciphers. www.modssl.org/docs/2.3/ssl_glossary.html

– is a procedure or formula for solving problems www.stallion.com/html/support/glossary.html

Page 3: Introduction to Algorithms using Netlogo. What’s an Algorithm Definitions of Algorithm on the Web: –A procedure or formula for solving a problem

Drawing in Netlogo

Start Netlogo (under CSCI programs) and resize the display to make the turtle easier to see

Click here

Page 4: Introduction to Algorithms using Netlogo. What’s an Algorithm Definitions of Algorithm on the Web: –A procedure or formula for solving a problem

Use the command center to create a turtle

First define its shape

Next create one turtle

Page 5: Introduction to Algorithms using Netlogo. What’s an Algorithm Definitions of Algorithm on the Web: –A procedure or formula for solving a problem

Now give commands to the turtle

Set to T for turtle

Give the command pd for pen down

Page 6: Introduction to Algorithms using Netlogo. What’s an Algorithm Definitions of Algorithm on the Web: –A procedure or formula for solving a problem

Begin to draw a box using the commands fd

(forward) and lt (left turn)

Page 7: Introduction to Algorithms using Netlogo. What’s an Algorithm Definitions of Algorithm on the Web: –A procedure or formula for solving a problem

Make your algorithm into a procedure

Commands to create the turtlein a procedurecalled setup

Commands givento the turtle in a procedure calledgo

Page 8: Introduction to Algorithms using Netlogo. What’s an Algorithm Definitions of Algorithm on the Web: –A procedure or formula for solving a problem

Create 2 buttons to run your proceduresUse the button icon on the interface toolbar.

Runs the setup procedure

Page 9: Introduction to Algorithms using Netlogo. What’s an Algorithm Definitions of Algorithm on the Web: –A procedure or formula for solving a problem

Try out your new buttons

Page 10: Introduction to Algorithms using Netlogo. What’s an Algorithm Definitions of Algorithm on the Web: –A procedure or formula for solving a problem

Less typing?