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()
        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]
Exemple #3
0
    def get_action(self, state):
        actions = state.available_moves()

        for a in actions:

            if DSL.containsNumber(a, 5):
                self._counter_calls[0] += 1
                return a

        return actions[0]
    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]
Exemple #5
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]
    def get_action(self, state):
        actions = state.available_moves()
        
        for a in actions:

            if DSL.isStopAction(a) and DSL.hasWonColumn(state,a):
                return a

            if DSL.containsNumber(a, 4) and DSL.isDoubles(a):
                return a

            if DSL.containsNumber(a, 2) and DSL.containsNumber(a, 6):
                return a

            if DSL.containsNumber(a, 2) and DSL.containsNumber(a, 4):
                return a

            if DSL.containsNumber(a, 6) and DSL.containsNumber(a, 4):
                return a

            if DSL.containsNumber(a, 2) and DSL.isDoubles(a):
                return a

            if DSL.containsNumber(a, 6) and DSL.isDoubles(a):
                return a

            if DSL.containsNumber(a, 4):
                return a

            if DSL.containsNumber(a, 2):
                return a

            if DSL.containsNumber(a, 6):
                return a
        
        return actions[0]