Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
 // CONSTRUCTOR
 public ReversiGame()
 {
     board       = new ReversiBoard();
     currentTurn = 'B';
     enemyTurn   = 'W';
 }