我试图在GitHub上使用下面的NineMenMorris代码,但是当我运行它时,我得到了下面的错误
错误出现在获得一个Morris(连续3个)后,算法要求选择一个对手人物来吃
https://github.com/boris-ns/NineMensMorris
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-5-47e27bb9316e> in <module>
6 player2 = Human('B', game)
7 game.set_players(player1, player2)
----> 8 game.place_figures_phase1()
<ipython-input-3-8aed7b0be5a0> in place_figures_phase1(self)
287 white_position = self._player1.place_figure()
288 self.place_figure_on_table(self._player1.mark, white_position)
--> 289 self._while_closed_morris(white_position)
290 else: # Black on the move
291 black_position = self._player2.place_figure()
<ipython-input-3-8aed7b0be5a0> in _while_closed_morris(self, pozicija)
261 if self.check_if_closed_morris(self._player1.mark, pozicija):
262 self.draw_table()
--> 263 position_eat = self._player1.eat_opponents_figure()
264 if position_eat == -1:
265 return
<ipython-input-1-1cfba64f88fc> in eat_opponents_figure(self)
81 continue
82
---> 83 if self.game_instance.eat_figure(self.mark, position):
84 return position
85
<ipython-input-3-8aed7b0be5a0> in eat_figure(self, mark, position)
206 return False
207
--> 208 if mark == self._player1.oznaka:
209 if self.check_if_closed_morris(self._player2.oznaka, position):
210 return False
AttributeError: 'Human' object has no attribute 'oznaka'
谢谢你的建议
@KetZoomer解决了这个问题
很少有其他错误包括
self._player1.broj_figura
到self._player1.num_of_figures
相关问题 更多 >
编程相关推荐