예제 #1
0
        /*
         * private static bool isFieldFree(BoardSquare to)
         * {
         *  if (to.getCurrentObject() is None)
         *  {
         *      return true;
         *  }
         *
         *  return false;
         * }
         */


        public int executeMove()
        {
            if (valid)
            {
                BoardObject co = from.takeCurrentObject();
                to.setCurrentObject(co);
                int reutrnedfours = board.findFours();
                if (reutrnedfours == 1)
                {
                    from.setCurrentObject(co);
                    to.takeCurrentObject();
                    return(1);
                }
                //board.toggleTurnOwner();
                board.setLastMove(this);
                board.isThrees(to);

                return(0);
            }
            else
            {
                //throw new InvalidMoveExecutionException("Invalid move execution requested :(.");
            }
            return(-1);
        }
예제 #2
0
        public BoardObject takeCurrentObject()
        {
            BoardObject co = currentObject;

            currentObject = new None();
            return(co);
        }
예제 #3
0
 public int setCurrentObject(BoardObject currentObject)
 {
     try
     {
         if (this.currentObject is None)
         {
             this.currentObject = currentObject;
             return(1);
         }
         else
         {
             return(2);
             // throw new PawnOverrideException("Existing object override requested... row: " + this.getRowCoord() + " column: " + this.getColumnCoord());
         }
     }
     catch (PawnOverrideException ex)
     {
         // System.Console.WriteLine(ex.Message);
     }
     return(0);
 }
예제 #4
0
 public BoardSquare(int rowCoord, int columnCoord)
 {
     this.rowCoord      = rowCoord;
     this.columnCoord   = columnCoord;
     this.currentObject = new None();
 }