NEWS: Total Picture Views: 151536 | Total Article Views: 161023 | Top 5 Most Popular Article: 1. Am I Stuck Algorithm with Becker Robot | 2. PickUpThings with Becker Robot | 3. How to read a JSON and work with it | 4. Encrypted Data GUI (Download .Zip) | 5. Create Wall and Things with Becker

Create Wall and Things with Becker Java

Description:

In this example I will be showing you how to create wall and thing with Becker

Code:

/**
 * 
 ----------------
 * 
 */
 
import becker.robots.*;
import java.util.Random;

public class Assignment3a {
      
   public static void main(String[] arg) {
      City oakville = new City(10, 16);
      createWalls(oakville);
      createThings(oakville);
      
      Random generator = new Random();
      int ave = generator.nextInt(9) + 1;
      int st = generator.nextInt(10);
      
      Robot roby = new Robot(oakville, st, ave, Direction.NORTH);
      
   }
   
   //create the walls
   private static void createWalls(City city){
       Wall w1 = new Wall(city, 3,3, Direction.WEST);
       Wall w2 = new Wall(city, 3,5, Direction.WEST);
       Wall w3 = new Wall(city, 3,6, Direction.WEST);
       Wall w4 = new Wall(city, 3,10, Direction.WEST);
       Wall w5 = new Wall(city, 3,13, Direction.WEST);
   }
   
   //create the things
    private static void createThings(City city){
        for (int i=3; i<15; i++){
            Thing th = new Thing(city, 3, i);
        }
    }
}
Attachments: None

Tags: Becker Wall Thing

Total Views: 2088

My name is Jean-Mathieu

I created this website so other people could enjoy finding useful stuff easier. If you have any question do not hesitate to contact me.

jean8mathieuCreated on 11/07/14


affiliate_link

Disclosure: We are a website that needs compensation to operate like any other website on the internet.
We may receive consideration for our reviews but we are totally unbiased and do not accept paid reviews or fake reviews claiming to be something they are not.