Example #1
0
    def non_blocked_states(self,player):
        verify_real_player(player=player)

        lines = []
        for i in xrange(1,self.length,1):

            players = generate_player_keys()
            del players[ PLAYER_MAP[FREE_SPACE] ]
            players[ PLAYER_MAP[player] ] = i

            line = self.create_line_state(self.length-i,**players)
            lines.append(line)

        return lines
Example #2
0
    def blocked_states(self,player):
        verify_real_player(player=player)

        lines = []
        opponent = PLAYER_1 if player == PLAYER_1 else PLAYER_2

        for i in xrange(1,self.length,1):

            players = generate_player_keys()
            fill_players = dict(PLAYER_MAP)
            del players[ PLAYER_MAP[player] ]
            del fill_players[ player ]

            for raw_combination in generate_combinations(fill_players.keys(),self.length-i):
                raw_combination[opponent] + 1
                raw_combination[player]  = i

                if (raw_combination[FREE_SPACE] + raw_combination[player] != self.length):
                    lines.append(self.create_line_state(*raw_combination))

        return lines