Ejemplo n.º 1
0
 def get_best_moves(self):
     scores = []
     first_empty = simulate.first_empty_row(self.grid)
     
     if first_empty == -1:
         return
         
     if show_debug:
         print("Simulate First empty row",first_empty)
     
     for y in range(len(self.grid)-1, first_empty-1, -1):
         for x in range(len(self.grid[y])-len(self.block[0])+1):
             s = self.try_place(y, x, self.grid)
             if s != None:
                 s.append(self.block)
                 scores.append(s)
                 if show_debug:
                     print("Simulate Printing s")
                     print(s)
     if show_debug:
         print("Simulate These are the scores:")
         for i in scores:
             print(i[0:2])
         print('Simulate This is what is being returned')
         print(final(scores))
         print(scores)
         
     if len(scores) > 0:
         return final(scores, self.mode)
     else:
         return
Ejemplo n.º 2
0
def single_best_move(block, grid, percent_filled):
    if percent_filled < 0.3:
        mode = 0
    else:
        mode = 1
            
    a = []
    for r in block.rotations():
        p = Possible_Moves(grid, r, mode).get_best_moves()
        if p == None: 
            return
        else:
            a.append(p)

    return final(a, mode)