Bonus task #3

This commit is contained in:
s442333 2019-11-11 18:56:56 +01:00
parent e2a86074e8
commit 06af8200b6
3 changed files with 29 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
VENV
__pycache__
teg.py

View File

@ -25,3 +25,11 @@ wyplata(2, [1/2,1/2,0], [1/4,3/4], [[0,0],[2,-1],[-1,2]], [[2,2],[0,1],[1,0]] )
wynosi 11/8.
---
#### Zadanie 3:
_zdominowana.py_
Funkcja sprawdzająca, czy jedna strategia jest zdominowana (dla danego gracza w grze 2-osobowej).
---

18
zdominowana.py Executable file
View File

@ -0,0 +1,18 @@
#!VENV/bin/python3
from teg import dominuje, wyplata
#from scipy.optimize import linprog
def zdominowana(player, strategy, payment_matrix_one, payment_matrix_two):
for i in range(0,len(payment_matrix_one if player == 1 else payment_matrix_two[0])):
strategy_check = [0 for p in strategy]
strategy_check[i] = 1
if( strategy == strategy_check ):
continue
if( dominuje(player, strategy_check, strategy, payment_matrix_one, payment_matrix_two ) == True ):
return True
return False
x = zdominowana(2,[1, 0,0],[[0,0,0],[0,0,0]],[[0,1,2],[0,1,2]])
print(x)