コード例 #1
0
ファイル: BranchFunction.cs プロジェクト: dom767/woofractal
        public void Execute(ref WooState state)
        {
            double rand        = state._Random.NextDouble();
            double totalWeight = 0;

            foreach (Expression e in _Weight)
            {
                totalWeight += e.EvaluateFloat(ref state);
            }
            rand *= totalWeight;
            double currentWeight = 0;
            int    i             = 0;

            while (currentWeight < rand)
            {
                currentWeight += _Weight[i++].EvaluateFloat(ref state);
            }
            if (state._Recursions > 0 || !state.GetRule(_Rule[i - 1]).CanRecurse())
            {
                state._Recursions--;
                WooState newState = state.Clone();
                state.GetRule(_Rule[i - 1]).Execute(ref newState);
                state._Recursions++;
            }
        }
コード例 #2
0
 public void Execute(ref WooState state)
 {
     if (state._Recursions == 0)
     {
         state._Recursions--;
         WooState newState = state.Clone();
         state.GetRule(_Callee).Execute(ref newState);
         state._Recursions++;
     }
 }
コード例 #3
0
 public void Execute(ref WooState state)
 {
     if (state._Recursions == 0)
     {
         state._Recursions--;
         WooState newState = state.Clone();
         state.GetRule(_Callee).Execute(ref newState);
         state._Recursions++;
     }
 }
コード例 #4
0
ファイル: BranchFunction.cs プロジェクト: dom767/woofractal
 public void Execute(ref WooState state)
 {
     double rand = state._Random.NextDouble();
     double totalWeight = 0;
     foreach (Expression e in _Weight) totalWeight += e.EvaluateFloat(ref state);
     rand *= totalWeight;
     double currentWeight = 0;
     int i = 0;
     while (currentWeight < rand)
     {
         currentWeight += _Weight[i++].EvaluateFloat(ref state);
     }
     if (state._Recursions > 0 || !state.GetRule(_Rule[i - 1]).CanRecurse())
     {
         state._Recursions--;
         WooState newState = state.Clone();
         state.GetRule(_Rule[i - 1]).Execute(ref newState);
         state._Recursions++;
     }
 }
コード例 #5
0
        public void Execute(ref WooState state)
        {
            WooState newState = state.Clone();

            _RuleBlock.Execute(ref newState);
        }
コード例 #6
0
ファイル: ScopeStatement.cs プロジェクト: dom767/woofractal
 public void Execute(ref WooState state)
 {
     WooState newState = state.Clone();
     _RuleBlock.Execute(ref newState);
 }
コード例 #7
0
 public void Execute(ref WooState state)
 {
     state._PreviousState = state.Clone();
 }
コード例 #8
0
ファイル: PushPopFunction.cs プロジェクト: dom767/woofractal
 public void Execute(ref WooState state)
 {
     state._PreviousState = state.Clone();
 }