Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: robot simulation project

  1. #1
    Junior Member
    Join Date
    Aug 2014
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question robot simulation project

    Specification:

    This project is a robot simulation. The goal is to create a simulation determine how long randomly moving robots can "survive" in the world.
    As sample run might look like this:

    Enter the number of Robots:
    4
    Running simulation ...
    Move 1:
    Robot 1 (0, 0)
    Robot 2 (99, 0)
    Robot 3 (0, 99)
    Robot 4 (99, 99)
    Move 2:
    Robot 1 (-1, 0)
    Robot 2 (99, -1)
    Robot 3 (-1, 99)
    Robot 4 (100, 99)

    The simulation lasted 2 moves.

    As an alternative you can graphically display the robots and the results.
    Specification:

    The simulation world is 100 x 100. Each Robot starts in a random location in the world. When a Robot leaves the world, it is dead and no longer moves.

    For every Move of the simulation each Robot will move randomly either to the left, right, up, or down one space.

    When all the Robots are dead the simulation is over.
    Test Program

    Create a Robot class with the following methods:

    void initialize( int xPos, int yPos)
    void moveLeft()
    void moveRight()
    void moveUp()
    void moveDown()
    int getXPosition()
    int getYPosition()
    void setDead()
    boolean isDead()

    Write a test program to test each method of the Robot Class.

    Here is an example of a test case:

    Robot r = new Robot();

    r.initialize(10, 10);

    r.MoveRight();

    if ( r.getXPosition() == 11 ) {

    System.out.println("Pass");

    }

    else {

    System.out.println("Fail");

    }
    Requirements:

    All source code must be written in Java
    No Magic Numbers
    The test program must test the functionality of the Robot class
    The simulation program must utilize the Robot class
    The source code must be fully commented


  2. #2
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: robot simulation project

    Welcome to the forum! Please read this topic to learn how to post code in code or highlight tags and other useful info for new members.

    Please make an effort; come back when you need help.

    Thread closed.

Similar Threads

  1. [SOLVED] Robot Class
    By keepStriving in forum What's Wrong With My Code?
    Replies: 0
    Last Post: June 15th, 2013, 08:52 PM
  2. Robot Class:
    By ferozemo in forum Java SE APIs
    Replies: 2
    Last Post: April 27th, 2012, 07:22 PM
  3. Robot
    By imsuperman05 in forum Java Theory & Questions
    Replies: 19
    Last Post: December 26th, 2011, 01:08 PM
  4. [SOLVED] Robot Exception
    By Kanyon in forum Exceptions
    Replies: 7
    Last Post: September 14th, 2011, 07:24 PM
  5. Robot help.
    By mlan in forum AWT / Java Swing
    Replies: 1
    Last Post: February 14th, 2010, 04:26 PM