internal bool AnyWinningStrategiesUnderNode(StrategyNode node) { if (node.Level == 3) { return(node.WeighPoint.Knowledge.FoundHeavyCoin || node.WeighPoint.Knowledge.FoundLightCoin || node.WeighPoint.Knowledge.AllAreEven); } return (node.IfLeftWins.Any(AnyWinningStrategiesUnderNode) || node.IfRightWins.Any(AnyWinningStrategiesUnderNode) || node.IfEven.Any(AnyWinningStrategiesUnderNode)); }
internal void ExecuteWeighPointOnNode(StrategyNode node) { if (node.Level > 3) { return; } var weighPoint = node.WeighPoint; node.IfLeftWins = GetAllStrategies(weighPoint.SupposeLeftWins(), node /*parentNode*/); node.IfRightWins = GetAllStrategies(weighPoint.SupposeRightWins(), node /*parentNode*/); node.IfEven = GetAllStrategies(weighPoint.SupposeEven(), node /*parentNode*/); }
internal List <StrategyNode> GetAllStrategies(Knowledge knowledge, StrategyNode parentNode = null) { List <StrategyNode> roots = ComputeWeighPoints(knowledge).Select( balance => new StrategyNode(new WeighPoint(knowledge, balance), parentNode) ).ToList(); foreach (var node in roots) { Console.WriteLine($"Execute | {node.Level}"); ExecuteWeighPointOnNode(node); } return(roots); }
internal StrategyNode(WeighPoint weighPoint, StrategyNode parent) { WeighPoint = weighPoint; Parent = parent; }
internal StrategyNode(WeighPoint weighPoint) { WeighPoint = weighPoint; Parent = null; }