botbowl icon indicating copy to clipboard operation
botbowl copied to clipboard

No player position during quick snap without pathfinding

Open njustesen opened this issue 4 years ago • 0 comments

This happened during quick snap when using the MCTS agent in a game with pathfinding disabled.

Traceback (most recent call last):
  File "/Users/noju/git/botbowl/examples/mcts_example.py", line 318, in <module>
    game.init()
  File "/Users/noju/git/botbowl/botbowl/core/game.py", line 151, in init
    self.step(start_action)
  File "/Users/noju/git/botbowl/botbowl/core/game.py", line 191, in step
    self.action = self._safe_act()
  File "/Users/noju/git/botbowl/botbowl/core/game.py", line 324, in _safe_act
    action = self.actor.act(self)
  File "/Users/noju/git/botbowl/examples/mcts_example.py", line 281, in act
    root = mcts.run(self.seconds)
  File "/Users/noju/git/botbowl/examples/mcts_example.py", line 185, in run
    tree_trajectory = self._select_and_expand(root)
  File "/Users/noju/git/botbowl/examples/mcts_example.py", line 225, in _select_and_expand
    new_chance_node, new_node = self._expand(node)
  File "/Users/noju/git/botbowl/examples/mcts_example.py", line 235, in _expand
    self.game.step(action)
  File "/Users/noju/git/botbowl/botbowl/core/game.py", line 172, in step
    done = self._one_step(self.action)
  File "/Users/noju/git/botbowl/botbowl/core/game.py", line 469, in _one_step
    self.set_available_actions()
  File "/Users/noju/git/botbowl/botbowl/core/game.py", line 625, in set_available_actions
    self.state.available_actions = self.state.stack.peek().available_actions()
  File "/Users/noju/git/botbowl/botbowl/core/procedure.py", line 2730, in available_actions
    actions = self.game.get_adjacent_move_actions(self.player)
  File "/Users/noju/git/botbowl/botbowl/core/game.py", line 2407, in get_adjacent_move_actions
    for square in self.get_adjacent_squares(player.position, occupied=False):
  File "/Users/noju/git/botbowl/botbowl/core/game.py", line 1707, in get_adjacent_squares
    sq = self.get_square(position.x + xx, position.y + yy)
AttributeError: 'NoneType' object has no attribute 'x'

I haven't been able to reproduce it.

njustesen avatar Apr 13 '22 09:04 njustesen