예제 #1
0
        public int Score( IGrid<Player> board, Player player )
        {
            var result = 0;

            foreach ( var p in board.AllPositions() )
            {
                var owner = board[p];

                if ( owner != null )
                {
                    var factor = owner == player ? 1 : -1;
                    var weight = Weight( board, p );

                    result = result + factor * weight;
                }
            }

            return result;
        }