while table.can_move(): print("\n Pick a move(wsad)") usrInput = getch.getch() if usrInput in ('q','Q'): break if table.check_user_input(usrInput) is not True: continue table.make_move(usrInput) if table.is_goal(): break if table.free_list != [] and table.flag == 1: table.pick_grid() if flag == 0: table.pick_grid() flag = 1 table.flag = 0 os.system('clear') print("===========================================================") print(title) print("===========================================================\n") table.print_table() print("score : %s" %table.score)