17 lines
456 B
Python
17 lines
456 B
Python
from typing import List, Any, 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
|