Named fields around GC

This commit is contained in:
Magdalena Wilczynska 2019-06-05 19:08:08 +02:00
parent 7d80f5c05f
commit d9fc9e1384

View File

@ -3,7 +3,7 @@ from config import MAP_NAME, GRID_WIDTH, GRID_HEIGHT, GC_X, GC_Y
from VowpalWabbit.VowpalWrapper import wrapper
#const
RADIUS = 2
RADIUS = 1
##
COORDINATES_LIST = []
@ -95,11 +95,12 @@ def pass_input(position):
def get_gc_area(position, radius):
area = []
for x in range(max(0, position[0] - radius), min(position[0] + radius + 1, GRID_WIDTH)): #prevents giong abroad
upper_right_coord = [position[0] - radius, position[1] - radius]
for x in range(max(0, position[0] - radius), min(position[0] + radius + 1, GRID_WIDTH)): #prevents going abroad
for y in range(max(0, position[1] - radius), min(position[1] + radius + 1, GRID_HEIGHT)):
if([x,y] == position): #we dont need gc data here
continue
area.append(MAP_CONTENT[y][x]+"("+str(x)+","+str(y)+")")
area.append("F"+str(x - upper_right_coord[0])+str(y - upper_right_coord[1])+":"+MAP_CONTENT[y][x]) #CHANGE MAP CONTENT TO THE CODE OF AN OBJECT HERE
return area
def check_position(position, i):