Beispiel #1
0
  /** Returns true if the two supplied placements match up (represent a legal board position). */
  protected boolean tilesMatch(Placement play1, Placement play2) {
    // based on the relative positions of the two placements, determine the "natural" edges to
    // be compared (east/west or north/south)
    Orient orient1 = play1.loc.directionTo(play2.loc), orient2 = orient1.opposite();

    // now rotate those "natural" edges based on the orientations of the placements
    orient1 = orient1.rotate(-play1.orient.index);
    orient2 = orient2.rotate(-play2.orient.index);

    // now make suer those two edges match
    return play1.tile.terrain.getEdge(orient1) == play2.tile.terrain.getEdge(orient2);
  }