def __init__(self, droid_id, location, goodness_boolean, debug=False): self.ID = droid_id self.EMPs = 2 self.current_location = location # Is this droid good or evil? True refers to good droid, False refers to bad droid self.is_good = goodness_boolean # Is this droid alive? True refers to droid is alive. False refers to droid is dead. # ONLY GOOD DROIDS CAN DIE self.is_alive = True # Is this droid active? True refers to active droid. False refers to droid that has been stunned. # ONLY BAD DROIDS CAN BE STUNNED self.is_active = True # CODERPAD SECTION self.debug = debug droid_client = DroidClient() if not debug: droid_client.scan() droid_client.connect_to_droid(droid_id) self.droid_client = droid_client
from client import DroidClient droid = DroidClient() droid.scan()
G = [[False, False, False, False, False], [False, False, True, False, True], [False, True, False, False, False], [False, False, False, True, False], [True, False, False, False, False], [False, False, True, False, False], [True, False, False, False, False], [False, False, False, False, False]] # connect to Sphero droid = DroidClient() droid.scan() droid.connect_to_droid('D2-6F8D') # droid.connect_to_R2D2() enemy = DroidClient() enemy.scan() enemy.connect_to_droid('Q5-8CC0') # get course, find path #G = courses.grid_1 agent_pos = (0, 0) enemy_pos = (7, 2) goal = (7, 4)