1234567891011121314151617181920212223242526272829303132333435 |
- 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)
- 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_prob = (result / itts) * 100
- if our_prob > 70:
- return playerConfig.ACT
- if our_prob < 31:
- return playerConfig.PASS
- return playerConfig.LOOK
-
-
|