Ejemplo n.º 1
0
def repeated_steep(game_obj):
    x = game_obj.board["x_size"]
    y = game_obj.board["y_size"]
    while game_obj.total_needy > 0:
        turn = game_obj.use_sahc(jittery=False)
        if not turn:
            game_obj.candidate = tools.create_random(x, y)
            game_obj.initialize_neediness()
            game_obj.initialize_impact()
Ejemplo n.º 2
0
    def __init__(self, board, random=False):
        self.board = board
        if random:
            self.candidate = tools.create_random(board["x_size"],
                                                 board["y_size"])
        else:
            self.candidate = tools.create_blank(board["x_size"],
                                                board["y_size"])

        self.initialize_neediness()
        self.initialize_weighting()
        self.initialize_impact()
Ejemplo n.º 3
0
 def __init__(self, board, random=False):
     self.board = board
     if random:
         self.candidate = tools.create_random(board["x_size"], 
                                              board["y_size"])
     else:
         self.candidate = tools.create_blank(board["x_size"], 
                                             board["y_size"])
     
     self.initialize_neediness()
     self.initialize_weighting()
     self.initialize_impact()
Ejemplo n.º 4
0
    def __init__(self, board):
        '''Create the basic objects needed for the search.
        
        self.board is the target board, self.candidate is the current candidate
        to be tested and modified, self.needy is a matrix of how bad a shape each 
        cell is in, self.total_needy is a sum of the values of self.needy, and 
        self.impact is a matrix of how beneficial flipping each cell would be. 
        
        self.minima is used to store known minima for the Pogo algorithm. It is 
        initialized here mostly so I don't have to check for it every time I run 
        use_pogo().
        
        '''

        self.board = board
        self.candidate = tools.create_random(board["x_size"], board["y_size"])
        self.candidate = tools.create_blank(board["x_size"], board["y_size"])
        self.needy, self.total_needy = self.initialize_neediness()
        self.impact = self.initialize_impact()
        self.minima = {}
Ejemplo n.º 5
0
 def __init__(self, board):
 
     '''Create the basic objects needed for the search.
     
     self.board is the target board, self.candidate is the current candidate
     to be tested and modified, self.needy is a matrix of how bad a shape each 
     cell is in, self.total_needy is a sum of the values of self.needy, and 
     self.impact is a matrix of how beneficial flipping each cell would be. 
     
     self.minima is used to store known minima for the Pogo algorithm. It is 
     initialized here mostly so I don't have to check for it every time I run 
     use_pogo().
     
     '''
 
     self.board = board
     self.candidate = tools.create_random(board["x_size"], 
                                              board["y_size"])
     self.candidate = tools.create_blank(board["x_size"], 
                                              board["y_size"])
     self.needy, self.total_needy = self.initialize_neediness()
     self.impact = self.initialize_impact()
     self.minima = {}