From kjahds@kjahds.com Fri Apr 19 11:32:25 1996 Date: Fri, 19 Apr 1996 11:32:03 -0400 (EDT) From: Kenneth Albanowski To: perl-journal-contest@perl.com Subject: Perl Prisoners Dilemma Contest Submission Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII # Written by Kenneth Albanowski # Submitted by Kenneth Albanowski # Technique: Apply a gestalt technique to the Three-Way Prisoners Dilemma # # Explanation: The lowest (best) score possible in the TWPD is accessible # only if you consistently testify against your friends, and they # consistently hold out. This gives you a low score (possibly the lowest # one), and them quite a large one. # # The key therefore is to a) guarantee that there are friends that will # always hold out, and b) that other strategies that consistently testify # won't be able to make use of your compatriots. # # A is solved via a gestalt technique: several contest entries working with # each other to obtain scores that are not obtainable by a single entry. # This has been accomplished by recruiting folks who decided did not enter # their own entries in the contest, and asking them to submit this entry. # (Note that collusion among authors was not ruled out.) All entries (as # originally designed) should be identical, save for one entry that has the # "we_are_master" flag set. # # If, when the gestalt strategy runs, the "we_are_master" flag is set, then # it will consistently testify -- except for it's sixth response, where it # will hold out. The master is not affected at all by the responses of it's # friends. # # If the "we_are_master" flag is not set, then this is a "slave" entry, and # it will attempt to deduce whether it is competing against the "master" # entry, to solve B -- this is accomplished by looking at the pattern of # responsed from both friends. If either deviates from the known responses # of the master, then it is known to not be the master. If neither friend is # the master, then the slave will only respond with testify, thus increasing # the non-gestalt competitors points as much as possible. # # On the other hand, if the slave decides that either of it's friends is the # master entry (or at least has not seen any information to the contrary), # then it will always respond by holding out, thus producing the lowest score for # the master. # # Note the important corollary: by lowering the master's score, the slave's # scores are increased, indeed, it is not intended for any slave to win. # Only the master can win. But it can only win _because_ the slaves are # sacrified. # # # The rules of this contest were unclear on who or what precisely wins. They # say: # # * The winning strategy will be the one with the lowest cumulative # score over all matches. # # This does not say whether the strategy needs to be a particular entry, or # whether it can be the sort of meta-strategy that this gestalt embodies. I # would like to argue that everybody who sent in this gestalt entry has won, # not just the author, as such multiple entries are an implicit part of the # strategy. # # - Ken sub gestalt_ken { my ($my_choices_ref, $friend1_choices_ref, $friend2_choices_ref) = @_; my (@my_choices) = @$my_choices_ref; my (@friend1_choices) = @$friend1_choices_ref; my (@friend2_choices) = @$friend2_choices_ref; my($we_are_master) = 1; if($we_are_master) { return @my_choices==5?"H":"T"; } if(@my_choices == 0) { return "H"; } my($i,$fail1,$fail2); $fail1=$fail2=0; for($i=0;$i<@friend1_choices;$i++) { if($i==5 and $friend1_choices[$i] ne "H") { $fail1=1; last; } if($i!=5 and $friend1_choices[$i] ne "T") { $fail1=1; last; } } if($fail1) { for($i=0;$i<@friend2_choices;$i++) { if($i==5 and $friend2_choices[$i] ne "H") { $fail2=1; last; } if($i!=5 and $friend2_choices[$i] ne "T") { $fail2=1; last; } } if($fail2) { return "T"; } } return "H"; } __END__ -- Kenneth Albanowski (kjahds@kjahds.com, CIS: 70705,126)