コード例 #1
0
        public static int rotatePieceOneEighth(int p)
        {
            // Rotates a piece clockwise.
            int newPiece = p;

            newPiece = Pieces.setDirections(newPiece, Pieces.northwest(p), Pieces.southeast(p), Pieces.southwest(p), Pieces.northeast(p));
            newPiece = Pieces.setDiagonals(newPiece, Pieces.left(p), Pieces.up(p), Pieces.down(p), Pieces.right(p));
            return(newPiece);
        }
コード例 #2
0
 //-- Sets the directions appropriately for a goal piece or origin piece.
 public int setGoalDirections(int p, Coordinates c)
 {
     p = Pieces.setDirections(p, (c.y() == this.height - 1), (c.y() == 0), (c.x() == this.width - 1), (c.x() == 0));
     //-- I decided diagonals on the goal piece made it too easy, but I'll keep the code in case I add levels or something.
     //if (c.y()==0) p = Pieces.setDiagonals(p,false,false,true,true);
     //if (c.x()==0) p = Pieces.setDiagonals(p,false,true,false,true);
     //if (c.y()==this.getHeight()-1) p = Pieces.setDiagonals(p,true,true,false,false);
     //if (c.x()==this.getWidth()-1) p = Pieces.setDiagonals(p ,true,false,true,false);
     return(p);
 }
コード例 #3
0
        // Static method for creating a piece (which is of course actually an integer)
        public static int createPiece(bool up, bool down, bool left, bool right, bool silver, bool gold, int pieceNumber, int personNumber, int houseNumber)
        {
            int p = 0;

            p  = Pieces.setDirections(p, up, down, left, right);
            p  = Pieces.setCoins(p, silver, gold);
            p |= (pieceNumber << 6);
            p |= (personNumber << 12);
            p |= (houseNumber << 15);
            return(p);
        }