1__author__ = 'Tom Schaul, tom@idsia.ch'
2
3from random import choice
4
5from .randomplayer import RandomGomokuPlayer
6
7
8class KillingGomokuPlayer(RandomGomokuPlayer):
9    """ do random moves, but always instant-kill if possible. """
10    def getAction(self):
11        p = self.game.getKilling(self.color)
12        if len(p) > 0:
13            return [self.color, choice(p)]
14        else:
15            return RandomGomokuPlayer.getAction(self)