我改了,可它依旧没有运行。我的run_machine_game代码明明只有print(1)
时间: 2024-02-28 21:57:51 浏览: 23
你可以检查一下是否有其他错误导致程序无法运行。你可以在代码中加入一些调试语句,如:
```python
if __name__ == '__main__':
print("main process start")
wg = WordGuessing()
print("WordGuessing instance created")
player_thread = Process(target=wg.run_player_game)
print("player_thread created")
machine_thread = Process(target=wg.run_machine_game)
print("machine_thread created")
player_thread.start()
print("player_thread started")
machine_thread.start()
print("machine_thread started")
player_thread.join()
print("player_thread finished")
machine_thread.join()
print("machine_thread finished")
```
这样可以输出一些信息,看看程序运行到哪里出了问题。另外,你可以尝试在 run_machine_game() 函数中加入一些其他的语句,比如:
```python
def run_machine_game():
print("machine game start")
print(1)
print("machine game end")
```
这样也可以帮助你确定问题所在。
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)