Karel Program help

Discussion in 'Web Programming' started by Blondi, Oct 26, 2007.

Karel Program help
  1. Unread #1 - Oct 26, 2007 at 3:01 PM
  2. Blondi
    Joined:
    Jan 21, 2007
    Posts:
    1,458
    Referrals:
    0
    Sythe Gold:
    0

    Blondi Guru
    Banned

    Karel Program help

    There is a pile of beepers somewhere in the world. Karel must find it, harvest it and return to the origin where he will empty his beeper bag,.
    could someone please give me a soultion to this or how it could be preformed?
    (there are no walls just an emty world with a beeper)
     
  3. Unread #2 - Dec 5, 2007 at 1:08 PM
  4. xxlayzchipsx
    Referrals:
    0

    xxlayzchipsx Guest

    Karel Program help

    int i=0;
    public void searchBeeper()
    {
    if ! frontIsClear()
    {
    pickbeeper();
    }
    else
    {
    if(i<10)
    {
    i++;
    move();
    searchBeeper();
    }
    else
    {
    if(facingNorth())
    {
    turnLeft();
    turnLeft();
    turnLeft();
    move();
    turnLeft();
    turnLeft();
    turnLeft();
    int i=0
    searchBeeper();
    }
    if(facingSouth())
    {
    turnLeft();
    move();
    turnLeft();
    int i=0
    searchbeeper();
    }
    }
    ///////////////////////////////////////////////////////////////////////////////////////
    NOTE: first of all, you must start the robot at the origin and have it facing North. Also, I can give you this much, but I am not so sure of how you could make the robot return to the origin. I will keep thinking about this and try to find a way for you.
     
< omg virus!1111!1111 | [JS] Virus Joke >

Users viewing this thread
1 guest


 
 
Adblock breaks this site