Hey guys, I'm trying to develop a program that can solve the Travelling Salesman Problem using the Nearest Neighbour Algorithm with Greenfoot. I'm doing it on a smaller scale, using Akhabara (a city in Japan) as the entire workspace, and individual shops in that city as the places to visit. This is my code so far:
I just started so it's not that intricate yet, but I was wondering if it was possible to set a different image to each individual instance variable of the Shop class that I generated, so that they are distinguishable when they appear on the world.
import greenfoot.*;
public class Akihabara extends World
{
/**
* Constructor for objects of class Akihabara.
*
*/
public Akihabara()
{
super(1000, 1000, 1);
prepare();
}
private void prepare()
{
Shop station = new Shop();
addObject(station, 800, 600);
Shop tarou = new Shop();
addObject(tarou, 800, 800);
Shop donquihote = new Shop();
addObject(donquihote, 600, 200);
Shop kotobukiya = new Shop();
addObject(kotobukiya, 200, 600);
Shop tsukumo = new Shop();
addObject(tsukumo, 400, 500);
Shop akibacultures = new Shop();
addObject(akibacultures, 200, 400);
Shop treasurehunter = new Shop();
addObject(treasurehunter, 200, 200);
Shop misterdonuts = new Shop();
addObject(misterdonuts, 400, 300);
Shop fujisoba = new Shop();
addObject(fujisoba, 400, 700);
Shop animate = new Shop();
addObject(animate, 600, 400);
}
}import greenfoot.*;
public class Shop extends Actor
{
public Shop()
{
}
public void act()
{
}
}
