Example #1
0

def solve_position(start_pos, board, depth=5):
  max_score = 0
  solution_path = None
  solution_combos = None

  for p in recurse_paths(start_pos, depth=depth, board=board):
    b = board.copy()
    combos = b.runpath(p).get_all_combos()
    score = score_solution(p, combos, None)

    if score > max_score:
      max_score = score
      solution_path = p
      solution_combos = combos

  return {
      'score': max_score,
      'path': solution_path,
      'combos': solution_combos
    }

if __name__ == '__main__':
  from models import Board
  board = Board.random_board(1)
  solutions = solve_board_multithreaded(board, depth=3, workers=1)

  from pprint import pprint
  pprint(solutions)
  print board