Exemple #1
0
    public void NewGameWithRobotAsWhite()
    {
        OnGameModeChanged?.Invoke(GameMode.HumanToRobot);
        OnPlayerColorChanged?.Invoke(ChipColor.White);

        robot.Enable(ChipColor.Black);
        model.NewGame();
    }
Exemple #2
0
        //Test robot mode (black)
        static void Test2()
        {
            ReversiModel model = new ReversiModel();
            RandomUser   robot = new RandomUser(model);

            model.SwitchMove += (s, ea) => { Console.WriteLine("Switch move {0}", ea.CurrentPlayerColor); };
            model.SwitchMove += (s, ea) =>
            {
                Console.WriteLine(ea.AllowedCells.Count);
                foreach (Cell cell in ea.AllowedCells)
                {
                    Console.WriteLine("{0} {1}", cell.X, cell.Y);
                }
            };

            robot.Enable(Color.White);

            model.NewGame();

            while (true)
            {
                int x = int.Parse(Console.ReadLine());
                int y = int.Parse(Console.ReadLine());
                model.PutChip(x, y);
            }
        }
Exemple #3
0
        //Test robot mode (playing for color you want)
        static void Test3(Color userColor)
        {
            ReversiModel model = new ReversiModel();
            RandomUser   robot = new RandomUser(model);

            model.NewGameStarted += (s, ea) => { Console.WriteLine("Game started."); };
            model.SwitchMove     += (s, ea) => { Console.WriteLine("Switch move {0}", ea.CurrentPlayerColor); };
            model.SwitchMove     += (s, ea) =>
            {
                Console.WriteLine(ea.AllowedCells.Count);
                foreach (Cell cell in ea.AllowedCells)
                {
                    Console.WriteLine("{0} {1}", cell.X, cell.Y);
                }
            };

            Color robotColor;

            if (userColor == Color.Black)
            {
                robotColor = Color.White;
            }
            else
            {
                robotColor = Color.Black;
            }

            robot.Enable(robotColor);

            model.NewGame();

            while (true)
            {
                int x = int.Parse(Console.ReadLine());
                int y = int.Parse(Console.ReadLine());
                model.PutChip(x, y);
            }
        }