private int OpponentVictoryCheck(GameBoard board, Player player) { int column = -1; if (_difficulty == "hard") { column = board.VictoryCheckSpotCheck(player, true); } else { column = board.VictoryCheckSpotCheck(player, false); } return column; }
public int PickSpot(GameBoard board, Player player) { int moveColumnOpp, moveColumnMy; moveColumnOpp = OpponentVictoryCheck(board, player); moveColumnMy = MyVictoryCheck(board); if (moveColumnMy != -1) { return moveColumnMy; } else if (moveColumnOpp != -1) { return moveColumnOpp; } else { return MyMove(); } }
public int VictoryCheckSpotCheck(Player player, bool hardCheck) { int spot = -1; foreach (BoardSpace b in _board) { if (b.SpaceColor == player.Color) { if (OpenHorizontalCheck(b) || OpenVerticalCheck(b) || OpenDiagonalCheck(b)) { spot = _winningSpots[3].XPos; } if (hardCheck) { if (MidOpenHorizontalCheck(b) || MidOpenVerticalCheck(b) || MidOpenDiagonalCheck(b)) { spot = _winningSpots[2].XPos; } if (MidBackOpenHorizontalCheck(b) || MidBackOpenVerticalCheck(b) || MidBackOpenDiagonalCheck(b)) { spot = _winningSpots[1].XPos; } } } } return spot; }