1 / 15

LEARN TO CODE WORKSHOP

LEARN TO CODE WORKSHOP. LESSON 1: Introduction to the Robot World George Kramer. +. +. Workshop Objective. Develop problem solving skills Use a programming language as a means of expression. Workshop Schedule. The Robot World. Robots perform simple tasks in a world

Download Presentation

LEARN TO CODE WORKSHOP

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. LEARN TO CODE WORKSHOP LESSON 1: Introduction to the Robot WorldGeorge Kramer + +

  2. Workshop Objective • Develop problem solving skills • Use a programming language as a means of expression

  3. Workshop Schedule

  4. The Robot World • Robots perform simple tasks in a world • Robots can sense and manipulate walls and beepers

  5. The Robot World • Worlds are a grid of streets and avenues that robots can traverse

  6. The Robot World • Walls are barriers that robots can see but cannot cross

  7. The Robot World • Beepers are cones that robots can pick up, put down, and carry

  8. Robot Capabilities • Move forward in facing direction • Turn in place • Turn off • Identify facing direction • Detect walls • Hear beepers • Determine whether carrying beepers • Determine whether near other robots

  9. Robots as Objects • Robots are constructed in factories according to specifications in our orders • Robots come in different models • Robots from one factory can be further specialized by another • Robots need a detailed set of instructions to accomplish their given tasks • Robots execute instructions sequentially

  10. Robots as Objects • Robots are objects • Objects can do things and remember things • Can ask a robot: • To do what it knows how to do • What it remembers • Java is a programming language where objects can be easily created • Methods perform actions • Variables remember information

  11. Robots in Java • Order a robot • UrRobotkarel = new UrRobot(1, 2, East, 0); • Tell a robot what to do • karel.move(); • karel.turnLeft(); • karel.pickBeeper(); • karel.putBeeper(); • karel.turnOff();

  12. Be Careful! • Robots will shutoff in any of the following conditions: • Trying to move when the path in front is not clear • Trying to pick up a beeper when there is no beeper to pick up • Trying to put down a beeper when there are no beepers to put down

  13. A Complete Program import kareltherobot.*; public class Sample implements Directions { public static void main(String [] args) { World.readWorld("Sample.kwld"); World.setVisible(true); World.setDelay(30); UrRobotkarel = new UrRobot(1, 2, East, 0); karel.move(); karel.move(); karel.pickBeeper(); karel.move(); karel.turnLeft(); karel.move(); karel.move(); karel.putBeeper(); karel.move(); karel.turnOff(); } }

  14. Demonstration

  15. Now its Your Turn!!! • Visit the UConn ACM website and navigate to the Learn to Code Workshop section • Download and follow setup instructions • Download and work on first problem of lesson 1 problem set

More Related