1 Building Your Own Turtle Functions For making really cool pictures!

Slides:



Advertisements
Similar presentations
Create a Simple Game in Scratch
Advertisements

SuperStar Basics Brian Bruderer. Sequence Editors Traditional sequence editors use a large grid to control when channels are turned on and off. This approach.
PYTHON TURTLE WORLD : CHAPTER 4 FROM THINK PYTHON HOW TO THINK LIKE A COMPUTER SCIENTIST.
Cosc 1P02 Week 2 Lecture slides
Computer Science 1000 LOGO I. LOGO a computer programming language, typically used for education an old language (1967) the basics are simple: move a.
Using Logo and Logic Please use speaker notes for additional information!
Week 9: Methods 1.  We have written lots of code so far  It has all been inside of the main() method  What about a big program?  The main() method.
Movement. Fixed Movement setLocation (x, y) Makes the crab move to a fixed cell x,y Relative Movement The functions: getX() getY() Fetch the x and y coordinate.
CS 280 Data Structures Professor John Peterson. Quiz 4 Recap Consider the following array: {2, 6, 7, 3, 4, 1, 5, 9}. Draw this in tree form and then show.
Lecture 7. Review Homework 1 (sample solution) Project 1 will be assigned next week –Draw a picture (whatever you want) in the world by using turtles.
Introduction to TouchDevelop
Introduction to Shape Programming When we make geometric shapes with computers, we have to give specific numbers to tell the computer exactly what to do.
B.A. (Mahayana Studies) Introduction to Computer Science November March Logo (Part 1) An introduction to Logo: drawing, moving,
Adding Websites to a Folder  Putting sites into an already existing folder Putting sites into an already existing folder  Adding an image on the icon.
CSC Intro. to Computing Lecture 16: Robotran.
AP Computer Science Principles Data Abstraction and Procedural Abstraction Curriculum Module.
LOGO SOFTWARE BY: SAVE 9S. INTRODUCTION Logo is a software that can be found at : Shared area> High School > ICT > take home software > LOGO32. This is.
Programming Training kiddo Main Points: - Python Statements - Problems with selections.
Fall Week 3 CSCI-141 Scott C. Johnson.  Say we want to draw the following figure ◦ How would we go about doing this?
COSC 1P02 Introduction to Computer Science 3.1 Cosc 1P02 Week 3 Lecture slides Birthdays are good for you. Statistics show that the people who have the.
Microsoft® Small Basic
1 Loops and Branches Ch 21 and Ch18 And how you can use them to draw cool pictures!
1 CSC 221: Computer Programming I Fall 2011 Fun with turtle graphics  turtle module  relative motion (setup, reset, left, right, forward, backward) 
Art 321 Lecture 7 Dr. J. Parker. Programming In order to ‘make things happen’ on a computer, you really have to program it. Programming is not hard and.
Class 2 Introduction to turtle graphics
Turtle see, turtle do Lesson 1 – Welcome to LOGO.
1 Turtle Graphics and Math Functions And how you can use them to draw cool pictures!
Copyright © Curt Hill Turtles The beginning of media computation.
Introduction to TouchDevelop
MSW Logo By Awin 9s.
An introduction to Logo Mike Warriner Engineering Director, Google Note: This course is not an endorsement of Logo by Google. All views in this document.
Programmming Class Fall 2011 Sobhan Highschool Teacher: M.Taghizadeh.
2015 CSE/EGR Summer Camps 1 Computer Science Concepts 1. What is an algorithm? 2. Binary information coding 3. Programming concepts via Scratch Designed.
1 Building Your Own Turtle Functions For making really cool pictures!
Make a blank window This is a starter activity and should take 5 minutes [ slide 1 ] 1.Log in to your computer 2.Open IDLE 3.In script mode create a file.
Algorithms Writing instructions in the order they should execute.
Create a Halloween Computer Game in Scratch Stephanie Smullen and Dawn Ellis Barb Ericson October 2008.
Computer Programming Modeling a Passive Solar Home.
1 Project designed and created by M. Shajith Kumar.
Getting started with the turtle Find the latest version of this document at
CISW CRC - Fishman 2014 / 2015 PRESENTATION 4b: CISW 400 (Online) – Client-side Scripting for the Internet Cosumnes River College Fishman – 2015.
First of all – lets look at the window’s you are going to use. At the top you have a toolbar, with all your various tools you can use when customising.
Turtle Graphics Let’s see what we can draw on Python!
Turtle Graphics Lesson 2 1. There are 3 homeworks to complete during the six lessons of this unit. Your teacher will let you know when a homework has.
Functions. functions: a collection of lines of code with a name that one can call. Functions can have inputs and outputs.
Today… The for loop. Introducing the Turtle! Loops and Drawing. Winter 2016CISC101 - Prof. McLeod1.
IMDB Template File Save as: IMDB_period_Lastname Partner #1 name Partner #2 name.
Introducing the turtle
Hackety Hack! Written by Krystal Salerno Presented by _______________.
© it’sLearning 365 Limited | Screen 1 FLASH enabled How to use me : Teachers Notes Useful Web Link Ne xt Pa ge Ne xt Pa ge Navigate.
Using Logo to explore spiral patterns. Paul Broadbent Spiral patterns This is a (1,2,3) spiral path. It repeats lines of three.
Create a Halloween Computer Game in Scratch
Computer Programming.
Introduction to Python
Scratch for Interactivity
Intro CS – Loops & Creating Shapes
Starter Activity Instructions: Complete the starter sheet Planner
A Tiny Look at the Graphics Window
Learning Java with Alice 3.0 Game Design Kathy Bierscheid
Frozen Graphics Lesson 3.
Microsoft® Small Basic
Intro to Programming With Snap PII.
How is the Mandala an important part of Ancient India History?
Creating Functions with Parameters
Chap. 3 Functions Start Python IDLE (Shell) and open a new file.
Explain what touch develop is to your students:
Using Logo and Logic This presentation uses a version of Logo called StarLogo available through MIT. It can be downloaded for free and installed on your.
A Tiny Look at the Graphics Window
The beginning of media computation Followed by a demo
Presentation transcript:

