Example #1
0
        public GameResult MakeFight(ReversiPlayer black, ReversiPlayer white, bool v=true)
        {
            var players = new ReversiPlayer[3]; //[0] won't be used!

            players[GameService.BlackPlayer] = black;
            players[GameService.WhitePlayer] = white;

            var game = new Game();

            GameService.Start(game, _boardSize);

            int player = GameService.BlackPlayer;
            while (game.CurrentPlayer != GameService.NoPlayer)
            {
                try
                {
                    PrintLine(game.AvailableMovesToString(), v);
                    var sw = new Stopwatch();
                    sw.Start();
                    string move = players[player].GetNextMove(game);
                    sw.Stop();
                    PrintLine(sw.ElapsedMilliseconds + " ms", v);
                    GameService.Move(game, move, player);
                    PrintLine(players[player] + @" moves: " + move, v);
                    PrintLine(game.StateToString(), v);
                    player = Switch(player);
                }
                catch (WrongOrderException)
                {
                    player = Switch(player);
                }
            }

            var result = new GameResult(game.GetScore(GameService.BlackPlayer), game.GetScore(GameService.WhitePlayer));

            result.Print();

            return result;
        }
Example #2
0
 public void AddResult(GameResult result)
 {
     _results.Add(result);
 }
Example #3
0
 public void AddResult(GameResult result)
 {
     _results.Add(result);
 }