#NEWLINE# def test_strategy( self ) : #NEWLINE# #INDENT# 'If opponent defects at any point then the player will defect\n        forever.' #NEWLINE# self . responses_test ( [ ] , [ ] , [ C ] , attrs = { #NEWLINE# #INDENT# 'grudged' : False , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . responses_test ( [ C ] , [ C ] , [ C ] , attrs = { #NEWLINE# #INDENT# 'grudged' : False , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . responses_test ( [ C , C ] , [ C , C ] , [ C ] , attrs = { #NEWLINE# #INDENT# 'grudged' : False , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . responses_test ( [ C , C , C ] , [ C , C , D ] , [ C ] , attrs = { #NEWLINE# #INDENT# 'grudged' : False , #NEWLINE# #UNINDENT# } ) #NEWLINE# self . responses_test ( [ C , C , C , C ] , [ C , C , D , D ] , [ D ] , attrs = { #NEWLINE# #INDENT# 'grudged' : True , #NEWLINE# #UNINDENT# } ) #NEWLINE# mem_length = self . player ( ) . mem_length #NEWLINE# for i in range ( ( mem_length - 1 ) ) : #NEWLINE# #INDENT# self . responses_test ( ( [ C , C , C , C ] + ( [ D ] * mem_length ) ) , ( [ C , C , D , D ] + ( [ D ] * i ) ) , [ D ] , attrs = { #NEWLINE# #INDENT# 'grudged' : True , #NEWLINE# 'grudge_memory' : i , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# i = ( mem_length + 1 ) #NEWLINE# self . responses_test ( ( [ C , C , C , C ] + ( [ D ] * i ) ) , ( [ C , C , D , D ] + ( [ C ] * i ) ) , [ C ] , attrs = { #NEWLINE# #INDENT# 'grudged' : False , #NEWLINE# 'grudge_memory' : 0 , #NEWLINE# #UNINDENT# } )