from typing import Any, List, Tuple OUTPUT_ERROR = -1 OUTPUT_INFO = 0 OUTPUT_DEBUG = 1 OUTPUT_EXTRA_DEBUG = 2 def var_to_grid(array_var: List[Any], size: Tuple[int, int]) -> List[List[Any]]: """convert ownership/policy to grid format such that grid[y][x] is for move with coords x,y""" ix = 0 grid = [[]] * size[1] for y in range(size[1] - 1, -1, -1): grid[y] = array_var[ix : ix + size[0]] ix += size[0] return grid def evaluation_class(points_lost, eval_thresholds): i = 0 while i < len(eval_thresholds) - 1 and points_lost < eval_thresholds[i]: i += 1 return i