Results 1 to 1 of 1
  1. #1
    DreamSync is offline Member
    Join Date
    Feb 2014
    Rep Power

    Default Karel the robot - CS106A stanford course (on you tube :P) general question

    Hey everyone :)! (sorry if my english is a bit broken ^_^)
    I was wondering...
    Almost in every karel program I write, I get to this point when karel should turnOff(); because he has reached the goal of the excercise (but the public void run() is far from over)
    for example: in the excercise finding middle point ( in an X:X world (number of avenues = number of streets) karel is in 1:1 facing east

    so theres a very long program to achieve the goal when its a 3:3 world or higher

    but lets say i have a 1:1 world:
    public void run() {
    if (frontIsBlocked()) {
    "rest of the program"

    The thing is the stanford version does not have a turnOff(); method...and they never say its a valid way to do things.
    my question is:

    1) Why cant I turnOff karel in the middle if he achieved his goal?
    2) does "knowing how to reach the end of the proggram and only then turning him off" is a better way of doing things? (to me it seems a lot harder and messy)
    3) Is there another way to tell karel: "good job, you did it, you dont need to continue and run the rest of the program?

    Hope i made my question clear : )
    Thank you for taking the time to read my question!
    Last edited by DreamSync; 02-14-2014 at 12:16 AM.

Similar Threads

  1. Java Checkerboad question CS106A Stanford univerity
    By ccie007 in forum New To Java
    Replies: 71
    Last Post: 09-20-2013, 05:02 AM
  2. Re: Java Checkerboad question CS106A Stanford univerity
    By maowebsolutions in forum New To Java
    Replies: 1
    Last Post: 09-20-2013, 04:51 AM
  3. Stanford CS106a GraphicsHeirarchy
    By Newbieprogrammer in forum New To Java
    Replies: 0
    Last Post: 07-15-2012, 08:37 PM
  4. Stanford cs106a
    By D.good in forum Introductions
    Replies: 1
    Last Post: 02-04-2012, 07:18 PM
  5. CS106A Stanford University
    By Learning Java in forum New To Java
    Replies: 116
    Last Post: 07-09-2011, 05:43 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts