def prompt()

in df_console.py [0:0]


    def prompt(self, prompt_str, batch):
        if self.last_move_idx is not None:
            curr_move_idx = batch["move_idx"][0][0]
            if curr_move_idx - self.last_move_idx == 1:
                self.check(batch)
                self.last_move_idx = curr_move_idx
                return
            else:
                n = sum(self.check_stats.values())
                print("#Move: " + str(n))
                accu = 0
                for i in range(5):
                    accu += self.check_stats[i]
                    print("Top %d: %.3f" % (i, accu / n))
                self.last_move_idx = None

        print(batch.GC.ShowBoard(0))
        # Ask user to choose
        while True:
            if getattr(self, "repeat", 0) > 0:
                self.repeat -= 1
                cmd = self.repeat_cmd
            else:
                cmd = input(prompt_str)
            items = cmd.split()
            if len(items) < 1:
                print("Invalid input")

            reply = dict(pi=None, a=None)

            try:
                if items[0] == 'p':
                    reply["a"] = move2action(items[1])
                    return reply
                elif items[0] == 'c':
                    return self.evaluator.actor(batch)
                elif items[0] == "s":
                    channel_id = int(items[1])
                    plot_plane(batch["s"][0][0][channel_id])
                elif items[0] == "u":
                    batch.GC.UndoMove(0)
                    print(batch.GC.ShowBoard(0))
                elif items[0] == "h":
                    handicap = int(items[1])
                    batch.GC.ApplyHandicap(0, handicap)
                    print(batch.GC.ShowBoard(0))
                elif items[0] == "a":
                    reply = self.evaluator.actor(batch)
                    if "pi" in reply:
                        score, indices = reply["pi"].squeeze().sort(dim=0, descending=True)
                        first_n = int(items[1])
                        for i in range(first_n):
                            print("%s: %.3f" % (action2move(indices[i]), score[i]))
                    else:
                        print("No key \"pi\"")
                elif items[0] == "check":
                    print("Top %d" % self.check(batch))

                elif items[0] == 'check2end':
                    self.check_stats = Counter()
                    self.check(batch)
                    self.last_move_idx = batch["move_idx"][0][0]
                    if len(items) == 2:
                        self.repeat = int(items[1])
                        self.repeat_cmd = "check2end_cont"
                    return

                elif items[0] == "check2end_cont":
                    if not hasattr(self, "check_stats"):
                        self.check_stats = Counter()
                    self.check(batch)
                    self.last_move_idx = batch["move_idx"][0][0]
                    return

                elif items[0] == "aug":
                    print(batch["aug_code"][0][0])
                elif items[0] == "show":
                    print(batch.GC.ShowBoard(0))
                elif items[0] == "dbg":
                    import pdb
                    pdb.set_trace()
                elif items[0] == 'offline_a':
                    if "offline_a" in batch:
                        for i, offline_a in enumerate(batch["offline_a"][0][0]):
                            print("[%d]: %s" % (i, action2move(offline_a)))
                    else:
                        print("No offline_a available!")
                elif items[0] == "exit":
                    self.exit = True
                    return reply
                else:
                    print("Invalid input: " + cmd + ". Please try again")
            except Exception as e:
                print("Something wrong! " + str(e))