Tuesday, May 20, 2008

A grub is a Critter that burrows from one location to another. A Grub knows how far away it can burrow and randomly chooses the direction in which to burrow. It burrows down from its current location and burrows up at some target location. If the target location is empty or contains a Flower- the Grub moves to this location. If the target location contains any other type of object- the Grub gets stuck underground and dies. You are to implement getMoveLocations below.

public class Grub extends Critter
{
private int maxDistance;
public Grub(int distance)
{
maxDistance = distance;
}

public int getRandomDirection()
{
Int turns = (int) Math.random()*8;
Return Location.NORTH + turns * Location.Half_Right;
}

/** Gets a list of possible locations for the next move. These locations must be valid in the grid of this Grub. Implemented to return all locations in a random direction up to and including the maximum distance that this Grub can borrow.
Postcondition: The state of all actors is unchanged.

public ArrayList<Location>getMoveLocations()
{

A grub is a Critter that burrows from one location to another. A Grub knows how far away it can burrow and randomly chooses the direction in which to burrow. It burrows down from its current location and burrows up at some target location. If the target location is empty or contains a Flower- the Grub moves to this location. If the target location contains any other type of object- the Grub gets stuck underground and dies. You are to implement getMoveLocations below.

public class Grub extends Critter
{
private int maxDistance;
public Grub(int distance)
{
maxDistance = distance;
}

public int getRandomDirection()
{
Int turns = (int) Math.random()*8;
Return Location.NORTH + turns * Location.Half_Right;
}

/** Gets a list of possible locations for the next move. These locations must be valid in the grid of this Grub. Implemented to return all locations in a random direction up to and including the maximum distance that this Grub can borrow.
Postcondition: The state of all actors is unchanged.

public ArrayList<Location>getMoveLocations()
{

Match each of the following with its function:

1.) defines a service that the object provides
2.) violates the principle of encapsulation
3.) supports the activities of other methods in the class
4.) holds data for a particular object

Choose...
A.)a private method
B.) a private variable
C.)a public method
D.)a public variable

I m coding my own graphic novel website- and am thinking about making some games or simple animations for it. The only problem is...

Flash: Supposedly Flash can actually hurt a website s ratings in search engines- and anyway it requires certain plugins

Javascript: Many users disable Javascript in order to help avoid advertisements

Java: A big- scary programming language that I won t be learning any time soon

Any recommendations on which choice is the best?

Like a customer service number when you need help with something off their site?

No comments: