public List <Point> getSupportingAllies(char piece, Point origin) { List <Point> neighboringPoints = ReversiBoard.getNeighboringPoints(); List <Point> supportingAllies = new List <Point>(); foreach (Point neighbor in neighboringPoints) { if (hasAlliesFromPointInDirection(piece, origin, neighbor)) { Point ally = getAllyFromPointWithDirection(piece, origin, neighbor); supportingAllies.Add(ally); } } return(supportingAllies); }
public Boolean hasNeighboringEnemyAt(char enemy, Point origin) { List <Point> neighboringPoints = ReversiBoard.getNeighboringPoints(); foreach (Point neighbor in neighboringPoints) { Point point = origin.add(neighbor); if (point.x < board.GetLength(0) && point.y < board.GetLength(1) && point.x >= 0 && point.y >= 0 && at(point) == enemy) { return(true); } } return(false); }
// CONSTRUCTOR public ReversiGame() { board = new ReversiBoard(); currentTurn = 'B'; enemyTurn = 'W'; }