Algorithm The key is the step-by-step instructions.

Slides:



Advertisements
Similar presentations
Karel – Making More Complex Decisions IF / THEN / ELSE IF THEN BEGIN Instructions END ELSE BEGIN Instructions END Do these when test = False Do these when.
Advertisements

1 Note: Original slides provided by and modified for this specific classwww.apComputerScience.com.
Copyright, Joseph Bergin
Nested If Statements While Loops
CMPUT 101 Lab # 2 September 17, :00 – 16:50.
Why Program? CSE111 – Great ideas in Computer Science Clearly programming fits here Programming is a Great Idea in Computer Science. It has allowed computers.
Karel The Robot Nested If Statements While Loops Copyright © 2008 by Helene G. Kershner.
Karel the Robot -- ITERATE Problem Statement: Karel is told to “take a walk around the block!” Revise Algorithm: Define move ahead 5 streets Define turnright.
Using Algorithms Copyright © 2008 by Helene G. Kershner.
Lecture 14 Go over midterm results Algorithms Efficiency More on prime numbers.
Finding Your Way in the World
Karel The Robot In the beginning… software. Karel the Robot  All robots are controlled by software  Artificially intelligent robots that can “think”
Polymorphism Are there different ways to solve the Harvester problem? – Robot teams – instead of one robot to solve a problem, let’s get a team of robots.
Robot? What’s a Robot? Introducing Karel-the-Robot.
10-1 Programming Remember: –programming language –how to program (conceptually) –intro to programming the “ROBOT” computer In this lecture: –programming.
Problem Solving Through Coding Names. PROBLEM SOLVING PROCESS UNDERSTAND THE PROBLEM: READ OR LISTEN TO THE PROBLEM. MAKE A PLAN TO SOVLE THE PROBLEM-
What is an Angle?. Objectives  Know that angles are measured in degrees  That a whole turn is 360º  That half a turn is 180º  Right angle is 90º 
Karel JRobot Karel is an educational programming language for beginners, created by Richard E. Pattis (currently at Pace University, NY). Pattis used the.
Ch. 2 1 Karel – Primitive Instructions Basic tools with which all problems are solved (analogies: LeftSpinngingRobot, RightSpinningRobot, GuardRobot, etc)
1 Ch. 7 Recursion similar to iteration in that you repeatedly do a little bit of the task and then “loop” again and work on a smaller piece - eventually.
Karel J. Robot A Gentle Introduction to the Art of Object Oriented Programming.
Karel the Robot A Gentle Introduction to the Art of Programming.
Thanks to Dr. Kris Schindler for this (and all Karel the Robot slides)
Robotics. ` What do you think of when you hear ? Robot.
Karel J. Robot Tool for learning OOP (Lecture covers Ch. 1 and 2)
1 karel_part2_Inheritance Extending Robots Tired of writing turnRight every time you start a new karel project. How do we avoid re-writing code all the.
1 Karel – Chapter 6 Instructions That Repeat Note: Original slides provided by and modified for Mr. Smith’s AP Computer Science.
Karel the Robot A Gentle Introduction to the Art of Object- Oriented Programming in Java.
1 Karel J Robot OOP approach to learning computer science “Its study involves development of the ability to abstract the essential features of a problem.
15-100: Introduction to Programming w/ Java * Ananda Gunawardena -- Lecture – School of Computer Science – Phone : (x81559) – Office: Wean Hall.
9-4 Polygons in the Coordinate Plane Learn to draw polygons in the coordinate plane and find the lengths of their sides.
Introduction to OOP in VB.NET using Robots ACSE Conference, Nov 2004 Michael Devoy Monsignor Doyle C.S.S., Cambridge
1 Note: Original slides provided by and modified for Mr. Smith’s AP Computer Science A classwww.apComputerScience.com Day 4.
The Manhattan Tourist Problem Shane Wood 4/29/08 CS 329E.
Ch. 2 1 Karel – Primitive Instructions Basic tools with which all problems are solved (analogies: carpentry, geometry) –move() –turnLeft() –putBeeper()
Programming Introduction. What is a program? Computers cannot think for themselves, they can only follow instructions. A program is a set of instructions.
Mile-long hurdle race Suppose that we want to program Karel to run a one-mile long hurdle race, where vertical wall sections represent hurdles. The hurdles.
Karel the Robot – Review Primitive Commands move pickbeeper putbeeper turnleft turnoff Karel’s program statements are separated by a semicolon (;) Copyright.
Karel the Robot – Review Primitive Commands move pickbeeper putbeeper turnleft Turnoff Karel’s program statements are separated by a semicolon (;) Copyright.
Karel the Robot – Review Primitive Commands move pickbeeper putbeeper turnleft Turnoff Karel’s program statements are separated by a semicolon (;) Copyright.
Karel – Primitive Instructions
VEX IQ Curriculum Smart Machines Lesson 09 Lesson Materials:
Programming what is C++
Mile-long hurdle race Suppose that we want to program Karel to run a one-mile long hurdle race, where vertical wall sections represent hurdles. The hurdles.
Topic: Programming Languages and their Evolution + Intro to Scratch
In the beginning… software
Copyright © 2008 by Helene G. Kershner
Loops We have already seen instances where a robot needs to repeat instructions to perform a task turnRight(); moveMile(); Harvesting beepers in a field.
Copyright © 2008 by Helene G. Kershner
Karel J Robot.
Karel – Primitive Instructions
Karel J Robot.
CS 106A, Lecture 2 Programming with Karel
Using Algorithms Copyright © 2008 by Helene G. Kershner.
Karel J Robot OOP approach to learning computer science
Loops and Switches Pre-Quiz
Using Algorithms Copyright © 2008 by Helene G. Kershner.
Stepwise Refinement Eric Roberts CS 106A January 8, 2010.
Karel the Robot – Making Decisions
Designing an Algorithm
How is Location Determined?
A Gentle Introduction to the Art of Object Oriented Programming
Karel J Robot OOP approach to learning computer science
Programming Fundamentals
Algorithms.
Algorithm The key is the step-by-step instructions.
Nested If Statements While Loops
Warm Up Problem of the Day Lesson Presentation Lesson Quizzes 1.
2.2 Algorithms 26-Jun-19.
Karel – Primitive Instructions
Presentation transcript:

Algorithm The key is the step-by-step instructions. A computer is a machine designed to follow specific instructions very rapidly; BUT The computer does only and exactly what it is told. Computers cannot think! Computers cannot make assumptions Copyright © 2008 by Helene G. Kershner

Algorithm An algorithm written so that it can be carried out by a computer is called a program. To be understood by a computer, the program or algorithm must be written in a programming language. Copyright © 2008 by Helene G. Kershner

Algorithm – Problem Solving Steps People naturally think at a level of abstraction far too complex for even the most abstract and futuristic computer. Get simple, get “stupid”, make NO assumptions. Define the problem Define the output Define the input Define the initial algorithm Refine the algorithm Define the program Copyright © 2008 by Helene G. Kershner

Algorithm Write an algorithm for tying your shoes. Copyright © 2008 by Helene G. Kershner

Karel the Robot Karel’s World Very limited, 2-dimensional Made up of Streets that go North and South (vertical) & Avenues that go East and West (horizontal) Where a Street and Avenue intersect is a Corner or an Intersection Streets and Avenues are described by their number, Ex. 3rd Street & 2nd Avenue would just be Street 3 and Avenue 2. Street 1, Avenue 1, is the origin, or the starting point. Locations are identified by their street and avenue address or location. Also contains, walls and beepers Copyright © 2008 by Helene G. Kershner

Karel the Robot beeper wall Karel Copyright © 2008 by Helene G. Kershner

Karel the Robot Karel’s World Karel is a dim-witted R2D2 Walls Beepers are made of “neutronium” they are obstacles Karel can see but cannot go through. Located one half block between streets or avenues Beepers are small pinging transmitters sit at corners and Karel can hear them. they can be picked up, carried, and put down at corners Copyright © 2008 by Helene G. Kershner

What can Karel do? Karel does not think. Karel is outstanding at following instruction! Karel can move forward (from one corner to the next) in whatever direction he is facing. Karel has a compass so he knows what direction he is facing. Karel has cameras so he can see the walls but only when he is half a block away He has sensors, a mechanical arm, and a beeper-bag He can hear beepers only if he is on the same corner He can pick up the beeper and put it in his beeper bag He can carry the beeper he has picked up from one location to another He can put take a beeper out of his bag an put it on an intersection. Copyright © 2008 by Helene G. Kershner