//private Card BestChoice4(List<MoveValue> probabilityPoints) { // Model.Deck bestDeck; // var bestProbability = probabilityPoints.Max(x => x.VictoryProbability); // var bestCards = probabilityPoints.Where(x => x.VictoryProbability == bestProbability).ToArray(); // if (bestProbability > 0) // bestDeck = bestCards.OrderByDescending(x => x.EstimatedPoints).Take(1).First().Deck; // else // bestDeck = bestCards.OrderBy(x => x.EstimatedPoints).Take(1).First().Deck; // return bestDeck.Last(); //} //private MoveValue EvaluateTurno4(StrategyCalculator strategyCalculator, Model.Deck dish, bool iWinBeforeLastCard) { // var result = new MoveValue(); // result.Deck = dish; // result.EstimatedPoints = dish.GetPoints(); // var iWin = _league.Contains(strategyCalculator.Winner(dish)); // if (iWin) // { // // Vittoria // result.VictoryProbability = (decimal)0.9; // // Vittoria senza briscola // if (dish.All(x => x.Seed != strategyCalculator.Briscola.Seed)) // result.VictoryProbability = 1; // // Vittoria con spreco di briscola // if (dish.Last().Seed == strategyCalculator.Briscola.Seed && iWinBeforeLastCard) // result.VictoryProbability = (decimal)0.8; // } // else // { // result.VictoryProbability = (decimal)-0.9; // // Perdita con spreco di briscola // if (dish.Last().Seed == strategyCalculator.Briscola.Seed) // result.VictoryProbability = -1; // } // return result; //} //private IPlayer GetMyPartner(IPlayer player, GameState state) //{ // Debug.Assert(state.Players.Count == 4); // var ioIndex = Array.IndexOf(state.Players.ToArray(), player); // var partnerIndex = (ioIndex + 2) % 4; // return state.Players.ElementAt(partnerIndex); //} private void SetLeagueComponents(int turn, IEnumerable <IPlayer> players) { if (_league.Count == 0) { switch (turn) { case 0: case 2: _league.Add(players.ElementAt(0)); _league.Add(players.ElementAt(2)); break; case 1: case 3: _league.Add(players.ElementAt(1)); _league.Add(players.ElementAt(3)); break; } } }
public ActionResult Create(League model) { League.Add(model); return(RedirectToAction("Index")); }