Week 11 DO NOW QUESTIONS. An ask turtles block is a set of instructions that is issued to every turtle. Even though computers can do things very quickly,

Slides:



Advertisements
Similar presentations
NETLOGO LISTS Or… James says, fput THIS!. What are LISTS? Shopping list Address list DNA sequences Any collection of similar or dissimilar things Often.
Advertisements

Noadswood Science,  To understand the flow procedure when writing programs Thursday, January 15, 2015.
New Mexico User Test Starlogo TNG September 16, 2006 Starlogo TNG September 16, 2006.
CS 206 Introduction to Computer Science II 01 / 20 / 2009 Instructor: Michael Eckmann.
COMPUTER PROGRAMMING I Essential Standard 5.02 Understand Breakpoint, Watch Window, and Try And Catch to Find Errors.
Day 1 Goal: To create a model of people hunting in the forest for mushrooms and then start working on improving their mushroom hunting ability mathematically.
Describing Probability
Week 13 DO NOW QUESTIONS. Suppose you had a working model of small fish feeding and living in the ocean. How could you change the code below to make the.
Super Logo. Key Instructions Pendown penup Forward 50 ( this number can change) Right 90 ( this number can change as well) Now try and draw a Early finishers,
Lists Introduction to Computing Science and Programming I.
CS 206 Introduction to Computer Science II 09 / 09 / 2009 Instructor: Michael Eckmann.
CS 240: Data Structures Thursday, June 21 th Vector, Linked List.
Logo Lesson 3 TBE 540 Fall 2004 Farah Fisher. Prerequisites for Lesson 3 Before beginning this lesson, the student must be able to… Use simple Logo commands.
Introduction to TouchDevelop
Department of Computer Science What is NetLogo UH-DMML  Multi-agent programmable modeling environment  Well suited for modeling complex systems evolving.
Adding Controls to User Forms. Adding Controls A user form isn’t much use without some controls We’re going to add controls and write code for them Note.
Introduction to programming in MATLAB MATLAB can be thought of as an super-powerful graphing calculator Remember the TI-83 from calculus? With many more.
What is RobotC?!?! Team 2425 Hydra. Overview What is RobotC What is RobotC used for What you need to program a robot How a robot program works Framework.
Scratch the Cat. Object Oriented Programing Writing computer programs Based on Objects Instead of Actions Based on Data Instead of Logic.
Week 4-5 Java Programming. Loops What is a loop? Loop is code that repeats itself a certain number of times There are two types of loops: For loop Used.
Noadswood Science,  To know the basics of Python coding and decoding Monday, September 07, 2015.
Programming with Alice Computing Institute for K-12 Teachers Summer 2011 Workshop.
AP Computer Science Principles Data Abstraction and Procedural Abstraction Curriculum Module.
Introduction to Arrays. definitions and things to consider… This presentation is designed to give a simple demonstration of array and object visualizations.
B.A. (Mahayana Studies) Introduction to Computer Science November March Logo (Part 2) More complex procedures using parameters,
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.
Introduction to TouchDevelop
Week 9 DO NOW QUESTIONS. Question: If the following procedure is executed after 1 turtle is created in the program, what shape is created on the NetLogo.
Logo For beginners By Dali Matthews 9S What is logo?
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.
Collecting Things Together - Lists 1. We’ve seen that Python can store things in memory and retrieve, using names. Sometime we want to store a bunch of.
2015 CSE/EGR Summer Camps 1 Computer Science Concepts 1. What is an algorithm? 2. Binary information coding 3. Programming concepts via Scratch Designed.
Agent-Based Modeling and Simulation (ABMS) Bertan Badur Department of Management Information Systems Boğaziçi University.
New Mexico Computer Science For All Command Procedures in NetLogo Maureen Psaila-Dombrowski.
Week 2 DO NOW QUESTIONS. In this procedure the programmer intended to clear all the turtles and patches and make a new turtle of size 3 with the pen down,
Week 10 DO NOW QUESTIONS. A programmer has created 100 turtles of random colors and randomly distributes green patches. Every time the turtles land on.
Making Python Pretty!. How to Use This Presentation… Download a copy of this presentation to your ‘Computing’ folder. Follow the code examples, and put.
Visual Basic Games: Week 4 Recap Parallel structures Initialization Prepare for Memory Scoring Shuffling Homework: when ready, move on to next game/chapter.
Algorithms Writing instructions in the order they should execute.
Lecture 26: Reusable Methods: Enviable Sloth. Creating Function M-files User defined functions are stored as M- files To use them, they must be in the.
 In computer programming, a loop is a sequence of instruction s that is continually repeated until a certain condition is reached.  PHP Loops :  In.
