Karel J Robot.

Slides:



Advertisements
Similar presentations
1 of 3 Teaching OOD from the Beginning Karel is Kool Visual Feedback is Powerful – students see their mistakes/triumphs Stay within one common metaphor.
Advertisements

1 karel_IF_part1 Conditional Statements Flavor 1: if ( ) { } For now: these are method invokations (see next slide)
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.
1 Note: Original slides provided by and modified for Mr. Smith’s AP Computer Science A classwww.apComputerScience.com.
1 Note: Original slides provided by and modified for this specific classwww.apComputerScience.com.
1 of 3 Karel Karel is an educational programming language for beginners, created by Richard E. Pattis (currently at Pace University, NY). Pattis used the.
Copyright, Joseph Bergin
1 karel_part4_functions.ppt Functions Functions return values or Objects. –Using a function allows the programmer to focus on other task. –Using a function.
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.
Introduction to Computer Science Instructions that Repeat –iterate instruction –while instruction A Large Program written using Top-Down Design Unit 4.
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.
Karel JRobot Karel is an educational programming language for beginners, created by Richard E. Pattis (currently at Pace University, NY). Pattis used the.
Chapter 5 Conditionally Executing Instructions
1 karel_part5_loops Iteration (Loops) Loops repeat a set of instructions Two types of loops: –Definite loops ( for ) perform instructions explicit (known)
Ch. 2 1 Karel – Primitive Instructions Basic tools with which all problems are solved (analogies: LeftSpinngingRobot, RightSpinningRobot, GuardRobot, etc)
Karel J Robot An introduction to BlueJ and Object- Oriented Programming.
1 Note: Original slides provided by and modified for Mr. Smith’s AP Computer Science A classwww.apComputerScience.com.
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)
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.
1 Note: Original slides provided by and modified for Mr. Smith’s AP Computer Science A classwww.apComputerScience.com If you.
1 Karel – Chapter 5 Conditionally Executing Instructions Note: Original slides provided by and modified for Mr. Smith’s AP Computer.
Karel the Robot A Gentle Introduction to the Art of Object- Oriented Programming in Java.
1 Note: Original slides provided by and modified for Mr. Heath’s AP Computer Science A classwww.apComputerScience.com.
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.
Georgia Institute of Technology Simulations Barb Ericson Jan 2005.
15-100: Introduction to Programming w/ Java * Ananda Gunawardena -- Lecture – School of Computer Science – Phone : (x81559) – Office: Wean Hall.
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.
1 Note: Original slides provided by and modified for Mr. Smith’s AP Computer Science A classwww.apComputerScience.com.
Programming in Karel Eric Roberts CS 106A January 6, 2016.
Ch. 2 1 Karel – Primitive Instructions Basic tools with which all problems are solved (analogies: carpentry, geometry) –move() –turnLeft() –putBeeper()
Karel J. Robot Chapter 6 Instructions That Repeat.
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.
1 Note: Original slides provided by and modified for Mr. Smith’s AP Computer Science A classwww.apComputerScience.com.
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.
1 Karel J. Robot Chapter 5 Conditionally Executing Instructions.
1 Chapter 5 Karel J Robot 2 Chapter 5 Chapter 5 Conditional Statements Flavor 1: if ( ) { } For now: these are method invocations (see next slide)
Karel J. Robot Chapter 6 Instructions That Repeat.
Boğaziçi Ünv Koç Ünv Darüşşafaka Lisesi
CS 106A, Lecture 3 Problem-solving with Karel
Karel – Primitive 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.
Eric Roberts and Jerry Cain
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_part4_functions_2
Karel – Primitive Instructions
Karel J Robot Chapter 4 B.
Karel J Robot.
CS 106A, Lecture 2 Programming with Karel
Karel J Robot OOP approach to learning computer science
Algorithm The key is the step-by-step instructions.
Karel the Robot – Making Decisions
SSEA Computer Science: CS106A
Cs212: DataStructures Computer Science Department Lab 3 : Recursion.
slides courtesy of Eric Roberts
A Gentle Introduction to the Art of Object Oriented Programming
Karel J Robot OOP approach to learning computer science
Algorithm The key is the step-by-step instructions.
Nested If Statements While Loops
Karel – Primitive Instructions
Presentation transcript:

Karel J Robot

Karel J Robot Karel provides an OOP approach to learning computer science It provides visual feedback to students – you get to see your mistakes and triumphs. It will cover some of the major CS concepts in a short period of time: Inheritance, Polymorphism, Abstraction, Encapsulation, OOP-Design, Recursion, Iteration, Selection, … Filters out many(relevant) details so one can focus on the major concepts: Not in danger of losing sight of the Forest (computer science) through the details of the Trees (java details)

Karel J Robot It’s pure Java It introduces many major topics in a short period of time – not too much detail then, as the year goes on, we will spiral back through those topics introducing more and more detail as required 1st term timeframe which includes lectures, homework, labs, quizzes, and assessments

Karel's World Robot World A flat plane of streets (east-west) and AVenues (north-south) Streets Corner (many robots may occupy) Avenues

Karel's World Bounded on west side by an infinitely long vertical wall and on south side by infinitely long horizontal wall Streets and avenues have numbers Corner is identified by street and avenue. Origin is street 1, avenue 1. Position of robots and other things can be referred to by an absolute or relative location

Karel's World Contains Beepers and Walls Beepers Walls Beep very softly. Robots cannot sense a beeper until they are on the same corner. May be picked up, carried, and placed again Several beepers can be placed on a corner and they don’t interfere with Robot movement Walls Placed half way between street corners Impenetrable, blocks robots Used to create rooms, mazes, hurdles

Wall Segments

Robot Capabilities Moves Turns Senses surroundings Only moves forward in direction top of its head is facing Turns Turns 90 degrees to the left Senses surroundings Hears beepers (on same corner) Determines direction it is facing Picks up, carries, and puts down beepers Turns itself off I am facing West and have no beepers I am turned OFF. I can’t do anything else.

Karel-Werke Factory - Builds the robots Factory – Delivers the robots “factory” (auf Deutsch) Factory - Builds the robots Standard model New model Extension of an existing base model Factory – Delivers the robots

Robot Tasks and Situations Examples: Move to a corner (3rd St. & 5th Ave.) Run a hurdle race Escape from a maze Find a beeper and deliver it to the origin Draw a pattern with beepers

Robot Tasks and Situations Fig A: A room has one door. A robot is at the origin and facing North. Robot must enter the room. Fig B: A diagonal line of beepers. Robot is facing East and must pick up all beepers. Fig C: A “+” wall arrangement with beepers. From a starting position, Robot must pick up all beepers. Fig D: Robot must escape the maze.

Robot Tasks and Situations Fig E: Beepers are scattered in a box. Robot is facing South in the Northwest corner and must pick up all beepers in the box.. Fig F: Box with a beeper. Robot is facing North in the Northeast corner. Robot must find the beeper.

Karel Program

Using Eclipse Java Environment Before you begin to write programs for Karel or Java, you will need to obtain a copy of Eclipse from http://www.eclipse.org/downloads/ website. The process for downloading Eclipse depends on what system you are using. The process may take a while, so be patient!

The Eclipse Interface

Coding Karel import stanford.karel.*; public class OurFirstKarelClass extends Karel { public void run() { turnLeft(); move(); pickBeeper(); }

Defining new methods Yes you can define new methods for Karel private void turnRight() { turnLeft(); }