/* * 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); }
public BoardObject takeCurrentObject() { BoardObject co = currentObject; currentObject = new None(); return(co); }
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); }
public BoardSquare(int rowCoord, int columnCoord) { this.rowCoord = rowCoord; this.columnCoord = columnCoord; this.currentObject = new None(); }