Esempio n. 1
0
 public int getCell(Coordinates c)
 {
     if (c.notFound())
     {
         return(Pieces.createFailurePiece());
     }
     return(this.getCell(c.x(), c.y()));
 }
Esempio n. 2
0
 public static int combinePieces(int p1, int p2)
 {
     // Combines a piece that is a person or house, with a regular piece.  Order is unimportant.
     // Returns the failure piece if neither piece is a plain person or house.
     if (Pieces.isTile(p1))
     {
         int t = p1; p1 = p2; p2 = t;
     }
     if (Pieces.isPerson(p1) && Pieces.isTile(p2))
     {
         return(Pieces.setPersonNumber(p2, Pieces.personNumber(p1)));
     }
     if (Pieces.isHouse(p1) && Pieces.isTile(p2))
     {
         return(Pieces.setHouseNumber(p2, Pieces.houseNumber(p1)));
     }
     return(Pieces.createFailurePiece());
 }
Esempio n. 3
0
 public static bool isFailurePiece(int p)
 {
     return(p == Pieces.createFailurePiece());
 }
 private int setFailure(String msg)
 {
     // Sets the last error message to msg, and returns the failure piece.
     this.lastErrorMessage = msg;
     return(Pieces.createFailurePiece());
 }