|
@@ -1,33 +1,29 @@
|
|
|
import numpy as np
|
|
|
import playerConfig
|
|
|
+from itertools import product
|
|
|
|
|
|
|
|
|
class Player():
|
|
|
+
|
|
|
def __init__(self):
|
|
|
return
|
|
|
|
|
|
def Step(self,step=0,own_state=[],known_state_opponent=[]):
|
|
|
chaos = 5-step
|
|
|
+ own_state_array = np.array(own_state)
|
|
|
|
|
|
- if chaos <= 0:
|
|
|
- score=((np.array(own_state)-np.array(known_state_opponent))*playerConfig.Weights).sum()
|
|
|
- if score>0:
|
|
|
- return playerConfig.ACT
|
|
|
- return playerConfig.PASS
|
|
|
+ our_first_card = range((known_state_opponent[0]-chaos) * int(known_state_opponent[0]-chaos >= 0), known_state_opponent[0]+1)
|
|
|
+ our_second_card = range((known_state_opponent[1]-chaos) * int(known_state_opponent[1]-chaos >= 0), known_state_opponent[1]+1)
|
|
|
+ our_third_card = range((known_state_opponent[2]-chaos) * int(known_state_opponent[2]-chaos >= 0), known_state_opponent[2]+1)
|
|
|
+ our_fourth_card = range((known_state_opponent[3]-chaos) * int(known_state_opponent[3]-chaos >= 0), known_state_opponent[3]+1)
|
|
|
|
|
|
+ result = int(((own_state_array-np.array(known_state_opponent))*playerConfig.Weights).sum() > 0)
|
|
|
+ itts = 1
|
|
|
+ for combination in product(our_first_card, our_second_card, our_third_card, our_fourth_card):
|
|
|
+ result += int(((own_state_array-np.array(combination))*playerConfig.Weights).sum() > 0)
|
|
|
+ itts += 1
|
|
|
|
|
|
- our_first_card = range(known_state_opponent[0]-chaos if known_state_opponent[0]-chaos > 0 else 0, known_state_opponent[0]+1)
|
|
|
- our_second_card = range(known_state_opponent[1]-chaos if known_state_opponent[1]-chaos > 0 else 0, known_state_opponent[1]+1)
|
|
|
- our_third_card = range(known_state_opponent[2]-chaos if known_state_opponent[2]-chaos > 0 else 0, known_state_opponent[2]+1)
|
|
|
- our_fourth_card = range(known_state_opponent[3]-chaos if known_state_opponent[3]-chaos > 0 else 0, known_state_opponent[3]+1)
|
|
|
- print(our_first_card, our_second_card, our_fourth_card, our_third_card)
|
|
|
- our_results = []
|
|
|
- for first in our_first_card:
|
|
|
- for second in our_second_card:
|
|
|
- for third in our_third_card:
|
|
|
- for fourth in our_fourth_card:
|
|
|
- our_results.append(((np.array(own_state)-np.array([first, second, third, fourth]))*playerConfig.Weights).sum() > 0)
|
|
|
- our_prob = (our_results.count(True) / len(our_results))*100
|
|
|
+ our_prob = (result / itts) * 100
|
|
|
|
|
|
if our_prob > 70:
|
|
|
return playerConfig.ACT
|