tonyx / PrisonerDilemmaFsharp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

strategy should be aweare of the position of player in the game

tonyx opened this issue · comments

consider the titForTat strategy:

let (titForTatStrategy:Strategy) =
    fun (history: JointMove list) ->
        match history with
        | [] -> Cooperate
        | H::_ -> H.Player2Move

It should copy the last opponent move, but what it actually does is copying player2 move, so it does it meant to do only when the opponenti is player2. i.e. the player moving is player1.

fixed: (can actually copy the move of the opponent now)

let (titForTatStrategy:Strategy) =
fun (myHistory: Move list) (opponentHistory: Move list) ->
match opponentHistory with
| [] -> Cooperate
| H::_ -> H