1 Building Your Own Turtle Functions For making really cool pictures!

2 5 Cool Things… 1.Variables and Arithmetic 2.Branches for variety 3.Using Functions 4.Building your own Functions (Today) 5.Loops to repeat (Next week)

3 Review: 1) Variables and Arithmetic var n = 4; var y = 2; var x = n + y; y = n * 2; document.write(“x=” + x + “, y=” + y);

4 2) Using Functions Math Functions: x = Math.sqrt(81); y = Math.sqrt(x); document.write(“x=” + x + “, y=” + y); Turtle Functions: forward(20); left(90); forward(20); right(135); backward(40); Identify the Function calls and the arguments

5 Which command(s) uses “relative” positioning, and which “absolute” forward -- move turtle forward some number of pixels left – turn left some number of degrees moveTo -- move to an x,y coordinate turnTo – turn to a particular degree heading home – send turtle back to center of screen, facing up

6 Today—3) Building your own functions Lets you “abstract” a collection of moves For example, these lines make a square: forward(20); right(90);

7 If you want to draw a lot of squares, put this at the top of your script… function square( ) { forward(40); right(90); } This is a Function Definition

8 Now you can ‘call’ your square function square(); left(30); square(); left(180); square(); moveTo(-300, -100); left(30); square(); left(180); square();

9 Functions help manage complexity You can do interesting patterns without a lot of repetition of code They save time and effort Functions can use other functions

10 What if you want different sizes of squares? function square( n ) { forward(n); right(90); } n is called a parameter It’s a variable that receives the size of the square (given as the argument in the function call)

11 Now when you call the square function, just say how big you want it to be square(100); square(50); square(25);

12 You can generate random sized squares… var size, angle; size=rand(50,100); square(size); angle=rand(0,180); turnTo(angle); size=rand(50,100); square(size); rand(low, high) gives random number between low and high

13 Every time you run the code from last slide, it gives a different result It’s interesting to observe the variations and similarities

14 Capture your images in a “screen shot” Press Alt and PrtScr at same time Open Paint Edit/Paste You can chop out image using select tool Dotted line box Then paste into Microsoft Word Or save as a.jpg file (project 2)

15 That’s it! Have fun in lab Next week…branches and loops