正在加载图片...
The resulting strategy plays Eye-for-Eye against each opponent, and then calls the combining procedure on the two results. If either of the two two-player strategies has returned"", then the three-player strategy will also return"d Here's another example. This call to make-combined-strategies returns a three-player strategy that plays Eye-for-Eye against one opponent, Egalitarian against another, and chooses randomly between the two results: (make-combined-strated Eye-for-Eye Egalitarian (lambda (rl r2)(if(=(random 2)0)r1 r2)) Problem 12 A natural idea in creating a prisoner's dilemma strategy is to try and deduce what kind of strategies the other players might be using. In this problem, we will implement a simple version of this idea The underlying idea is to keep track of how the strategy for one player correlates with the decisions of the other two players on the previous round (of course, you can imagine generalizing this to several previous rounds ) Thus, we want to build an intermediary data structure which keeps track of what player-0 did, correlated with what the other two players did, over the course of the histories for the three players. Imagine creating a procedure that takes three histories as arguments: call them hist-0, hist-1 and hist-2 The idea is that we wish to characterize the strategy of the player responsible for hist-o Given this is a three player game, there are three possible situations we need to keep track of: what did player-0 do on one round when the two other players both cooperated on the previous round; what did player-0 do on one round when one of the others cooperated and the other defected on the previous round; and what did player-0 do on one round when both other players defected on the previous round. Since these three situations will occur multiple times, we want to keep track of how often in each case did player-0 cooperate, and how often did she defect in response to these choices, and how often did each of these three cases occur(although that could be found by adding the number of times player-0 cooperated and defected Thus, you should design and implement a data structure called a history-summary, with the overall structure shown in Figure 1. The history-summary has three subpieces, one for the case where both player-I and player-2 cooperated, one for when one of them cooperated and the other defected, and a third for when both of these players defected This means that your data abstraction for a history-summary should have three selectors, for these three pieces. For each piece, there is another data structure that keeps track of the number of times player-0 cooperated on the next round, the number of times she defected, and the total number of examples(though as we noted, this is redundant) You may find it convenient to think of this as a kind of tree structure. Thus, your first task is to design constructors and selectors to implement this multilevel abstractionThe resulting strategy plays Eye-for-Eye against each opponent, and then calls the combining procedure on the two results. If either of the two two-player strategies has returned “d”, then the three-player strategy will also return “d”. Here's another example. This call to make-combined-strategies returns a three-player strategy that plays Eye-for-Eye against one opponent, Egalitarian against another, and chooses randomly between the two results: (make-combined-strategies Eye-for-Eye Egalitarian (lambda (r1 r2) (if (= (random 2) 0) r1 r2))) Problem 12 A natural idea in creating a prisoner's dilemma strategy is to try and deduce what kind of strategies the other players might be using. In this problem, we will implement a simple version of this idea. The underlying idea is to keep track of how the strategy for one player correlates with the decisions of the other two players on the previous round (of course, you can imagine generalizing this to several previous rounds). Thus, we want to build an intermediary data structure which keeps track of what player-0 did, correlated with what the other two players did, over the course of the histories for the three players. Imagine creating a procedure that takes three histories as arguments: call them hist-0, hist-1 and hist-2. The idea is that we wish to characterize the strategy of the player responsible for hist-0. Given this is a three player game, there are three possible situations we need to keep track of: what did player-0 do on one round when the two other players both cooperated on the previous round; what did player-0 do on one round when one of the others cooperated and the other defected on the previous round; and what did player-0 do on one round when both other players defected on the previous round. Since these three situations will occur multiple times, we want to keep track of how often in each case did player-0 cooperate, and how often did she defect in response to these choices, and how often did each of these three cases occur (although that could be found by adding the number of times player-0 cooperated and defected). Thus, you should design and implement a data structure called a history-summary, with the overall structure shown in Figure 1. The history-summary has three subpieces, one for the case where both player-1 and player-2 cooperated, one for when one of them cooperated and the other defected, and a third for when both of these players defected. This means that your data abstraction for a history-summary should have three selectors, for these three pieces. For each piece, there is another data structure that keeps track of the number of times player-0 cooperated on the next round, the number of times she defected, and the total number of examples (though as we noted, this is redundant). You may find it convenient to think of this as a kind of tree structure. Thus, your first task is to design constructors and selectors to implement this multilevel abstraction
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有