def get_queen(): nbr_list = hba.get_robot_neighbors() new_nbrs = 0 for nbr in nbr_list: is_queen = hba.get_msg_from_nbr(nbr, new_nbrs)[MSG_STATE] == STATE_QUEEN if is_queen: return nbr return None
def get_nbrs_in_dark(): new_nbrs = 0 nbr_list = hba.get_robot_neighbors() nbrs_in_dark = [] for nbr in nbr_list: state = hba.get_msg_from_nbr(nbr, new_nbrs)[MSG_IDX_STATE] if state == STATE_DARK: nbrs_in_dark.append(nbr) return nbrs_in_dark
def get_nbrs_in_light(): new_nbrs = 0 nbr_list = hba.get_robot_neighbors() nbrs_in_light = [] for nbr in nbr_list: state = hba.get_msg_from_nbr(nbr, new_nbrs)[MSG_IDX_STATE] if state == STATE_LIGHT: nbrs_in_light.append(nbr) return nbrs_in_light