示例#1
0
        public static void CalcNotepadPlayer(object obj)
        {
            Random        ran = new Random();
            int           NotepadBehavior;
            NotepadPlayer user = (NotepadPlayer)obj;

            List <int> SaveIntList = new List <int>();

            for (int i = 0; i < 100; i++)
            {
                if (MainList.ReturnMainCount(user.Name) <= 0)
                {
                    //Console.WriteLine($"NotepadPlayer:{MainList.ReturnMainCount(user.Name)}");
                    break;
                }
                else
                {
                    NotepadBehavior = ran.Next(40, 140);

                    foreach (var item in SaveIntList)
                    {
                        if (item == NotepadBehavior)
                        {
                            while (item == NotepadBehavior)
                            {
                                NotepadBehavior = ran.Next(40, 140);
                            }
                        }
                    }
                    if (user.StepFinish == NotepadBehavior)
                    {
                        //Console.BackgroundColor = ConsoleColor.Red;
                        //Console.ForegroundColor = ConsoleColor.White;
                        //Console.WriteLine($"Lucky{user.Name}[Step:{i}] {NotepadBehavior} = {Convert.ToInt32(user.StepFinish)}");
                        //Console.ResetColor();
                        MainList.ChangeStepFinishPlayer(user.Name, i);
                        MainList.SetMainCount(); //set MainCount = 0 if somebody win
                        break;
                    }
                    else
                    {
                        HistoryListLogic.AddHistory(new HistoryList(_historyRow: NotepadBehavior, _namePlayer: user.Name));
                    }
                    // else Console.WriteLine($"({user.Name}[Step:{i}] {NotepadBehavior} != {Convert.ToInt32(user.StepFinish)}");

                    MainList.ChangeMainCount();
                    SaveIntList.Add(NotepadBehavior);
                }
            }
        }
        public static void CalcSimplePlayer(object obj)
        {
            Random       ran = new Random();
            int          SimbleBehavior;
            SimplePlayer user = (SimplePlayer)obj;

            for (int i = 0; i < 100; i++)
            {
                if (MainList.ReturnMainCount(user.Name) <= 0)
                {
                    //Console.WriteLine($"SimplePlayer:{MainList.ReturnMainCount(user.Name)}");
                    break;
                }
                else
                {
                    SimbleBehavior = ran.Next(40, 140);
                    if (user.StepFinish == SimbleBehavior)
                    {
                        //Console.BackgroundColor = ConsoleColor.Red;
                        //Console.ForegroundColor = ConsoleColor.White;
                        //Console.WriteLine($"Lucky{user.Name}[Step:{i}] {SimbleBehavior} = {Convert.ToInt32(user.StepFinish)}");
                        //Console.ResetColor();
                        MainList.ChangeStepFinishPlayer(user.Name, i);
                        MainList.SetMainCount(); //set MainCount = 0 if somebody win
                        break;
                    }
                    else
                    {
                        HistoryListLogic.AddHistory(new HistoryList(_historyRow: SimbleBehavior, _namePlayer: user.Name));
                    }


                    MainList.ChangeMainCount();
                    // else Console.WriteLine($"({user.Name}[Step:{i}] {SimbleBehavior} != {Convert.ToInt32(user.StepFinish)}");
                }
            }
        }
        public static void CalcUberPlayer(object obj)
        {
            int        UberBehavior, step = 0;
            UberPlayer user = (UberPlayer)obj;

            for (int i = 40; i < 141; i++)
            {
                if (MainList.ReturnMainCount(user.Name) <= 0)
                {
                    //Console.WriteLine($"UberPlayer:{MainList.ReturnMainCount(user.Name)}");
                    break;
                }
                else
                {
                    UberBehavior = i;
                    if (user.StepFinish == UberBehavior)
                    {
                        //Console.BackgroundColor = ConsoleColor.Red;
                        //Console.ForegroundColor = ConsoleColor.White;
                        //Console.WriteLine($"Lucky{user.Name}[Step:{step}] {UberBehavior} = {Convert.ToInt32(user.StepFinish)}");
                        //Console.ResetColor();
                        MainList.ChangeStepFinishPlayer(user.Name, step);
                        MainList.SetMainCount(); //set MainCount = 0 if somebody win
                        break;
                    }
                    else
                    {
                        HistoryListLogic.AddHistory(new HistoryList(_historyRow: UberBehavior, _namePlayer: user.Name));
                    }
                    //else Console.WriteLine($"({user.Name}[Step:{step}] {ChiterBehavior} != {Convert.ToInt32(user.StepFinish)}");

                    MainList.ChangeMainCount();
                    step++;
                }
            }
        }