public List <AppliedWingsOutcome> Get()
 {
     if (_tokens.All(x => x.FaceUp.Type != TokenSideType.Wings))
     {
         return(new List <AppliedWingsOutcome> {
             new AppliedWingsOutcome
             {
                 Outcome = _outcome,
                 Tokens = _tokens
             }
         });
     }
     return(_tokens
            .Where(token => token.FaceUp.Type == TokenSideType.Wings)
            .SelectMany(wings => _tokens
                        .SelectMany(token =>
     {
         if (token == wings)
         {
             return new WingsApplication(_tokens.Without(wings).ToList(),
                                         _outcome.With(new RawTokenResult {
                 Type = RawTokenType.OpenWings
             })).Get();
         }
         var clone = _tokens.Without(wings).ToList();
         var index = clone.IndexOf(token);
         clone = clone.Select(x => x.Clone()).ToList();
         clone[index] = clone[index].Flip();
         return new WingsApplication(clone, _outcome).Get();
     }))
            .WithoutDuplicates()
            .ToList());
 }
Esempio n. 2
0
        public RawOutcome Get()
        {
            var result = _outcome.Clone();

            _tokens.Where(x => _typeMap.ContainsKey(x.FaceUp.Type))
            .ForEach(x => result = _outcome.With(new RawTokenResult
            {
                Type     = _typeMap[x.FaceUp.Type],
                Quantity = x.FaceUp.Quantity
            }));
            return(result);
        }
     public List <RawOutcome> Get()
     {
         if (_tactics == 0)
         {
             return new List <RawOutcome> {
                        _outcome
             }
         }
         ;
         if (!_outcome.Tokens.Any(x => _tacticsApplicableType.Contains(x.Type)))
         {
             return(new TacticsApplication(_outcome.With(new RawTokenResult {
                 Type = RawTokenType.OpenTactics
             }), _tactics - 1).Get());
         }
         return(_outcome.Tokens
                .Where(x => _tacticsApplicableType.Contains(x.Type))
                .SelectMany(x => new TacticsApplication(_outcome.With(x.TacticsClone()), _tactics - 1).Get())
                .WithoutDuplicates()
                .ToList());
     }
 }
Esempio n. 4
0
     public List <RawOutcome> Get()
     {
         if (_doubles == 0)
         {
             return new List <RawOutcome> {
                        _outcome
             }
         }
         ;
         if (!_outcome.Tokens.Any(x => _doubleApplicableType.Contains(x.Type) && !x.WasDoubled && !x.WasTactics))
         {
             return(new DoubleApplication(_outcome.With(new RawTokenResult {
                 Type = RawTokenType.OpenDouble
             }), _doubles - 1).Get());
         }
         return(_outcome.Tokens
                .Where(x => _doubleApplicableType.Contains(x.Type) && !x.WasDoubled && !x.WasTactics)
                .SelectMany(x => new DoubleApplication(_outcome.Without(x).With(x.DoubleClone()), _doubles - 1).Get())
                .WithoutDuplicates()
                .ToList());
     }
 }