1 / 17

Karel J Robot

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:

llockhart
Download Presentation

Karel J Robot

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Karel J Robot

  2. 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)

  3. Karel J Robot • It’s pureJava • 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

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

  5. 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

  6. Karel's World • Contains Beepers and Walls • Beepers • 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

  7. Wall Segments

  8. Robot Capabilities • Moves • 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.

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

  10. 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

  11. 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.

  12. 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.

  13. Karel Program

  14. 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!

  15. The Eclipse Interface

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

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

More Related