Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8499823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:46:20+00:00 2026-06-11T00:46:20+00:00

I am in a computer Science class and we have started with using Karel

  • 0

I am in a computer Science class and we have started with using Karel the Robot as the introduction to Java OOP. I want to run two Karel the Robots at the same time, performing two different tasks. I have tried looking up solutions on the internet, and I have been successful in making a working thread, however, I am unable to run two Karel the Robots at the same time. Any help on this Concurrent Programming issue would be appreciated.
Here’s the code I have been using:

package karel;
import kareltherobot.*;
import kareltherobot.Directions;
import kareltherobot.World;
public class KarelSample implements Directions
{
    public static void main(String [] args)  
    {


          Thread Karelrunner = new Thread();
          Karelrunner.start();
 UrRobot Karel = new UrRobot ( 1,5, North, 2);
 Karel.move();
 Karel.move();
 Karel.putBeeper();
 Karel.turnLeft();
 Karel.move();


}




    static
    {   
    World.setVisible(true);
    World.showSpeedControl(true);



}


    class Karelrunner implements Directions {

        UrRobot Karel2 = new UrRobot(8,8, South, 2);
        Karel2.move();
        Karel2.move();
        Karel2.turnLeft();
        Karel2.turnLeft();
        Karel2.putBeeper();
        Karel2.move();
}



}

I have also used the Karel J Robot book’s example where the thread setup code would be as follows:

public static void main (String [] args)
{ ...

Karelrunner r = new Karelrunner();
World.setupThread(r);

  . . .
}

Please help in any way you can, I am trying to make a multi-threaded concurrent program. I am new to this and thanks for your time and attention.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T00:46:21+00:00Added an answer on June 11, 2026 at 12:46 am

    I have done more research and found a solution to my problem. Thanks kevinsa5 for the idea. For anyone who may have a problem with multi-threading in Karel the Robot or in general, I’ll post my code below. Hopefully, it will help in giving you an idea.

    package karel;
    import kareltherobot.*;
    import kareltherobot.Directions;
    import kareltherobot.World;
    public class KarelSample implements Directions
    {
        public static void main(String [] args)  
        {
            new Karelrunner(8,8,South,2); 
    
            UrRobot Karel = new UrRobot (1,3,North,2);
    
            Karel.move();
            Karel.move();
            Karel.putBeeper();
            Karel.move();
            Karel.turnLeft();
            Karel.move();
        }   
    
        static
        {   
            World.setVisible(true);
            World.showSpeedControl(true);
        }
    }
    
    class Karelrunner extends UrRobot implements Directions 
    {
        public Karelrunner (int street, int avenue, Direction direction, int beepers)
        { 
            super ( street, avenue, direction, beepers);
            World.setupThread(this);
        }
    
        public void run()
        {
            move();
            move();
            putBeeper();
            turnLeft();
            move();
        }
    }   
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So, I have this true/false question in my computer science class (we're using Java):
I have to make a game in Java for my computer science class. Since
I am college student (computer science) and have just started a C# programming class.
I'll be taking a Python-based computer science class next semester using my MacBook Pro.
I'm a computer science college student. Yesterday, I have a class about Binary Search
I am a computer science student and taking my first C++ class. I have
I have to do a project for my Computer Science class. The problem is:
It is taught in every computer science class and written in many books that
For the new computer science assignment we are to implement a list/array using an
I am a layman to computer science, I have some questions about terminology of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.