/// <summary>
    /// This procedure contains the user code. Input parameters are provided as regular arguments,
    /// Output parameters as ref arguments. You don't have to assign output parameters,
    /// they will have a default value.
    /// </summary>


    private void RunScript(List <object> Goals, bool Reset, bool Step, ref object A, ref object B, ref object C, ref object D, ref object E, ref object F)
    {
        // <Custom code>
        if (Reset)
        {
            PS      = new KangarooSolver.PhysicalSystem();
            counter = 0;
            GoalList.Clear();
            foreach (IGoal G in Goals)      //Assign indexes to the particles in each Goal:
            {
                PS.AssignPIndex(G, 0.0001); // the second argument is the tolerance distance below which points combine into a single particle
                GoalList.Add(G);
            }
        }
        if (Step)
        {
            PS.SimpleStep(GoalList);
            counter++;
        }


        A = PS.GetOutput(GoalList);
        B = counter;
        C = PS.GetAllMoves(GoalList);
        D = PS.GetAllWeightings(GoalList);
        E = PS.GetPositionArray();

        var Names = new List <String> [PS.ParticleCount()];

        for (int i = 0; i < PS.ParticleCount(); i++)
        {
            Names[i] = new List <String>();
        }

        for (int i = 0; i < GoalList.Count; i++)
        {
            var  FullName = GoalList[i].ToString();
            Char splitter = '.';
            var  Name     = FullName.Split(splitter);
            if (Name[0] != "KangarooSolver")
            {
                Name = FullName.Split('_', '+');
            }
            var G = GoalList[i] as IGoal;

            for (int j = 0; j < G.PIndex.Count(); j++)
            {
                Names[G.PIndex[j]].Add(Name[2]);
            }
        }


        F = Names;
        // </Custom code>
    }
示例#2
0
        protected override Task LastPartOfSetUpBeforeBindingsAsync()
        {
            if (_model !.Deck1 !.CardExists(1))
            {
                throw new BasicBlankException("The first card cannot be in the deck");
            }

            PlayerList !.ForEach(thisPlayer =>
            {
                thisPlayer.KeeperList.Clear();
            });
            SaveRoot !.GoalList.Clear();
            SaveRoot.QueList.Clear(); //i think.
            SaveRoot.SavedActionData.TempDiscardList.Clear();
            SaveRoot.SavedActionData.TempHandList.Clear();
            SaveRoot.SavedActionData.SelectedIndex = -1;
            SaveRoot.CurrentAction = 0;
            SaveRoot.RuleList.Clear();
            SaveRoot.RuleList.Add((RuleCard)_gameContainer.DeckList !.GetSpecificItem(1));
            LastStepAll();
            return(base.LastPartOfSetUpBeforeBindingsAsync());
        }
    /// <summary>
    /// This procedure contains the user code. Input parameters are provided as regular arguments,
    /// Output parameters as ref arguments. You don't have to assign output parameters,
    /// they will have a default value.
    /// </summary>
    private void RunScript(List <object> Goals, bool Reset, bool Step, ref object A, ref object B)
    {
        if (Reset)
        {
            PS      = new KangarooSolver.PhysicalSystem();
            counter = 0;
            GoalList.Clear();
            foreach (IGoal G in Goals)      //Assign indexes to the particles in each Goal:
            {
                PS.AssignPIndex(G, 0.0001); // the second argument is the tolerance distance below which points combine into a single particle
                GoalList.Add(G);
            }
        }
        if (Step)
        {
            PS.Step(GoalList, true, 1);
            counter++;
        }

        A = PS.GetOutput(GoalList);
        B = counter;
    }