Algorithms. An algorithm is an effective method expressed as a finite list of well- defined instructions for accomplishing a goal.. Have one student give.

Slides:



Advertisements
Similar presentations
How can we arrange a set of instructions in sequential order?
Advertisements

Topic Heading = Order of Operations. What is the Order of Operations? What are the steps you take to make a PB and J sandwich? –Slather jelly on one slice.
The Peanut Butter & Jelly Computer Instructor’s Handout (modified from zerorobotics and CS10K Community handouts) KEY CONCEPTS Software and hardware work.
Making a “P and J” sandwich
Lesson Planning & The Peanut Butter Sandwich Take a plate, knife, a glob of peanut butter, and two pieces of bread DO NOT EAT YET! Think about the following.
How to make a peanut butter and jelly sandwich
Making a Peanut Butter and Jelly Sandwich
Determining how much Peanut butter is optimal on a PB&J Sand Sandwich By Mr. Anderson.
Peanut Butter and Jelly Sandwich Ingredients Peanut butterTwo slices of bread Jelly or jamKnifePlate.
How to Make a Peanut Butter and Jelly Sandwich By Kristy and Jon.
Do Now )Take out your homework to be checked. 2)Study your notes from both sections. 1)PUT YOUR NAME ON THE PACKET THAT IS BEING PASSED OUT BUT.
How to Make a Peanut Butter and Jelly Sandwich
How to Make a Peanut Butter and Jelly Sandwich Presented by: Lizzy Trillo Project 5: How to Make a PB & J Sandwich 5/3/11.
Cross Contamination Experiment Safety and Sanitation.
A Social Story and Activity Click on the words to hear them spoken.
Lesson 5 - Decision Structure By: Dan Lunney
Tic Tac Toe Game Design Using OOP
PLANNING THE TIC TAC TOE GAME BY NEEL DAVE. TIC TAC TOE INSTRUCTIONS Tic Tac Toe Instructions The basic concept of Tic Tac Toe 1.This is a game for two.
Integer Tic Tac Toe Let’s Begin Rules: 1.Erase all x’s and o’s from the previous game before you begin. 2.Decide which player will be x’s and which will.
CSE111: Great Ideas in Computer Science Dr. Carl Alphonce 219 Bell Hall Office hours: M-F 11:00-11:
CS 295 – Web Development II First Day’s Assignment.
CSE 115 Week 12 March 31 – April 4, Announcements March 31 – Exam 8 March 31 – Exam 8 April 6 – Last day to turn in Lab 7 for a max grade of 100%,
How to Make a Peanut Butter and Jelly Sandwich Presented by: Christopher DiFabio Project 5: How to Make a PB & J Sandwich May 21, 2012.
By Ella Marks n/ImageDisplay/1/18/10 Clipart.
By: Rachel Kenney. First Step Get a plate and bread out.
How to make a Peanut Butter and Jelly Sandwich!
Introduction to Programming. What is a Program  Set of Instructions that tells the computer what to Do.  Driving force behind the computer  Without.
More on Logic Today we look at the for loop and then put all of this together to look at some more complex forms of logic that a program will need The.
How to Make a Peanut Butter and Jelly Sandwich Presented by: Andrew Stockmoe Project 5: How to Make a PB & J Sandwich 5/3/12.
How to Make the Perfect PB&J By: Jade Edwards. Materials Needed: ➾ 2 slices of white bread ➾ 1 jar of peanut butter ➾ 1 jar of grape jelly ➾ 1 paper plate.
Presented by: Mr. Pugh’s Class 2011 Ingredients Peanut Butter Jelly Two Slices of Bread.
More on Logic Today we look at the for loop and then put all of this together to look at some more complex forms of logic that a program will need The.
Lists Module 2: XHTML Basics LESSON 8. Module 2: XHTML Basics LESSON 8 Lesson Overview In this lesson, you will learn to:  Create lists using XHTML code.
“How To” Projects Miss Polito Second Grade Bradford Heights Elementary.
1 How do make a Peanut Butter and Jelly sandwich A Recipe From Annissa Chi.
Informational Writing (Procedural) ELACC5W2: Write informative/explanatory texts to examine a topic and convey ideas and information clearly. EQ: How can.
How to make a pb and j sandwich Presented by: Collin Neale Project 5.
Task Analysis of a Ham, Cheese and Tomato Sandwich
Algorithms.
Topic: Conditional Statements – Part 1
Tic-Tac-Throw! How to Play: X or O
Next Level Tic-Tac-Toe
Principles of Programming I (CIE 105)
How do the students earn points on the essay?
Paragraph Writing Review How much do you remember…..
David Kauchak CS52 – Spring 2016
How can we arrange a set of instructions in sequential order?
Making a PBJ Sandwich Less Mess, No Stress
Search in OOXX Games J.-S. Roger Jang (張智星) MIR Lab, CSIE Dept.
The procedure.
Non-fiction Organizational Patterns
Same or Different? (C) 2016 by Exercise ETC Inc..
How to make a peanut butter & jelly sandwich
Computational Thinking for KS3
Design and Implementation
NIM - a two person game n objects are in one pile
SCIENCE ON FRIDAYS.
How to Make a Peanut Butter and Jelly Sandwich
Pasa números Divide students in to teams and have each team sit in a row. Give each student a dry erase marker and something to erase with. Each team gets.
Objective Given this activity, the students will be able to make the perfect peanut butter and jelly sandwich by following the steps in order.
The structure of programming
Same or Different? (C) 2016 by Exercise ETC Inc..
Developing A Good Procedure
Thinking procedurally
International Space Station
The Scientific Method.
CS51A David Kauchak Spring 2019
X O X O X O X O X O X O X O X O X O X O
Backtracking, Search, Heuristics
Instructional Focus Lesson Plan Reading 2.3 Grade 1
Presentation transcript:

