Beispiel #1
0
        public void SameSeedReturnsSameListTest()
        {
            var listShuffle1 = ListShuffle.SeededShuffle(sampleList, 3);
            var listShuffle2 = ListShuffle.SeededShuffle(sampleList, 3);

            Assert.AreEqual(listShuffle1, listShuffle2);
        }
Beispiel #2
0
        public void DifferentSeedReturnsDifferentListTest()
        {
            var listShuffle1 = ListShuffle.SeededShuffle(sampleList, 1);
            var listShuffle2 = ListShuffle.SeededShuffle(sampleList, 2);

            Assert.AreNotEqual(listShuffle1, listShuffle2);
        }
Beispiel #3
0
        public void Shuffle_list()
        {
            var test_datas = new int[] { 1, 2, 3, 4, 5, 6, 7, 8 };
            var result     = ListShuffle.Shuffle_list(test_datas.ToArray()).ToList();

            CollectionAssert.AreEquivalent(test_datas, result);
            CollectionAssert.AreNotEqual(test_datas, result);
        }
Beispiel #4
0
        public ActionResult GetWordByTypeAndNumber(int type, int number)
        {
            List <Verb> Verbs = Repository.GetWordByTypeAndNumber(type, number);

            Verbs         = ListShuffle.Shuffle(Verbs);
            ViewBag.Title = number + " Random";
            return(View("ChineseToJapanese", Verbs));
        }
Beispiel #5
0
        public ActionResult VoiceToChineseWordWrong(int type)
        {
            List <Verb> Verbs = Repository.GetVoiceToChineseWordWrong(type);

            Verbs         = ListShuffle.Shuffle(Verbs);
            ViewBag.Title = "Wrong Random";
            return(View("VoiceToChinese", Verbs));
        }
Beispiel #6
0
        public ActionResult VoiceToChineseTodayRandom(int type)
        {
            List <Verb> Verbs = Repository.GetOneDayWordByType(DateTime.Today, type);

            Verbs         = ListShuffle.Shuffle(Verbs);
            ViewBag.Title = "Today Random";
            return(View("VoiceToChinese", Verbs));
        }
Beispiel #7
0
        public ActionResult VoiceToChineseAllRandom(int type)
        {
            List <Verb> Verbs = Repository.GetAllWordByType(type);

            Verbs         = ListShuffle.Shuffle(Verbs);
            ViewBag.Title = "All Random";
            return(View("VoiceToChinese", Verbs));
        }
Beispiel #8
0
        public ActionResult VoiceToChineseSelectOneDayRandom(DateTime date, int type)
        {
            List <Verb> Verbs = Repository.GetOneDayWordByType(date, type);

            Verbs         = ListShuffle.Shuffle(Verbs);
            ViewBag.date  = date.ToShortDateString();
            ViewBag.Title = date.ToShortDateString() + " Random";
            return(View("VoiceToChinese", Verbs));
        }
Beispiel #9
0
        private void LoadContent()
        {
            IEnumerable <Card> cards;

            var cardsList = numberDBLevel.DbLevelRecord.Cards.ToList();

            cardsList = new ListShuffle <Card>().Shuffle(cardsList);

            for (int i = 0; i < cardsList.Count; i++)
            {
                CardUnit c = new CardUnit(this, cardsList[i], Settings.GetInstance().CardSize);
                UnitsCol.AddUnit(c);
            }
        }
Beispiel #10
0
        public void ShuffledListIsDifferentFromOriginalListTest()
        {
            var listShuffle1 = ListShuffle.SeededShuffle(sampleList);

            Assert.AreNotEqual(sampleList, listShuffle1);
        }
Beispiel #11
0
        private void NextUnit()
        {
            if (IsAborted)
            {
                return;
            }
            Panel.SetZIndex(Game.Owner.WrapPanelMain, 30000);

            if (UnitsCol.GetNewUnits().Count > 0)
            {
                Game.Owner.WrapPanelMain.Children.Clear();
                UnitsCol.Shuffle(Game.RandomGenerator);
                var AllUnitsShuffled = new ListShuffle <CardUnit>().Shuffle(UnitsCol.GetAllUnits());
                foreach (var u in AllUnitsShuffled)
                {
                    if (u.GetComponent <HaveBox>() != null)
                    {
                        u.GetComponent <HaveBox>().RemoveFromBox();
                        u.Components.Remove("HaveBox");
                    }
                    HaveBox HB = new HaveBox("HaveBox", Game.Owner, Game.Owner.WrapPanelMain, u);
                }



                foreach (var u in UnitsCol.GetAllUnits())
                {
                    u.GetComponent <CardShower>().Show(() => { ReadyToNextUnit = true; });
                    u.GetComponent <Hit>().IsHited = false;
                    u.readyToReactionOnMouseDown   = true;
                    Panel.SetZIndex(u.GetComponent <HaveBody>().Body, 33000);
                }

                if (CurUnit == null)
                {
                    List <CardUnit> newUnitsShuffled = new ListShuffle <CardUnit>().Shuffle(UnitsCol.GetNewUnits());
                    CurUnit = newUnitsShuffled[0]; //UnitsCol.GetNewUnits().First();
                }
                Speak(Settings.GetInstance().FirstQuestionText + CurUnit.Card.SoundedText);

                needSpeakAgain = true;
                needFlash      = true;

                speakAgainTimer = new Timer(SpeakAgain, null, (int)(1000 * Settings.GetInstance().SpeakAgainCardNameDelay), (int)(1000 * Settings.GetInstance().SpeakAgainCardNameTimePeriod));

                if (Settings.GetInstance().VisualHintEnable)
                {
                    if (Settings.GetInstance().EducationModeEnable)
                    {
                        flashTimer = new Timer(Flash, null, (int)(1000 * Settings.GetInstance().EducationVisualHintDelay), (int)(1000 * Settings.GetInstance().EducationVisualHintTimePeriod));
                    }
                    else
                    {
                        flashTimer = new Timer(Flash, null, (int)(1000 * Settings.GetInstance().VisualHintDelay), (int)(1000 * Settings.GetInstance().VisualHintTimePeriod));
                    }
                }


                SetNewCurCardPassing();

                Game.Owner.TextForCardTag.Text = "Тема: " + this.Name + ".  Надо показать: " + CurUnit.Card.Title;
            }
            else
            {
                SceneEnded(this, (CardsNewDBLevel)Level);
            }
        }