import pygame import project_constants as const import json_generator as js import json # Class of our agent, initialization of it # movment functions (those defiend by the 'go_' prefix are not meant to actually move our agent, they just return some values # that are later used by another function called 'is_valid_move' (which is defined in Minefield)); class Agent: def __init__(self, json_path): with open(json_path) as json_data: data = json.load(json_data) self.x, self.y = data['agent_starting_position'].split(",") self.position = [int(self.x), int(self.y)] def go_right(self): return self.position[0] + 1, self.position[1] def go_left(self): return self.position[0] -1, self.position[1] def go_up(self): return self.position[0], self.position[1] - 1 def go_down(self): return self.position[0], self.position[1] + 1