还在学习巨蟒的游戏“Othello”中使用了"AI“。https://www.instructables.com/id/Othello-Artificial-Intelligence/有两个版本的游戏-玩家和玩家对AI.我的问题是球员对AI,Othello_game.py。Othello_gui,播放器上的播放器工作没有问题。
错误是:
C:\Users\Joe\Documents\OthelloAI-master\OthelloAI-master> python othello_game.py [erika_5.py] [nathan_ai.py]
Traceback (most recent call last):
File "othello_game.py", line 157, in <module>
player1 = AiPlayerInterface(sys.argv[1],1)
File "othello_game.py", line 36, in __init__
self.process = subprocess.Popen(['python3',filename], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
File "C:\ProgramData\Anaconda3\lib\subprocess.py", line 800, in __init__
restore_signals, start_new_session)
File "C:\ProgramData\Anaconda3\lib\subprocess.py", line 1207, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specifiedinit被编码为:
def __init__(self, filename, color):
self.color = color
self.process = subprocess.Popen(['python3',filename], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
name = self.process.stdout.readline().decode("ASCII").strip()
print("AI introduced itself as: {}".format(name))
self.name = name
self.process.stdin.write((str(color)+"\n").encode("ASCII"))
self.process.stdin.flush()进口说明如下:
import sys
import subprocess
from threading import Timer
from othello_shared import find_lines, get_possible_moves, play_move, get_score任何帮助都将不胜感激,只是学习子过程。1:https://www.instructables.com/id/Othello-Artificial-Intelligence/
发布于 2020-09-03 23:26:35
感谢Dinesh Pundkar的,编辑只是在添加shell = True
self.process = subprocess.Popen(['python',filename], shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE) https://stackoverflow.com/questions/63727194
复制相似问题