(define "P1IsCooperating" (set Var "Choice1" 0)) (define "P1IsDefecting" (set Var "Choice1" 1)) (define "P2IsCooperating" (set Var "Choice2" 0)) (define "P2IsDefecting" (set Var "Choice2" 1)) (define "CooperateP1" (= 0 (var "Choice1"))) (define "DefectP1" (= 1 (var "Choice1"))) (define "CooperateP2" (= 0 (var "Choice2"))) (define "DefectP2" (= 1 (var "Choice2"))) //------------------------------------------------------------------------------ (game "Iterated Prisoners Dilemma" (players 2) (mode Simultaneous) (equipment { (board (square 2)) }) (rules (play (or { (move Select (from 0) P1 (then ("P1IsCooperating"))) (move Select (from 1) P1 (then ("P1IsDefecting"))) (move Select (from 2) P2 (then ("P2IsCooperating"))) (move Select (from 3) P2 (then ("P2IsDefecting"))) } (then (if (and ("CooperateP1") ("CooperateP2")) (and (addScore P1 3) (addScore P2 3)) (if (and ("DefectP1") ("DefectP2")) (and (addScore P1 1) (addScore P2 1)) (if (and ("CooperateP1") ("DefectP2")) (and (addScore P1 0) (addScore P2 5)) (and (addScore P1 5) (addScore P2 0)) ) ) ) applyAfterAllMoves:True ) ) ) (end (if (= (counter) 8) (byScore))) ) ) //------------------------------------------------------------------------------ (metadata (info { (description "The prisoner's dilemma is a standard example of a game analyzed in game theory that shows why two completely rational individuals might not cooperate, even if it appears that it is in their best interests to do so. It was originally framed by Merrill Flood and Melvin Dresher while working at RAND in 1950. Albert W. Tucker formalized the game with prison sentence rewards and named it \"prisoner's dilemma\"") (rules "The dilemma is repeated 10 times: - If the two players are cooperating (C), they get 6 points. - If the two players are defecting (D), they get 2 points. - If one player is cooperating (C) and the other is defecting (D), the first one gets 0 points and the second one gets 10 points. ") (id "1773") (source "Wikipedia") (version "1.3.14") (classification "math") (author "Merrill Flood and Melvin Dresher") (credit "Eric Piette") (date "1950") } ) (graphics { (board colour Phase0 (colour Hidden)) (board colour OuterEdges (colour Black)) (board colour InnerEdges (colour Black)) (show Symbol "C" (sites {0 2})) (show Symbol "D" (sites {1 3})) }) )