1 | MA | VS | DV |
2 | AG | YS | AN |
3 | EL | YZ | AS |
4 | LG | MB | JW |
5 | LU | SL | GP |
6 | EH | HF | BB |
7 | AR | MM | VD |
Exposed Game Engine Methods
The following methods are exposed by the game engine and are available
to the player when evaluating potential cookie placements:
public int
maxRounds()
throws Exception;
public int
numPlayers()
throws Exception;
public boolean intersects(Vertex,
Vertex, Vertex, Vertex)
throws Exception;
public double distance(double,
double, double, double, double, double)
throws Exception;
public double[] distance_intersect(double,
double, double, double, double double) throws Exception;
public Vertex[][] cookieshapes()
throws Exception;
public int cookieCopies()
throws Exception;
public double area(Vertex[])
throws Exception;
public Vertex centroid(Vertex[])
throws Exception
public double findMinRightBoundary(Vertex[][])
throws Exception
For this game model, maxRounds() and numPlayers()
are vestigial methods included for conformance to the IFCModel interface.
Method | Description |
intersects(v1, v2, v3, v4) | Returns true if the line segments (v1 -> v2) and (v3 -> v4) intersect. |
distance(x, y, x1, y1, x2, y2) | Returns the distance between the point (x, y) and the nearest point
on the segment
(x1, y1)->(x2, y2). |
distance_intersect(x, y, x1, y1, x2, y2) | Exactly the same as distance(), except that an array containg the point of intersection is returned. The contents of the returned array are: [0]: intersection x-coordinate, [1]: intersection y-coordinate, [2]: distance between point and intersection. |
cookieshapes() | Returns the vertices of each cookie in the gamefile. |
cookieCopies() | Returns the number of copies of each cookie the player has to place. |
area() | Returns the area of a polygon passed in as an array of Vertex objects. |
centroid() | Returns the centroid of a polygon passed in as an array of Vertex objects. |
findMinRightBoundary() | Returns the minimum value of the Right Boundary which encompasses all given polygons. Dont forget to add your epsilons and deltas. |
Player Interface
Players are required to implement the following interface:
public interface IFCPlayer extends IFCConstants, Serializable {
public void register(CookieCutter
__cookiecutter) throws Exception;
public String name()
throws Exception;
public boolean interactive()
throws Exception;
public Move[] moves()
throws Exception;
}
The first three methods function exactly as in Project 1. There is another method moves() that you must implement. It is called when the player is to specify an arrangement of the cookies.
The returned array of Move objects will specify the positions of
each copy of each of the cookies on the dough.
A Move object is immutable and has the following
constructor prototype:
Move(int __copies)
Here __copies is the number of copies of the particular cookie
that this Move Object would specify.
The moves() method should return an Array of Move Objects. The length of this Array should be equal to the number of Cookies to be placed. Each Move Object would specify the positions of each of the copies of the particular cookie and also the right boundary of that cookie arrangement. The position of a cookie copy is conveyed by specifying the centroid of the cookie copy and the angle of rotation with respect to the original cookie shape. The center of rotation would be the centroid.
See DefaultPlayer code for a simple example.
Software
The full software source tree and class files are available from:
In addition, JAR files corresponding to both the game model and ui components
as well as a targzipped version of the directory is also available in that
directory. You
can access the targzipped file directly at:
Tuesday, October 7th Absent: AN
Thursday, October 9th Absent: MM