使用 Python 进行 Bongo Cat 挂机连点刷分

使用 Python 进行 Bongo Cat 挂机连点刷分 该教程假设你会简单使用 Python。安装依赖pipinstallpynput运行脚本新建一个.py文件并运行。使用说明运行后按 F8 开始刷次数再次按 F8 暂停。按 ESC 退出程序。❗❗❗最好在电脑空闲的时候执行这个程序运行期间不要做其他任务。此外输入法需要改成英文。importtimeimportthreadingfrompynputimportkeyboardfrompynput.keyboardimportController INTERVAL0.03KEY_LISTlist(0123456789abcdefghijklmnopqrstuvwxyz)runningFalseexit_programFalsekbController()threads[]# 每个按键线程defkey_worker(key):globalrunningwhilerunning:ifnotrunning:breakkb.press(key)# 检查退出标志for_inrange(int(INTERVAL*1000//1)):ifnotrunning:kb.release(key)# 确保释放returntime.sleep(0.001)kb.release(key)for_inrange(int(INTERVAL*1000//1)):ifnotrunning:returntime.sleep(0.001)# 启动所有线程defstart_workers():globalthreads threads[]forkeyinKEY_LIST:tthreading.Thread(targetkey_worker,args(key,),daemonTrue)t.start()threads.append(t)# 键盘监听defon_press(key):globalrunning,exit_programifkeykeyboard.Key.f8:ifnotrunning:runningTruestart_workers()print(开始)else:runningFalseprint(停止)elifkeykeyboard.Key.esc:time.sleep(0.1)runningFalseexit_programTrue# 确保退出前释放所有按键forkinKEY_LIST:try:kb.release(k)except:passprint(退出)returnFalseprint(F8 开始 / 停止)print(ESC 退出)withkeyboard.Listener(on_presson_press)aslistener:whilenotexit_program:time.sleep(0.1)效率分析默认使用 36 个按键间隔 0.03 s考虑延时差不多 1s 1000 次。目前最高的 bongo beat 的成就次数是 25,000,000折算下来差不多 7 个小时可以完成这个成就。