Week 4 DO NOW QUESTIONS. Question: Predict a turtle’s heading after this procedure is run once. to go ask turtles [ forward 1 set heading random 45 right.
Getting started with the turtle Find the latest version of this document at
PROGRAMMING IN PYTHON LETS LEARN SOME CODE TOGETHER!
Week 13 DO NOW QUESTIONS. to FishWiggle right random 45 left random 45 forward 1 set Fenergy Fenergy end Suppose you had a working model of small.
Week 3 DO NOW QUESTIONS. In this setup procedure the programmer intended to create one turtle of each color: red, green, and blue. What went wrong? to.
Lesson Objective: Understand how to make and use Algorithms Learning Outcome: Design your own algorithms and flowcharts. Algorithms and Flowcharts.
Chapter 7 Continued Arrays & Strings. Arrays of Structures Arrays can contain structures as well as simple data types. Let’s look at an example of this,
Functions. functions: a collection of lines of code with a name that one can call. Functions can have inputs and outputs.
Chance We will base on the frequency theory to study chances (or probability).
COMPUTER PROGRAMMING Year 9 – lesson 1. Objective and Outcome Teaching Objective We are going to look at how to construct a computer program. We will.
Computer Science Up Down Controls, Decisions and Random Numbers.
Part 1 Learning Objectives To understand that variables are a temporary named location to store data and that programmers work with different data types.
M10 WS11:Krankenhausbedarfsplanung More, More and Even-More More given by Gabriel Wurzer and Wolfgang E. Lorenz
Department of Computer Engineering
Week 3 DO NOW QUESTIONS.
Matlab Training Session 4: Control, Flow and Functions
Procedural Abstraction Object-Oriented Code
Introduction to Object-Oriented Programming
Algorithms and Flow Charts
Graph Paper Programming
Learning to Program in Python
Conditions and Ifs BIS1523 – Lecture 8.
Graph Paper Programming
Introduction to TouchDevelop
CISC101 Reminders All assignments are now posted.
Warm Up Evaluate |5 – 16| –23 –8 4. |3 – 7| 4
Introduction to Computer Science
creating a ecosystems model in net logo
Hardware is… Software is…
Presentation transcript:

Week 11 DO NOW QUESTIONS

An ask turtles block is a set of instructions that is issued to every turtle. Even though computers can do things very quickly, some problems are still too big to handle. It is important to be able to have a rough idea of how many operations your code is going to execute when a block runs. Look at the two ask turtle blocks below and determine which one does more “work”. Both block call the procedure “wiggle”. Both procedures are only called once (no forever buttons). to wiggle right random 15 left random 16 forward 1 end A. to test-A Create-turtles 100 Ask turtles [ setxy random 16 random 16 Pen-down wiggle set pcolor green pen-up ] end B. to test-B Create-turtles 50 [ ask turtles [ setxy random 16 random 16 set shape “ant” set color red ask n-of 10 other turtles [wiggle] ] end a)Block A runs more operations because there are more turtles. b)Block A does more “work” because it moves the pen up and down. c)Block B executes many more wiggle operations than Block A. It would probably take longer to run. d)Block B does more work because it sets a shape. Graphics use lots of memory.

Assignment to a variable You are trying to understand a NetLogo program written by another programmer. You come across the following line of code Set x = 3 What does it do? a)Sets x equal to the value 3 b)It causes an error. The programmer probably meant: set x 3. c) Creates a variable x and tests if it is equal to three d) Creates an agentset with 3 members. e) Both a and c

Search Efficiency A magician shows you a deck of 52 cards arranged in numerical order by suit. He picks a card and writes it down on a paper. You get 6 yes and no questions to find the card. Do your think that you can identify the card that the magician picked? a)Sure, just use a binary search. Start with “Is it in the top 26 cards?” b)Yes, first narrow it down to which suite (Hearts, Clubs, Diamonds, Spades). c)No, you may get lucky but it is possible that it would take more guesses. d)Magicians do not play fair, you will not identify the card. e)A and D

Evaluation of procedures You have code that creates a list, L and then runs several commands at once on that list. Make sure that you start with the innermost command and work your way out. The code shows the results in the command center window with the “show” command. let L [ “a” “b” “c” “d”] show fput “a” reverse reverse butfirst L a)The butfirst command removes the “a” from [ “a” “b” “c” “d”] b)The 2 nd Reverse requires one list as input, in this case it gets [“b” “c” “d”]. c)fput adds an “a” on the result of Reverse Reverse butfirst L d)All of the above are true.

Order of Execution The show or type commands are very useful debugging tools. They allow the programmer to peek at the values the of variables or attributes. If we use a couple of type commands as below what will be the output? to test create-turtles 50 ;a random agentset of 3 turtles ask n-of 3 turtles set color red repeat 2 [type " Ha "] type xcor die ] end a)Ha Ha 0 Ha Ha 0 Ha Ha 0 b)Fifty 0’s and 50 Ha Ha’s c)Ha Ha xcor d)Nothing will be printed because the turtles all die.

Getting ready for Recursion-- Here is a simple reporter that adds two numbers. It has two input parameters so you need to pass it two arguments when you call it. It returns a single number. Remember, when you write a reporter, you put the parameter(s) in square brackets. When you call or use it, you just pass an argument of the right type (string, number value, or list.) to-report adds-two-numbers [p q] report p + q end Now, lets call this reporter like this: show adds-two-numbers adds-two-numbers 1 2 adds-two-numbers 4 5 What does this code do? a)It won’t work because adds-two-numbers needs two arguments. b)It gives an error because you forgot the square brackets. c)The 1 and the 4 get added and the 2 and the 5 get added. d)The first adds-two-numbers gets its input only after the other adds-two- numbers reporters run. This code sums the four numbers.