def push(self, g_n, h_n, cell: Cell, parent: Optional[Cell]): co_ordinates = cell.get_co_ordinates() if (co_ordinates not in self.closed) and (co_ordinates not in self.heap_co_ords): self.heap.append(Element(g_n, h_n, cell, parent)) self.heap_co_ords.add(cell.get_co_ordinates()) self.heapsort()
def print_path(path, mazevis, algo_name, start: Cell, end: Cell): count = 0 for cell in path[:-1]: if cell.get_co_ordinates() not in [ start.get_co_ordinates(), end.get_co_ordinates() ]: mazevis.fill_cell(cell.row, cell.col) count += 1 print("Total {} moves are: {} \n".format(algo_name, count))