예제 #1
0
    // Create a RepFR open-stim word list from specified lists of words to be
    // repeated and list of words to use once.
    public static StimWordList Generate(
        List <RepWordList> repeats,
        RepWordList singles,
        bool do_stim,
        double top_percent_spaced = 0.2)
    {
        if (do_stim)
        {
            // Open-loop stim assigned here.
            foreach (var rw in repeats)
            {
                AssignRandomStim(rw);
            }
            AssignRandomStim(singles);
        }

        StimWordList prepared_words = SpreadWords(repeats, top_percent_spaced);

        foreach (var word_stim in singles)
        {
            int insert_at = InterfaceManager.rnd.Next(prepared_words.Count + 1);
            prepared_words.Insert(insert_at, word_stim);
        }

        return(prepared_words);
    }
예제 #2
0
 public static void AssignRandomStim(RepWordList rw)
 {
     for (int i = 0; i < rw.Count; i++)
     {
         bool stim = Convert.ToBoolean(InterfaceManager.rnd.Next(2));
         rw.SetStim(i, stim);
     }
 }
예제 #3
0
    // Create a RepFR open-stim word list from a list of repetitions and counts,
    // and a list of candidate words.
    public static StimWordList Generate(
        RepCounts rep_cnts,
        List <string> input_words,
        bool do_stim,
        double top_percent_spaced = 0.2)
    {
        var shuffled = Shuffle(input_words);

        var repeats = new List <RepWordList>();
        var singles = new RepWordList();

        var shuf = new BoundedInt(shuffled.Count,
                                  "Words required exceeded input word list size.");

        foreach (var rc in rep_cnts)
        {
            if (rc.rep == 1)
            {
                for (int i = 0; i < rc.count; i++)
                {
                    singles.Add(shuffled[shuf.i++]);
                }
            }
            else if (rc.rep > 1 && rc.count > 0)
            {
                var rep_words = new RepWordList(rc.rep);
                for (int i = 0; i < rc.count; i++)
                {
                    rep_words.Add(shuffled[shuf.i++]);
                }
                repeats.Add(rep_words);
            }
        }

        return(Generate(repeats, singles, do_stim, top_percent_spaced));
    }