Esempio n. 1
0
    public void Debug_RebuildSourdoughSet()
    {
        StudySet setSD = library.setSourdough;

        // Remove all terms from Sourdough set.
        for (int i = setSD.allTermGs.Count - 1; i >= 0; --i)
        {
            setSD.RemoveTerm(setSD.allTermGs[i]);
        }
        // Now just refill it like normal.
        RefillSourdoughSet();
    }
Esempio n. 2
0
    public void MoveTermToSet(Term term, StudySet newSet)
    {
        // Swap its set.
        StudySet prevSet = term.mySet;

        prevSet.RemoveTerm(term.myGuid);
        newSet.AddTerm(term.myGuid);
        // If it's not a main set, then also attempt to remove from the remix sets.
        if (!newSet.canIncludeMeInRemixes)
        {
            library.RemoveTermFromRemixSets(term.myGuid);
        }
        // Save!
        SaveStudySetLibrary();
    }
Esempio n. 3
0
    // ----------------------------------------------------------------
    //  Sourdough Handling
    // ----------------------------------------------------------------
    public void RefillSourdoughSet()
    {
        // FIRST, update the terms in the sourdough set!
        StudySet      setSD      = library.setSourdough;
        List <string> termsLeave = new List <string>();
        List <string> termsStay  = new List <string>();

        foreach (string termG in setSD.allTermGs)
        {
            if (setSD.pileNoG.Contains(termG) ||
                setSD.pileQueueG.Contains(termG))
            {
                termsStay.Add(termG);
            }
            else
            {
                termsLeave.Add(termG);
            }
        }
        foreach (string termG in termsLeave)
        {
            library.GetTerm(termG).nSDLeaves++;
        }
        foreach (string termG in termsStay)
        {
            library.GetTerm(termG).nSDStays++;
        }
        // Remove the yes-ed terms entirely from the set!
        for (int i = 0; i < termsLeave.Count; i++)
        {
            setSD.RemoveTerm(termsLeave[i]);
        }

        // Refill the holes!
        int numToAdd = SourdoughMaxTerms - setSD.allTermGs.Count;
        // Make a safe copy-list of all terms!
        List <Term> allTerms = library.GetOnlyMainTerms();

        // Remove terms that are gonna STAY in Sourdough from the all-terms list, so we don't accidentally add the same ones again.
        for (int i = 0; i < termsStay.Count; i++)
        {
            Term term = library.GetTerm(termsStay[i]);
            allTerms.Remove(term);
        }
        // Shuffle them all, then sort them by sourdough wins.
        GameUtils.Shuffle(allTerms);
        //allTerms = allTerms.OrderBy(c => c.yToNPlusRatio).ToList(); // TEST! Put the hard ones in first.
        allTerms = allTerms.OrderBy(c => c.nSDLeaves).ToList();

        // Add the right amount to the set.
        for (int i = 0; i < numToAdd && i < allTerms.Count; i++)
        {
            setSD.AddTerm(allTerms[i].myGuid);
        }
        setSD.ShuffleAndRestartDeck();

        // Save library
        SaveStudySetLibrary();

        // Finally, save WHEN we last refilled (now)!
        SaveStorage.SetDateTime(SaveKeys.SourdoughTimeLastRefilled, DateTime.Now);
    }
Esempio n. 4
0
 public void RemoveTermFromRemixSets(string termG)
 {
     setSourdough.RemoveTerm(termG);
     setToughies.RemoveTerm(termG);
 }