A-Lounsbury / pysimultaneous

A class for handling simultaneous games with any number of players
0 stars 0 forks source link

Fix computeBestResponses/isBestReponse function(s) #22

Closed A-Lounsbury closed 3 months ago

A-Lounsbury commented 3 months ago

This test

krmodel = [
    [
        [[2, 12], [5, 6], [9, 0]],
        [[0, 24], [19, 5], [10, 10]],
        [[1, 3], [7, 5], [5, 25]],
    ]
]

G = SimGame(2)
G.enterData(2, [3, 3], krmodel)
G.print()
print()
G.printBestResponses()

outputs

2, 12   5, 6   9, 0 
0, 24   19, 5   10, 10 
1, 3   7, 5   5, 25    

1, 1   0, 0   0, 0     
0, 1   1, 0   1, 1     
0, 0   0, 0   0, 1

Expected output is

2, 12   5, 6   9, 0 
0, 24   19, 5   10, 10 
1, 3   7, 5   5, 25    

1, 1   0, 0   0, 0     
0, 1   1, 0   1, 0     
0, 0   0, 0   0, 1
A-Lounsbury commented 3 months ago

Fixed. Was accessing self.payoffMatrix[0][profile[1]][j].getListNode(1).payoff instead of self.payoffMatrix[0][profile[0]][j].getListNode(1).payoff.