private int computeUtility(HexapawnBoard aBoard, string playerToMove) { //int retVal = 0; // if (aBoard.gameLost("W")) // { // if (playerToMove.Equals("W")) // return -1; // } // else if (aBoard.gameLost("B")) // { // if (playerToMove.Equals("W")) // return 1; // } if (aBoard.gameLost("W")) { if (playerToMove.Equals("W")) { return(-1); } } else if (aBoard.gameLost("B")) { if (playerToMove.Equals("B")) { return(1); } } return(0); }
public override bool terminalTest(GameState state) { HexapawnBoard board = (HexapawnBoard)state.get("board"); // bool line = board.lineThroughBoard(); // bool filled = board.getNumberOfMarkedPositions() == 9; // return (line || filled); return(board.gameLost("B") || board.gameLost("W")); }
private int computeUtility(HexapawnBoard aBoard, string playerToMove) { //int retVal = 0; // if (aBoard.gameLost("W")) // { // if (playerToMove.Equals("W")) // return -1; // } // else if (aBoard.gameLost("B")) // { // if (playerToMove.Equals("W")) // return 1; // } if (aBoard.gameLost("W")) { if (playerToMove.Equals("W")) return -1; } else if (aBoard.gameLost("B")) { if (playerToMove.Equals("B")) return 1; } return 0; }