public PlayersAI() { this.Action = PlayerAction.CheckOrCall(); this.initialHandStrength = new InitialHandStrengthEvaluator(); this.bestHandStrenght = new BestHandEvaluator(); this.probabilityEvaluator = new ProbabilityEvaluator(); this.decisionMaker = new DecisionMaker(); }
public void OnLoad() { if (!string.IsNullOrEmpty(serializedDecisionMaker)) { DecisionMaker = serialize.Deserialize<DecisionMaker>(serializedDecisionMaker); } else { DecisionMaker = null; } }
private DecisionTree AddByValue(DecisionTree decision, BoundConstantPattern value, DecisionMaker makeDecision) { if (decision.MatchIsComplete) { return null; } // Even if value.ConstantValue == null, we proceed here for error recovery, so that the case label isn't // dropped on the floor. That is useful, for example to suppress unreachable code warnings on bad case labels. switch (decision.Kind) { case DecisionTree.DecisionKind.ByType: return AddByValue((DecisionTree.ByType)decision, value, makeDecision); case DecisionTree.DecisionKind.ByValue: return AddByValue((DecisionTree.ByValue)decision, value, makeDecision); case DecisionTree.DecisionKind.Guarded: return AddByValue((DecisionTree.Guarded)decision, value, makeDecision); default: throw ExceptionUtilities.UnexpectedValue(decision.Kind); } }
protected DecisionTree Add(DecisionTree decision, DecisionMaker makeDecision) { if (decision.MatchIsComplete) { return null; } switch (decision.Kind) { case DecisionTree.DecisionKind.ByType: return Add((DecisionTree.ByType)decision, makeDecision); case DecisionTree.DecisionKind.ByValue: return Add((DecisionTree.ByValue)decision, makeDecision); case DecisionTree.DecisionKind.Guarded: return Add((DecisionTree.Guarded)decision, makeDecision); default: throw ExceptionUtilities.UnexpectedValue(decision.Kind); } }
private DecisionTree Add(DecisionTree.ByValue byValue, DecisionMaker makeDecision) { DecisionTree result; if (byValue.Default != null) { result = Add(byValue.Default, makeDecision); } else { result = byValue.Default = makeDecision(byValue.Expression, byValue.Type); } if (byValue.Default.MatchIsComplete) { byValue.MatchIsComplete = true; } return result; }
private DecisionTree AddByValue(DecisionTree.ByType byType, BoundConstantPattern value, DecisionMaker makeDecision) { if (byType.Default != null) { try { return AddByValue(byType.Default, value, makeDecision); } finally { if (byType.Default.MatchIsComplete) { byType.MatchIsComplete = true; } } } if (value.ConstantValue == ConstantValue.Null) { return byType.Expression.ConstantValue?.IsNull == false ? null : AddByNull((DecisionTree)byType, makeDecision); } foreach (var kvp in byType.TypeAndDecision) { var matchedType = kvp.Key; var decision = kvp.Value; // See if the test is already subsumed switch (ExpressionOfTypeMatchesPatternType(value.Value.Type, matchedType, ref _useSiteDiagnostics)) { case true: if (decision.MatchIsComplete) { return null; } continue; case false: case null: continue; } } DecisionTree forType = null; // Find an existing decision tree for the expression's type. Since this new test // should logically be last, we look for the last one we can piggy-back it onto. for (int i = byType.TypeAndDecision.Count - 1; i >= 0 && forType == null; i--) { var kvp = byType.TypeAndDecision[i]; var matchedType = kvp.Key; var decision = kvp.Value; if (matchedType.TupleUnderlyingTypeOrSelf() == value.Value.Type.TupleUnderlyingTypeOrSelf()) { forType = decision; break; } else if (ExpressionOfTypeMatchesPatternType(value.Value.Type, matchedType, ref _useSiteDiagnostics) != false) { break; } } if (forType == null) { var type = value.Value.Type; var localSymbol = new SynthesizedLocal(_enclosingSymbol as MethodSymbol, type, SynthesizedLocalKind.PatternMatchingTemp, Syntax, false, RefKind.None); var narrowedExpression = new BoundLocal(Syntax, localSymbol, null, type); forType = new DecisionTree.ByValue(narrowedExpression, value.Value.Type.TupleUnderlyingTypeOrSelf(), localSymbol); byType.TypeAndDecision.Add(new KeyValuePair<TypeSymbol, DecisionTree>(value.Value.Type, forType)); } return AddByValue(forType, value, makeDecision); }
private DecisionTree AddByValue(DecisionTree.Guarded guarded, BoundExpression value, DecisionMaker makeDecision, bool hasErrors) { if (guarded.Default != null) { if (guarded.Default.MatchIsComplete) { return(null); } } else { guarded.Default = new DecisionTree.ByValue(guarded.Expression, guarded.Type, null); } return(AddByValue(guarded.Default, value, makeDecision, hasErrors)); }
private DecisionTree AddByValue(DecisionTree decision, BoundConstantPattern value, DecisionMaker makeDecision) { if (decision.MatchIsComplete) { return(null); } // Even if value.ConstantValue == null, we proceed here for error recovery, so that the case label isn't // dropped on the floor. That is useful, for example to suppress unreachable code warnings on bad case labels. switch (decision.Kind) { case DecisionTree.DecisionKind.ByType: return(AddByValue((DecisionTree.ByType)decision, value, makeDecision)); case DecisionTree.DecisionKind.ByValue: return(AddByValue((DecisionTree.ByValue)decision, value, makeDecision)); case DecisionTree.DecisionKind.Guarded: return(AddByValue((DecisionTree.Guarded)decision, value, makeDecision)); default: throw ExceptionUtilities.UnexpectedValue(decision.Kind); } }
//Use awake, start is not always called at object creation, leading to null reference errors public void Awake() { HPDECISION = UnityEngine.Random.Range(30, 70); MakeDecision = new DecisionMaker(false); playerDist = new AttributeValue<string>("Player Distance"); bulletClose = new AttributeValue<string>("Bullet Visible"); prevDistDecision = new AttributeValue<string>("Player Distance"); prevBulletDecision = new AttributeValue<string>("Bullet Visible"); prevPlayerHPDecision = new AttributeValue<string>("Player HP"); playerHPDecision = new AttributeValue<string>("Player HP"); prevEnemyAttackedDecision = new AttributeValue<string>("Enemy Has Sight"); enemyAttackedDecision = new AttributeValue<string>("Enemy Has Sight"); chasingDecision = new AttributeValue<string>("Chasing Enemy"); thisHPDecision = new AttributeValue<string>("This HP"); Position = this.transform.position; IsMoving = false; HealthPoints = m_MaxHealth; col2D = this.GetComponent<Collider2D>(); StartPos = transform.position; sprite = this.GetComponent<SpriteRenderer>(); }
private DecisionTree AddByValue(DecisionTree.Guarded guarded, BoundConstantPattern value, DecisionMaker makeDecision) { if (guarded.Default != null) { Debug.Assert(!guarded.Default.MatchIsComplete); // otherwise we would have given a subsumption error } else { // There is no default at this branch of the decision tree, so we create one. // Before the decision tree can match by value, it needs to test if the input is of the required type. // So we create a ByType node to represent that test. guarded.Default = new DecisionTree.ByType(guarded.Expression, guarded.Type, null); } return(AddByValue(guarded.Default, value, makeDecision)); }
private DecisionTree AddByValue(DecisionTree.ByValue byValue, BoundConstantPattern value, DecisionMaker makeDecision) { Debug.Assert(value.Value.Type.Equals(byValue.Type, TypeCompareKind.IgnoreDynamicAndTupleNames)); if (byValue.Default != null) { return(AddByValue(byValue.Default, value, makeDecision)); } Debug.Assert(value.ConstantValue != null); object valueKey = value.ConstantValue.Value; DecisionTree valueDecision; if (byValue.ValueAndDecision.TryGetValue(valueKey, out valueDecision)) { valueDecision = Add(valueDecision, makeDecision); } else { valueDecision = makeDecision(byValue.Expression, byValue.Type); byValue.ValueAndDecision.Add(valueKey, valueDecision); } if (byValue.Type.SpecialType == SpecialType.System_Boolean && byValue.ValueAndDecision.Count == 2 && byValue.ValueAndDecision.Values.All(d => d.MatchIsComplete)) { byValue.MatchIsComplete = true; } return(valueDecision); }
private DecisionTree AddByValue(DecisionTree.Guarded guarded, BoundExpression value, DecisionMaker makeDecision, bool hasErrors) { if (guarded.Default != null) { if (guarded.Default.MatchIsComplete) { return null; } } else { guarded.Default = new DecisionTree.ByValue(guarded.Expression, guarded.Type, null); } return AddByValue(guarded.Default, value, makeDecision, hasErrors); }
private DecisionTree AddByValue(DecisionTree decision, BoundConstantPattern value, DecisionMaker makeDecision) { Debug.Assert(!decision.MatchIsComplete); // otherwise we would have given a subsumption error if (value.ConstantValue == null) { // If value.ConstantValue == null, we have a bad expression in a case label. // The case label is considered unreachable. return(null); } switch (decision.Kind) { case DecisionTree.DecisionKind.ByType: return(AddByValue((DecisionTree.ByType)decision, value, makeDecision)); case DecisionTree.DecisionKind.ByValue: return(AddByValue((DecisionTree.ByValue)decision, value, makeDecision)); case DecisionTree.DecisionKind.Guarded: return(AddByValue((DecisionTree.Guarded)decision, value, makeDecision)); default: throw ExceptionUtilities.UnexpectedValue(decision.Kind); } }
private DecisionTree AddByValue(DecisionTree.ByType byType, BoundConstantPattern value, DecisionMaker makeDecision) { if (byType.Default != null) { try { return(AddByValue(byType.Default, value, makeDecision)); } finally { if (byType.Default.MatchIsComplete) { // This code may be unreachable due to https://github.com/dotnet/roslyn/issues/16878 byType.MatchIsComplete = true; } } } if (value.ConstantValue == ConstantValue.Null) { // This should not occur, as the caller will have invoked AddByNull instead. throw ExceptionUtilities.Unreachable; } if ((object)value.Value.Type == null) { return(null); } foreach (var kvp in byType.TypeAndDecision) { var matchedType = kvp.Key; var decision = kvp.Value; // See if the test is already subsumed switch (ExpressionOfTypeMatchesPatternType(value.Value.Type, matchedType, ref _useSiteDiagnostics)) { case true: if (decision.MatchIsComplete) { return(null); } continue; case false: case null: continue; } } DecisionTree forType = null; // This new type test should logically be last. However it might be the same type as the one that is already // last. In that case we can produce better code by piggy-backing our new case on to the last decision. // Also, the last one might be a non-overlapping type, in which case we can piggy-back onto the second-last // type test. for (int i = byType.TypeAndDecision.Count - 1; i >= 0; i--) { var kvp = byType.TypeAndDecision[i]; var matchedType = kvp.Key; var decision = kvp.Value; if (matchedType.TupleUnderlyingTypeOrSelf() == value.Value.Type.TupleUnderlyingTypeOrSelf()) { forType = decision; break; } else if (ExpressionOfTypeMatchesPatternType(value.Value.Type, matchedType, ref _useSiteDiagnostics) != false) { // because there is overlap, we cannot reuse some earlier entry break; } } // if we did not piggy-back, then create a new decision tree node for the type. if (forType == null) { var type = value.Value.Type; var localSymbol = new SynthesizedLocal(_enclosingSymbol as MethodSymbol, type, SynthesizedLocalKind.PatternMatchingTemp, Syntax, false, RefKind.None); var narrowedExpression = new BoundLocal(Syntax, localSymbol, null, type); forType = new DecisionTree.ByValue(narrowedExpression, value.Value.Type.TupleUnderlyingTypeOrSelf(), localSymbol); byType.TypeAndDecision.Add(new KeyValuePair <TypeSymbol, DecisionTree>(value.Value.Type, forType)); } return(AddByValue(forType, value, makeDecision)); }
private double GetSupportScoreOfDecisionMaker(DecisionMaker decisionMaker, SettlementClaimantPreliminaryDecision annexationDecision, DecisionOutcome possibleOutcome) { throw new NotImplementedException(); }
public void ConstructorTest() { var dm = new DecisionMaker(_ai, _toon, _scheduler); Assert.IsNotNull(dm); }
public MyBot() : base() { this.decision = new DecisionMaker(); }
private DecisionTree AddByValue(DecisionTree.ByType byType, BoundConstantPattern value, DecisionMaker makeDecision) { if (byType.Default != null) { try { return(AddByValue(byType.Default, value, makeDecision)); } finally { if (byType.Default.MatchIsComplete) { // This code may be unreachable due to https://github.com/dotnet/roslyn/issues/16878 byType.MatchIsComplete = true; } } } if (value.ConstantValue == ConstantValue.Null) { // This should not occur, as the caller will have invoked AddByNull instead. throw ExceptionUtilities.Unreachable; } if ((object)value.Value.Type == null || value.ConstantValue == null) { return(null); } foreach (var kvp in byType.TypeAndDecision) { var matchedType = kvp.Key; var decision = kvp.Value; // See if the test is already subsumed switch (ExpressionOfTypeMatchesPatternType(value.Value.Type, matchedType, ref _useSiteDiagnostics)) { case true: if (decision.MatchIsComplete) { // Subsumed case have been eliminated by semantic analysis. Debug.Assert(false); return(null); } continue; case false: case null: continue; } } DecisionTree forType = null; // This new type test should logically be last. However it might be the same type as the one that is already // last. In that case we can produce better code by piggy-backing our new case on to the last decision. // Also, the last one might be a non-overlapping type, in which case we can piggy-back onto the second-last // type test. for (int i = byType.TypeAndDecision.Count - 1; i >= 0; i--) { var kvp = byType.TypeAndDecision[i]; var matchedType = kvp.Key; var decision = kvp.Value; if (matchedType.Equals(value.Value.Type, TypeCompareKind.IgnoreDynamicAndTupleNames)) { forType = decision; break; } switch (ExpressionOfTypeMatchesPatternType(value.Value.Type, matchedType, ref _useSiteDiagnostics)) { case true: if (decision.MatchIsComplete) { // we should have reported this case as subsumed already. Debug.Assert(false); return(null); } else { goto case null; } case false: continue; case null: // because there is overlap, we cannot reuse some earlier entry goto noReuse; } } noReuse :; // if we did not piggy-back, then create a new decision tree node for the type. if (forType == null) { var type = value.Value.Type; if (byType.Type.Equals(type, TypeCompareKind.AllIgnoreOptions)) { // reuse the input expression when we have an equivalent type to reduce the number of generated temps forType = new DecisionTree.ByValue(byType.Expression, type.TupleUnderlyingTypeOrSelf(), null); } else { var narrowedExpression = GetBoundPatternMatchingLocal(type); forType = new DecisionTree.ByValue(narrowedExpression, type.TupleUnderlyingTypeOrSelf(), narrowedExpression.LocalSymbol); } byType.TypeAndDecision.Add(new KeyValuePair <TypeSymbol, DecisionTree>(type, forType)); } return(AddByValue(forType, value, makeDecision)); }
protected virtual void GetFactory(/*DecisionMaker.Items item*/) { //return (DecisionMaker.DecideSQL(item)); DecisionMaker.getInstances(); }
public StrongholdLeader() : base() { _decisionmaker = new DecisionMaker(); }
public StateBehavior(Enum eState) { m_eState = eState; m_tDecisionMaker = new DecisionMaker(); }
private DecisionTree AddByType(DecisionTree.ByType byType, TypeSymbol type, DecisionMaker makeDecision) { if (byType.Default != null) { try { return AddByType(byType.Default, type, makeDecision); } finally { if (byType.Default.MatchIsComplete) { byType.MatchIsComplete = true; } } } foreach (var kvp in byType.TypeAndDecision) { var MatchedType = kvp.Key; var Decision = kvp.Value; // See if matching Type matches this value switch (ExpressionOfTypeMatchesPatternType(type, MatchedType, ref _useSiteDiagnostics)) { case true: if (Decision.MatchIsComplete) { return null; } continue; case false: continue; case null: continue; } } var localSymbol = new SynthesizedLocal(_enclosingSymbol as MethodSymbol, type, SynthesizedLocalKind.PatternMatchingTemp, Syntax, false, RefKind.None); var expression = new BoundLocal(Syntax, localSymbol, null, type); var result = makeDecision(expression, type); Debug.Assert(result.Temp == null); result.Temp = localSymbol; byType.TypeAndDecision.Add(new KeyValuePair<TypeSymbol, DecisionTree>(type, result)); if (ExpressionOfTypeMatchesPatternType(byType.Type, type, ref _useSiteDiagnostics) == true && result.MatchIsComplete && byType.WhenNull?.MatchIsComplete == true) { byType.MatchIsComplete = true; } return result; }
private DecisionTree AddByValue(DecisionTree.ByValue byValue, BoundConstantPattern value, DecisionMaker makeDecision) { Debug.Assert(value.Value.Type == byValue.Type); if (byValue.Default != null) { return AddByValue(byValue.Default, value, makeDecision); } // For error recovery, to avoid "unreachable code" diagnostics when there is a bad case // label, we use the case label itself as the value key. object valueKey = value.ConstantValue?.Value ?? value; DecisionTree valueDecision; if (byValue.ValueAndDecision.TryGetValue(valueKey, out valueDecision)) { valueDecision = Add(valueDecision, makeDecision); } else { valueDecision = makeDecision(byValue.Expression, byValue.Type); byValue.ValueAndDecision.Add(valueKey, valueDecision); } if (byValue.Type.SpecialType == SpecialType.System_Boolean && byValue.ValueAndDecision.Count == 2 && byValue.ValueAndDecision.Values.All(d => d.MatchIsComplete)) { byValue.MatchIsComplete = true; } return valueDecision; }
private DecisionTree AddByNull(DecisionTree.ByType byType, DecisionMaker makeDecision) { if (byType.WhenNull?.MatchIsComplete == true || byType.Default?.MatchIsComplete == true) { return null; } if (byType.Default != null) { try { return AddByNull(byType.Default, makeDecision); } finally { if (byType.Default.MatchIsComplete) { byType.MatchIsComplete = true; } } } DecisionTree result; if (byType.WhenNull == null) { result = byType.WhenNull = makeDecision(byType.Expression, byType.Type); } else { result = Add(byType.WhenNull, makeDecision); } if (byType.WhenNull.MatchIsComplete && NonNullHandled(byType)) { byType.MatchIsComplete = true; } return result; }
private DecisionTree AddByType(DecisionTree decision, TypeSymbol type, DecisionMaker makeDecision) { if (decision.MatchIsComplete || decision.Expression.ConstantValue?.IsNull == true) { return null; } switch (decision.Kind) { case DecisionTree.DecisionKind.ByType: return AddByType((DecisionTree.ByType)decision, type, makeDecision); case DecisionTree.DecisionKind.ByValue: { var byValue = (DecisionTree.ByValue)decision; if (byValue.Default == null) { byValue.Default = makeDecision(byValue.Expression, byValue.Type); if (byValue.Default.MatchIsComplete) { byValue.MatchIsComplete = true; } return byValue.Default; } else { Debug.Assert(byValue.Default.Type == type); return Add(byValue.Default, makeDecision); } } case DecisionTree.DecisionKind.Guarded: return AddByType((DecisionTree.Guarded)decision, type, makeDecision); default: throw ExceptionUtilities.UnexpectedValue(decision.Kind); } }
protected abstract double GetSupportScoreOfDecisionMaker(DecisionMaker decisionMaker, KingdomDecision decision, DecisionOutcome possibleOutcome);
private DecisionTree AddByNull(DecisionTree decision, DecisionMaker makeDecision) { if (decision.MatchIsComplete) { return null; } switch (decision.Kind) { case DecisionTree.DecisionKind.ByType: return AddByNull((DecisionTree.ByType)decision, makeDecision); case DecisionTree.DecisionKind.ByValue: { var byValue = (DecisionTree.ByValue)decision; if (byValue.MatchIsComplete) { return null; } throw ExceptionUtilities.Unreachable; } case DecisionTree.DecisionKind.Guarded: return AddByNull((DecisionTree.Guarded)decision, makeDecision); default: throw ExceptionUtilities.UnexpectedValue(decision.Kind); } }
public void InitializationUsers(List <Expert> experts, Coordinator coordinator, DecisionMaker decisionMaker) { users.Add(decisionMaker); users.Add(coordinator); foreach (var expert in experts) { users.Add(expert); } }
private DecisionTree AddByNull(DecisionTree.Guarded guarded, DecisionMaker makeDecision) { if (guarded.Default == null) { guarded.Default = new DecisionTree.ByType(guarded.Expression, guarded.Type, null); } var result = AddByNull(guarded.Default, makeDecision); if (guarded.Default.MatchIsComplete) { guarded.MatchIsComplete = true; } return result; }
private DecisionTree Add(DecisionTree.Guarded guarded, DecisionMaker makeDecision) { if (guarded.Default != null) { if (guarded.Default.MatchIsComplete) { return null; } var result = Add(guarded.Default, makeDecision); if (guarded.Default.MatchIsComplete) { guarded.MatchIsComplete = true; } return result; } else { var result = guarded.Default = makeDecision(guarded.Expression, guarded.Type); if (guarded.Default.MatchIsComplete) { guarded.MatchIsComplete = true; } return result; } }
private DecisionTree AddByValue(DecisionTree.Guarded guarded, BoundConstantPattern value, DecisionMaker makeDecision) { if (guarded.Default != null) { if (guarded.Default.MatchIsComplete) { return(null); } } else { guarded.Default = new DecisionTree.ByValue(guarded.Expression, guarded.Type, null); } return(AddByValue(guarded.Default, value, makeDecision)); }
private DecisionTree Add(DecisionTree.ByType byType, DecisionMaker makeDecision) { try { if (byType.Default == null) { byType.Default = makeDecision(byType.Expression, byType.Type); return byType.Default; } else { return Add(byType.Default, makeDecision); } } finally { if (byType.Default.MatchIsComplete) { byType.MatchIsComplete = true; } } }
private DecisionTree AddByValue(DecisionTree.ByValue byValue, BoundConstantPattern value, DecisionMaker makeDecision) { Debug.Assert(value.Value.Type == byValue.Type); if (byValue.Default != null) { return(AddByValue(byValue.Default, value, makeDecision)); } // For error recovery, to avoid "unreachable code" diagnostics when there is a bad case // label, we use the case label itself as the value key. object valueKey = value.ConstantValue?.Value ?? value; DecisionTree valueDecision; if (byValue.ValueAndDecision.TryGetValue(valueKey, out valueDecision)) { valueDecision = Add(valueDecision, makeDecision); } else { valueDecision = makeDecision(byValue.Expression, byValue.Type); byValue.ValueAndDecision.Add(valueKey, valueDecision); } if (byValue.Type.SpecialType == SpecialType.System_Boolean && byValue.ValueAndDecision.Count == 2 && byValue.ValueAndDecision.Values.All(d => d.MatchIsComplete)) { byValue.MatchIsComplete = true; } return(valueDecision); }
private DecisionTree AddByValue(DecisionTree.Guarded guarded, BoundConstantPattern value, DecisionMaker makeDecision) { if (guarded.Default != null) { if (guarded.Default.MatchIsComplete) { return null; } } else { guarded.Default = new DecisionTree.ByValue(guarded.Expression, guarded.Type, null); } return AddByValue(guarded.Default, value, makeDecision); }
private DecisionTree AddByValue(DecisionTree.ByType byType, BoundConstantPattern value, DecisionMaker makeDecision) { if (byType.Default != null) { try { return(AddByValue(byType.Default, value, makeDecision)); } finally { if (byType.Default.MatchIsComplete) { byType.MatchIsComplete = true; } } } if (value.ConstantValue == ConstantValue.Null) { return(byType.Expression.ConstantValue?.IsNull == false ? null : AddByNull((DecisionTree)byType, makeDecision)); } foreach (var kvp in byType.TypeAndDecision) { var matchedType = kvp.Key; var decision = kvp.Value; // See if the test is already subsumed switch (ExpressionOfTypeMatchesPatternType(value.Value.Type, matchedType, ref _useSiteDiagnostics)) { case true: if (decision.MatchIsComplete) { return(null); } continue; case false: case null: continue; } } DecisionTree forType = null; // Find an existing decision tree for the expression's type. Since this new test // should logically be last, we look for the last one we can piggy-back it onto. for (int i = byType.TypeAndDecision.Count - 1; i >= 0 && forType == null; i--) { var kvp = byType.TypeAndDecision[i]; var matchedType = kvp.Key; var decision = kvp.Value; if (matchedType.TupleUnderlyingTypeOrSelf() == value.Value.Type.TupleUnderlyingTypeOrSelf()) { forType = decision; break; } else if (ExpressionOfTypeMatchesPatternType(value.Value.Type, matchedType, ref _useSiteDiagnostics) != false) { break; } } if (forType == null) { var type = value.Value.Type; var localSymbol = new SynthesizedLocal(_enclosingSymbol as MethodSymbol, type, SynthesizedLocalKind.PatternMatchingTemp, Syntax, false, RefKind.None); var narrowedExpression = new BoundLocal(Syntax, localSymbol, null, type); forType = new DecisionTree.ByValue(narrowedExpression, value.Value.Type.TupleUnderlyingTypeOrSelf(), localSymbol); byType.TypeAndDecision.Add(new KeyValuePair <TypeSymbol, DecisionTree>(value.Value.Type, forType)); } return(AddByValue(forType, value, makeDecision)); }
private DecisionTree AddByType(DecisionTree.Guarded guarded, TypeSymbol type, DecisionMaker makeDecision) { if (guarded.Default == null) { guarded.Default = new DecisionTree.ByType(guarded.Expression, guarded.Type, null); } var result = AddByType(guarded.Default, type, makeDecision); if (guarded.Default.MatchIsComplete) { guarded.MatchIsComplete = true; } return(result); }
public void InitGameData(int wordLength) { m_gameData = new GameData(wordLength); m_decisionMaker = new Distribution(m_gameData); }