Algorithms

An algorithm is an effective method expressed as a finite list of well- defined instructions for accomplishing a goal.. Have one student give instructions to a mentor for how to make a peanut butter and honey sandwich. What things aren’t perfectly clear?

Sequential execution The normal order of statement execution is sequential – first statements first. Open the bag of bread. Remove two slices of bread Reclose the bag of bread. Open the peanut butter Using a knife, Spread peanut butter on one slice of bread Using a knife, Spread honey on the other piece of bread. Put the two pieces of bread together with gooey sides together Eat it!

If-then-else An IF-THEN-ELSE statement if a way of describing choices. IF (boolean condition) THEN (consequent) ELSE (alternative) END IF We use if-then-else statements in everyday life. Example: If you finish your homework, you can play on the computer else you cannot.

We can “nest” if-then-else instructions If you have done your homework if you have exercised you may play video games else exercise else you need to do your homework.

Another way of saying something similar If you haven’t done your homework do your homework else if you haven’t exercised exercise else if you want to play video games play video games.

While statement Another way of controlling the order of instructions is with a while statement. We use a while statement in everyday life. Example: while your teeth are dirty, brush Example: while you aren’t finished with the lawn, mow Example: while the bread isn’t covered with peanut butter, get more peanut butter on the knife and spread it.

If this activity, we’ll use an algorithm to teach the computer how to play tic-tac- toe Look for if-then-else constructs Are there any while constructs?

Tic Tac Toe Algorithm I am X… and I go first… Move 1: Go in a corner. Move 2: IF the other player did not go in the opposite corner (from where you played) THEN go there ELSE go in a free corner. Move 3: IF there are 2 Xs and a space in a line THEN go in that space. ELSE IF there are 2 Os and a space in a line THEN go in that space. ELSE go in a free corner. Move 4: IF there are 2 Xs and a space in a line THEN go in that space. ELSE IF there are 2 Os and a space in a line THEN go in that space. ELSE go in a free corner. Move 5: Go in the free space.

Another way of stating the algorithm while not (game over){ increment move make appropriate move (from previous slide) } Game Over is true when there are three X’s in a row (X wins) there are three O’s ins a row (O wins) there are no more spaces left (it is a tie)