#NEWLINE# def generate_speaks_for_debater( debater , is_forfeit = False ) : #NEWLINE# #INDENT# '\n    Generates a fake speak for a debater chosen from a normal distribution\n    centered on a speak value determined by the hash of the debaters name. This\n    ensures that each debater speaks differently, but they tend to speak the\n    same as themselves.\n\n    Arguments:\n    debater (Debater model) -- A debater who has a name\n    is_forfeit (boolean) -- Whether a forfeit occurred\n\n    Returns:\n    speaks (int) -- A number in speak_range (23-27) that the debater spoke,\n                    unless there was a forfeit in which case 0.0\n    ' #NEWLINE# if is_forfeit : #NEWLINE# #INDENT# return 0.0 #NEWLINE# #UNINDENT# debater_average = ( hash ( debater . name ) % len ( speak_range ) ) #NEWLINE# sampled_speak = int ( random . gauss ( debater_average , 2 ) ) #NEWLINE# sampled_speak = max ( min ( sampled_speak , ( len ( speak_range ) - 1 ) ) , 0 ) #NEWLINE# return speak_range [ sampled_speak ]