Example #1
0
        public override (List <Vector2Int> movements, List <Vector2Int> enemies) Movements()
        {
            var(movements, enemies) = AMovement(PiecesManager.GetOccupied(), PiecesManager.GetDimensions(), 1);
            var otherTeam    = team.Equals(Team.White) ? Team.Black : Team.White;
            var validVectors = PiecesManager.GetValidVectors();

            // Movements following check rules
            var(movementsOther, enemiesOther) = PiecesManager.AllMovements(otherTeam);
            var movementsValid = movements.Except(movementsOther).Intersect(validVectors).ToList();

            // Verifies check or checkmate
            _check     = enemiesOther.Contains(poss);
            _checkmate = _check && movementsValid.Count <= 0;

            return(movementsValid, enemies);
        }
Example #2
0
        public override (List <Vector2Int> movements, List <Vector2Int> enemies) Movements()
        {
            var occupied   = PiecesManager.GetOccupied(team);
            var dimensions = PiecesManager.GetDimensions();

            var function = new Vector2Int(1, 2);

            var(positives, enemies1) = KnightMovement(occupied, function, dimensions);

            function = new Vector2Int(2, 1);
            var(negatives, enemies2) = KnightMovement(occupied, function, dimensions);

            var movements = positives.Concat(negatives).ToList();
            var enemies   = enemies1.Concat(enemies2).ToList();

            return(movements, enemies);
        }
Example #3
0
 public override (List <Vector2Int> movements, List <Vector2Int> enemies) MovementsForCheck()
 {
     return(AMovement(PiecesManager.GetOccupied(), PiecesManager.GetDimensions(), 1));
 }