#NEWLINE# def build_cooperating_rating( self ) : #NEWLINE# #INDENT# '\n        Returns:\n        --------\n\n            The list of cooperation counts\n            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 pij is the total number of cooperations divided by the total\n            number of turns over all repetitions played by player i against\n            player j.\n        ' #NEWLINE# plist = list ( range ( self . nplayers ) ) #NEWLINE# total_length_v_opponent = [ zip ( * [ rep [ player_index ] for rep in self . match_lengths ] ) for player_index in plist ] #NEWLINE# lengths = [ [ sum ( e ) for ( j , e ) in enumerate ( row ) if ( i != j ) ] for ( i , row ) in enumerate ( total_length_v_opponent ) ] #NEWLINE# return [ ( sum ( cs ) / max ( 1 , float ( sum ( ls ) ) ) ) for ( cs , ls ) in zip ( self . cooperation , lengths ) ]