コード例 #1
0
 private static TileSymmetry countBaseSymmetry(Tile tile) {
   for (Feature piece : tile.getFeatures()) {
     if (piece instanceof Road || piece instanceof City) {
       Feature opposite = tile.getFeature(piece.getLocation().rev());
       if (opposite == null || !opposite.getClass().equals(piece.getClass())) {
         return TileSymmetry.NONE;
       }
     }
   }
   for (Feature piece : tile.getFeatures()) {
     if (piece instanceof Road || piece instanceof City) {
       Feature opposite = tile.getFeature(piece.getLocation().rotateCW(Rotation.R90));
       if (opposite == null || !opposite.getClass().equals(piece.getClass())) {
         return TileSymmetry.S2;
       }
     }
   }
   return TileSymmetry.S4;
 }