#OK to post homework #Lucy Martinez, 01-30-22, Assignment 2 restart:read `C2.txt`: read `C3.txt`: #######Problem 2:####### # Random Game 1: G1:=Rand2PlayerGame(3,3,2); BR1v(G1[1]); [{2}, {1, 3}, {2}] BR2v(G1[1]); [{1}, {1}, {3}] #Random Game 2: G2:=Rand2PlayerGame(3,3,2); BR1v(G2[1]); [{1}, {2}, {2}] BR2v(G2[1]); [{3}, {1}, {1}] #Random Game 3: G3:=Rand2PlayerGame(3,3,2); BR1v(G3[1]); [{1, 2, 3}, {1}, {2}] BR2v(G3[1]); [{1, 3}, {1, 2}, {2}] #Random Game 4: G4:=Rand2PlayerGame(3,3,2); BR1v(G4[1]); [{3}, {3}, {2}] BR2v(G4[1]); [{2, 3}, {1, 2, 3}, {1}] #Random Game 5: G5:=Rand2PlayerGame(3,3,2); BR1v(G5[1]); [{1}, {1, 2}, {1, 2, 3}] BR2v(G5[1]); [{3}, {1}, {1}] #######Problem 4:####### IsNash:=proc(G,a1,a2) if a1 in BR1(G,a2) and a2 in BR2(G,a1) then RETURN(true); else RETURN(false); fi; end proc: #######Problem 5:####### ##This prints out the set of nash equilibria of the given matrix PureNashEqui:=proc(G) local i,j,S: S:={}: for i from 1 to nops(G) do for j from 1 to nops(G[1]) do if i in BR1(G,j) and j in BR2(G,i) then S:=S union {G[i][j]}; else S:=S; fi; od: od: S: end proc: #Generate 5 random 2-player games where Player Row has 10 strategies, and Player Column has 12 strategies, and for each find their set of (pure) Nash Equilibria #Random Game 1: G6:=Rand2PlayerGame(10,12,3); PureNashEqui(G6[1]); {[2, 2], [3, 3]} #Random Game 2: G7:=Rand2PlayerGame(10,12,4); PureNashEqui(G7[1]); {[4, 4]} #Random Game 3: G8:=Rand2PlayerGame(10,12,4); PureNashEqui(G8[1]); {[3, 4], [4, 3], [4, 4]} #Random Game 4: G9:=Rand2PlayerGame(10,12,2); PureNashEqui(G9[1]); {[1, 2], [2, 2]} #Random Game 5: G10:=Rand2PlayerGame(10,10,3); PureNashEqui(G10[1]); {[2, 3], [3, 3]}