def get_action(self, state): actions = state.available_moves() for a in actions: if DSL.isDoubles(a) and DSL.actionWinsColumn(state,a): self._counter_calls[0] += 1 return a if DSL.numberPositionsConquered(state,5)>0 and DSL.containsNumber(a,4): self._counter_calls[1] += 1 return a if DSL.isStopAction(a) and DSL.numberPositionsConquered(state,5)>1 and DSL.containsNumber(a,6): self._counter_calls[2] += 1 return a if DSL.isStopAction(a) and DSL.numberPositionsProgressedThisRoundColumn(state,2)>2 and DSL.isStopAction(a): self._counter_calls[3] += 1 return a if DSL.isStopAction(a): self._counter_calls[4] += 1 return a if DSL.actionWinsColumn(state,a) and DSL.actionWinsColumn(state,a): self._counter_calls[5] += 1 return a if DSL.isStopAction(a): self._counter_calls[6] += 1 return a return actions[0]
def get_action(self, state): actions = state.available_moves() if DSL.isYNAction(actions): if DSL.hasAvailableNeuralMarker(state): return 'y' if DSL.hasWonColumn(state): return 'n' if DSL.continueBecausehighProbNotBust(state): return 'y' return random.choice(actions) else: if DSL.hasAvailableNeuralMarker(state): actions = deepcopy(DSL.actionsUseLessMarker(state, actions)) for a in actions: if DSL.isDoubles(a): return a for a in actions: if DSL.actionWinsColumn(state, a): return a # should be later than detect the already progressed one (use of neutral marker) # newActions = [] # if DSL.hasAvailableNeuralMarker(state): # for a in actions: # if DSL.actionEasyToPrograss(state, a): # newActions.append(a) # if newActions: # actions = deepcopy(newActions) return random.choice(actions)
def get_action(self, state): actions = state.available_moves() print("Actions: ", actions) for a in actions: if DSL.actionWinsColumn(state, a): return a if DSL.isDoubles(a): return a if DSL.containsNumber(a, (6,2)): return a if DSL.isStopAction(a): return a return actions[0]
def get_action(self, state): actions = state.available_moves() for a in actions: if DSL.hasWonColumn(state) and DSL.isStopAction(a): self._counter_calls[0] += 1 return a if DSL.actionWinsColumn(state, a): self._counter_calls[1] += 1 return a return actions[0]
def get_action(self, state): actions = state.available_moves() for a in actions: if DSL.actionWinsColumn(state, a): return a if DSL.isDoubles(a): return a if DSL.containsNumber(a, 6) or DSL.containsNumber(a, 2): if np.random.choice([0, 1], p=[0.6, 0.4]) > 0: return a if DSL.isStopAction(a): # Return 'y' with 70% probability and 'n' with 30% probability. if DSL.hasWonColumn(state, a): return 'n' else: return 'y' return actions[0]
def get_action(self, state): actions = state.available_moves() for a in actions: if DSL.hasWonColumn(state) and DSL.isStopAction(a): self._counter_calls[0] += 1 return a if DSL.actionWinsColumn(state, a) and DSL.hasWonColumn(state): self._counter_calls[1] += 1 return a if DSL.numberPositionsConquered( state, 5) > 2 and DSL.containsNumber(a, 4): self._counter_calls[2] += 1 return a return actions[0]