#NEWLINE# def build_normalised_scores( self ) : #NEWLINE# #INDENT# "\n        Returns:\n        --------\n\n            The total mean scores per turn per layer for each repetition\n            lengths.  List of the form:\n\n            [ML1, ML2, ML3..., MLn]\n\n            Where n is the number of players and MLi is a list of the form:\n\n            [pi1, pi2, pi3, ..., pim]\n\n            Where m is the number of repetitions and pij is the mean scores per\n            turn obtained by each player in repetition j.\n\n            In Axelrod's original tournament, there were no self-interactions\n            (e.g. player 1 versus player 1) and so these are also ignored.\n        " #NEWLINE# normalised_scores = [ [ [ ] for rep in range ( self . nrepetitions ) ] for _ in range ( self . nplayers ) ] #NEWLINE# for ( rep , inter_dict ) in enumerate ( self . interactions ) : #NEWLINE# #INDENT# for ( index_pair , interactions ) in inter_dict . items ( ) : #NEWLINE# #INDENT# if ( index_pair [ 0 ] != index_pair [ 1 ] ) : #NEWLINE# #INDENT# scores_per_turn = iu . compute_final_score_per_turn ( interactions ) #NEWLINE# for player in range ( 2 ) : #NEWLINE# #INDENT# player_index = index_pair [ player ] #NEWLINE# score_per_turn = scores_per_turn [ player ] #NEWLINE# normalised_scores [ player_index ] [ rep ] . append ( score_per_turn ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# for ( i , rep ) in enumerate ( normalised_scores ) : #NEWLINE# #INDENT# for ( j , player_scores ) in enumerate ( rep ) : #NEWLINE# #INDENT# normalised_scores [ i ] [ j ] = mean ( player_scores ) #NEWLINE# #UNINDENT# #UNINDENT# return normalised_scores