Ejemplo n.º 1
0
        private static int ScoreWindow(TicTacToeGame game, TokenWindow <TicTacToeToken> tokenWindow, Player <TicTacToeToken> player)
        {
            Player <TicTacToeToken> otherPlayer = game.GetOtherPlayer(player);

            TicTacToeToken playerToken      = player.Token;
            TicTacToeToken otherPlayerToken = otherPlayer.Token;

            int score = 0;

            {
                Coordinate center = new Coordinate(game.Width / 2 + 1, game.Height / 2 + 1);
                if (tokenWindow.Pairs.Any(pair => pair.Item1 == center && pair.Item2 == playerToken))
                {
                    score += 10;
                }
            }

            return(score);
        }