Пример #1
0
 def __init__(self, p_game_state: GameState):
     """
     Initialise la stratégie en créant un graph vide pour chaque robot de l'équipe.
     :param p_game_state: L'état courant du jeu.
     """
     assert isinstance(p_game_state, GameState)
     self.game_state = p_game_state
     self.graphs = []
     for i in range(PLAYER_PER_TEAM):
         self.graphs.append(Graph())
Пример #2
0
    def __init__(self, p_game_state: GameState):
        """
        Initialise la stratégie en créant un graph vide pour chaque robot de l'équipe.
        :param p_game_state: L'état courant du jeu.
        """
        assert isinstance(p_game_state, GameState)
        self.logger = logging.getLogger(self.__class__.__name__)
        self.game_state = p_game_state

        self.roles_graph = {role: Graph() for role in self.assigned_roles}
Пример #3
0
 def setUp(self):
     self.game_state = GameState()
     self.game = Game()
     self.game.set_referee(Referee())
     self.game.ball = Ball()
     game_world = GameWorld(self.game)
     game_world.set_team_color_svc(TeamColorService(TeamColor.YELLOW_TEAM))
     self.game.set_our_team_color(TeamColor.YELLOW_TEAM)
     self.game_state.set_reference(game_world)
     self.game_state = GameState()
     self.empty_graph = Graph()
     self.graph1 = Graph()
     self.tactic1 = Stop(self.game_state, 1)
     self.tactic2 = GoToPositionNoPathfinder(self.game_state, 0, Pose(Position(500, 0), 0))
     self.node1 = Node(self.tactic1)
     self.node2 = Node(self.tactic2)
     self.vertex1 = Vertex(1, foo)
     self.graph1.add_node(self.node1)
     self.graph1.add_node(self.node2)
     self.graph1.add_vertex(0, 1, foo)
Пример #4
0
 def setUp(self):
     self.game_state = GameState()
     self.game = Game()
     self.game.set_referee(Referee())
     self.game.ball = Ball()
     game_world = ReferenceTransferObject(self.game)
     game_world.set_team_color_svc(TeamColorService(TeamColor.YELLOW))
     self.game_state.set_reference(game_world)
     self.game_state = GameState()
     self.empty_graph = Graph()
     self.graph1 = Graph()
     self.a_player = OurPlayer(TeamColor.YELLOW, A_PLAYER_ID)
     self.tactic1 = Stop(self.game_state, self.a_player)
     self.tactic2 = GoToPositionNoPathfinder(self.game_state, self.a_player,
                                             Pose(Position(500, 0), 0))
     self.node1 = Node(self.tactic1)
     self.node2 = Node(self.tactic2)
     self.vertex1 = Vertex(1, foo)
     self.graph1.add_node(self.node1)
     self.graph1.add_node(self.node2)
     self.graph1.add_vertex(0, 1, foo)
Пример #5
0
 def setUp(self):
     config_service = ConfigService().load_file("config/sim_standard.cfg")
     self.game_state = GameState()
     self.game = Game()
     self.game.set_referee(Referee())
     self.game.ball = Ball()
     game_world = ReferenceTransferObject(self.game)
     game_world.set_team_color_svc(TeamColorService(TeamColor.YELLOW_TEAM))
     self.game_state.set_reference(game_world)
     self.game_state = GameState()
     self.empty_graph = Graph()
     self.graph1 = Graph()
     self.tactic1 = Stop(self.game_state, 1)
     self.tactic2 = GoToPositionNoPathfinder(self.game_state, 0,
                                             Pose(Position(500, 0), 0))
     self.node1 = Node(self.tactic1)
     self.node2 = Node(self.tactic2)
     self.vertex1 = Vertex(1, foo)
     self.graph1.add_node(self.node1)
     self.graph1.add_node(self.node2)
     self.graph1.add_vertex(0, 1, foo)
Пример #6
0
    def __init__(self, p_game_state):
        super().__init__(p_game_state, keep_roles=False)

        # TODO: HARDCODED ID FOR QUALIFICATION, REMOVE LATER
        self.roles_graph = {r: Graph() for r in Role}
        role_mapping = {
            Role.GOALKEEPER: 2,
            Role.MIDDLE: 4,
            Role.FIRST_ATTACK: 6
        }
        self.game_state.map_players_to_roles_by_player_id(role_mapping)

        ourgoal = Pose(
            Position(GameState().const["FIELD_OUR_GOAL_X_EXTERNAL"], 0), 0)
        self.theirgoal = Pose(
            Position(GameState().const["FIELD_THEIR_GOAL_X_EXTERNAL"], 0), 0)

        roles_to_consider = [Role.MIDDLE, Role.FIRST_ATTACK, Role.GOALKEEPER]
        role_by_robots = [(i, self.game_state.get_player_by_role(i))
                          for i in roles_to_consider]
        self.robots = [
            player for _, player in role_by_robots if player is not None
        ]

        goalkeeper = self.game_state.get_player_by_role(Role.GOALKEEPER)

        self.add_tactic(
            Role.GOALKEEPER,
            GoalKeeper(self.game_state, goalkeeper, ourgoal,
                       penalty_kick=True))

        for index, player in role_by_robots:
            if player:
                self.add_tactic(
                    index,
                    PositionForPass(self.game_state,
                                    player,
                                    auto_position=True,
                                    robots_in_formation=self.robots))
                self.add_tactic(
                    index,
                    GoKick(self.game_state, player, target=self.theirgoal))

                self.add_condition(index, 0, 1,
                                   partial(self.is_closest, player))
                self.add_condition(index, 1, 0,
                                   partial(self.is_not_closest, player))
                self.add_condition(index, 1, 1,
                                   partial(self.has_kicked, player))
    def __init__(self, p_game_state):
        super().__init__(p_game_state, keep_roles=True)

        self.roles_graph = {r: Graph() for r in Role}
        role_mapping = {Role.GOALKEEPER: 4, Role.MIDDLE: 6}
        self.game_state.map_players_to_roles_by_player_id(role_mapping)

        roles_to_consider = [
            Role.FIRST_ATTACK, Role.SECOND_ATTACK, Role.MIDDLE,
            Role.FIRST_DEFENCE, Role.SECOND_DEFENCE, Role.GOALKEEPER
        ]

        role_by_robots = [(i, self.game_state.get_player_by_role(i))
                          for i in roles_to_consider
                          if self.game_state.get_player_by_role(i) is not None]

        for index, player in role_by_robots:
            self.add_tactic(
                index,
                GoToRandomPosition(self.game_state, player,
                                   Position(-1400, 900), 1800, 2700))
Пример #8
0
    def __init__(self, p_game_state: GameState, keep_roles=True):
        """
        Initialise la stratégie en créant un graph vide pour chaque robot de l'équipe.
        :param p_game_state: L'état courant du jeu.
        """
        assert isinstance(p_game_state, GameState)
        self.game_state = p_game_state

        if keep_roles:
            self.roles_graph = {r: Graph() for r in Role}
            players = [p for p in self.game_state.my_team.available_players.values()]
            roles = [r for r in Role]
            role_mapping = dict(zip(roles, players))
            # Magnifique hack pour bypasser un mapping de goalkeeper
            # current_goaler = p_game_state.get_player_by_role(Role.GOALKEEPER)
            # if current_goaler is not None:
            #     new_goaler = role_mapping[Role.GOALKEEPER]
            #     new_goaler_old_role = p_game_state.get_role_by_player_id(new_goaler.id)
            #     role_mapping[Role.GOALKEEPER] = current_goaler
            #     role_mapping[new_goaler_old_role] = new_goaler

            self.game_state.map_players_to_roles_by_player(role_mapping)
Пример #9
0
 def clear_graph_of_role(self, r: Role):
     self.roles_graph[r] = Graph()
Пример #10
0
 def setUp(self):
     self.graph = Graph()
Пример #11
0
class TestGraph(unittest.TestCase):
    def setUp(self):
        self.graph = Graph()

    def test_givenAGraphWithANode_whenGetCurrentTactic_thenReturnTacticOfANode(self):
        a_node = self._create_mock_node()
        self.graph.add_node(a_node)
        assert self.graph.current_tactic == a_node.tactic

    def test_givenAGraphWithANode_whenExecGraph_thenNodeIsCall(self):
        a_node = self._create_mock_node()
        self.graph.add_node(a_node)

        self.graph.exec()

        a_node.exec.assert_any_call()

    def test_givenAGraphWithTwoNodeLinked_whenExecTwice_thenBothNodeAreCalled(self):
        another_node = TestGraph._create_mock_node()
        a_node = TestGraph._create_mock_node(another_node)
        self.graph.add_node(a_node)
        self.graph.add_node(another_node)

        self.graph.exec()
        self.graph.exec()

        a_node.exec.assert_any_call()
        another_node.exec.assert_any_call()

    def test_givenAGraphWithTwoNodeUnLinked_whenExecTwice_thenOnlyTheFirstNodeIsCalled(self):
        a_node = TestGraph._create_mock_node()
        another_node = TestGraph._create_mock_node()
        self.graph.add_node(a_node)
        self.graph.add_node(another_node)

        self.graph.exec()
        self.graph.exec()

        a_node.exec.assert_any_call()
        another_node.exec.assert_not_called()

    @staticmethod
    def _create_mock_node(next_node=None):
        node = create_autospec(Node)
        node.tactic = TestGraph._create_mock_tactic("my command")
        node.exec = MagicMock(return_value=("my command", next_node))
        return node

    @staticmethod
    def _create_mock_tactic(command):
        tactic = create_autospec(Tactic)
        tactic.exec = lambda: command
        return tactic
Пример #12
0
class TestGraph(unittest.TestCase):
    def setUp(self):
        self.game_state = GameState()
        self.game = Game()
        self.game.set_referee(Referee())
        self.game.ball = Ball()
        game_world = ReferenceTransferObject(self.game)
        game_world.set_team_color_svc(TeamColorService(TeamColor.YELLOW))
        self.game_state.set_reference(game_world)
        self.game_state = GameState()
        self.empty_graph = Graph()
        self.graph1 = Graph()
        self.a_player = OurPlayer(TeamColor.YELLOW, A_PLAYER_ID)
        self.tactic1 = Stop(self.game_state, self.a_player)
        self.tactic2 = GoToPositionNoPathfinder(self.game_state, self.a_player,
                                                Pose(Position(500, 0), 0))
        self.node1 = Node(self.tactic1)
        self.node2 = Node(self.tactic2)
        self.vertex1 = Vertex(1, foo)
        self.graph1.add_node(self.node1)
        self.graph1.add_node(self.node2)
        self.graph1.add_vertex(0, 1, foo)

    def test_init(self):
        self.assertEqual(self.empty_graph.current_node, 0)
        self.assertEqual(len(self.empty_graph.nodes), 0)

    def test_get_current_tactic_name(self):
        self.assertEqual(self.graph1.get_current_tactic_name(), "Stop")
        self.assertEqual(self.empty_graph.get_current_tactic_name(), None)
        self.empty_graph.add_node(self.node2)
        self.assertEqual(self.empty_graph.get_current_tactic_name(),
                         "GoToPositionNoPathfinder")

    def test_get_current_tactic(self):
        self.assertIsInstance(self.graph1.get_current_tactic(), Stop)
        self.assertEqual(self.empty_graph.get_current_tactic(), None)
        self.empty_graph.add_node(self.node2)
        self.assertIsInstance(self.empty_graph.get_current_tactic(),
                              GoToPositionNoPathfinder)

    def test_add_node(self):
        self.assertEqual(len(self.graph1.nodes), 2)
        self.assertRaises(AssertionError, self.graph1.add_node, "not a node")

    def test_remove_node(self):
        self.assertRaises(AssertionError, self.graph1.remove_node,
                          "not an int")
        self.assertRaises(AssertionError, self.graph1.remove_node, -1)
        self.assertRaises(AssertionError, self.graph1.remove_node, 420)
        self.graph1.remove_node(1)
        self.assertEqual(len(self.graph1.nodes), 1)
        self.assertEqual(len(self.graph1.nodes[0].vertices), 0)

    def test_add_vertex(self):
        self.assertEqual(len(self.graph1.nodes[0].vertices), 1)
        self.assertRaises(AssertionError, self.graph1.add_vertex, "not an int",
                          1, foo)
        self.assertRaises(AssertionError, self.graph1.add_vertex, -1, 1, foo)
        self.assertRaises(AssertionError, self.graph1.add_vertex, 420, 1, foo)
        self.assertRaises(AssertionError, self.graph1.add_vertex, 0,
                          "not an int", foo)
        self.assertRaises(AssertionError, self.graph1.add_vertex, 0, -1, foo)
        self.assertRaises(AssertionError, self.graph1.add_vertex, 0, 420, foo)
        self.assertRaises(AssertionError, self.graph1.add_vertex, 0, 1,
                          "not a callable")
        self.graph1.add_vertex(0, 1, foo)
        self.assertEqual(len(self.graph1.nodes[0].vertices), 1)

    def test_remove_vertex(self):
        self.assertRaises(AssertionError, self.graph1.remove_vertex,
                          "not an int", 1)
        self.assertRaises(AssertionError, self.graph1.remove_vertex, -1, 1)
        self.assertRaises(AssertionError, self.graph1.remove_vertex, 420, 1)
        self.assertRaises(AssertionError, self.graph1.remove_vertex, 0,
                          "not an int")
        self.assertRaises(AssertionError, self.graph1.remove_vertex, 0, -1)
        self.assertRaises(AssertionError, self.graph1.remove_vertex, 0, 420)
        self.graph1.add_node(self.node2)
        self.graph1.remove_vertex(0, 2)
        self.assertEqual(len(self.graph1.nodes[0].vertices), 1)
        self.graph1.remove_vertex(0, 1)
        self.assertEqual(len(self.graph1.nodes[0].vertices), 0)

    def test_exec(self):
        next_ai_command = self.graph1.exec()
        expected_ai_command = Idle(self.game_state, self.a_player).exec()

        self.assertEqual(self.graph1.current_node, 1)
        self.assertEqual(next_ai_command, expected_ai_command)

        self.assertRaises(EmptyGraphException, self.empty_graph.exec)

        self.empty_graph.add_node(self.node2)
        self.empty_graph.add_node(self.node1)
        self.empty_graph.add_vertex(0, 1, foo2)

        next_ai_command = self.empty_graph.exec()
        expected_ai_command = GoToPositionNoPathfinder(
            self.game_state, self.a_player, Pose(Position(500, 0), 0)).exec()
        self.assertEqual(self.empty_graph.current_node, 0)
        self.assertEqual(next_ai_command, expected_ai_command)

        next_ai_command = self.empty_graph.exec()
        expected_ai_command = GoToPositionNoPathfinder(
            self.game_state, self.a_player, Pose(Position(500, 0), 0)).exec()
        self.assertEqual(self.empty_graph.current_node, 0)
        self.assertEqual(next_ai_command, expected_ai_command)

    def test_set_current_node(self):
        self.assertRaises(AssertionError, self.graph1.set_current_node,
                          "not an int")
        self.assertRaises(AssertionError, self.graph1.set_current_node, -1)
        self.assertRaises(AssertionError, self.graph1.set_current_node, 420)
        self.graph1.nodes[0].set_flag(Flags.WIP)
        self.graph1.set_current_node(1)
        self.assertEqual(self.graph1.current_node, 1)
        self.assertEqual(self.graph1.nodes[0].tactic.status_flag, Flags.INIT)
Пример #13
0
class TestGraph(unittest.TestCase):
    def setUp(self):
        self.game_state = GameState()
        self.game = Game()
        self.game.set_referee(Referee())
        self.game.ball = Ball()
        game_world = GameWorld(self.game)
        game_world.set_team_color_svc(TeamColorService(TeamColor.YELLOW_TEAM))
        self.game.set_our_team_color(TeamColor.YELLOW_TEAM)
        self.game_state.set_reference(game_world)
        self.game_state = GameState()
        self.empty_graph = Graph()
        self.graph1 = Graph()
        self.tactic1 = Stop(self.game_state, 1)
        self.tactic2 = GoToPositionNoPathfinder(self.game_state, 0, Pose(Position(500, 0), 0))
        self.node1 = Node(self.tactic1)
        self.node2 = Node(self.tactic2)
        self.vertex1 = Vertex(1, foo)
        self.graph1.add_node(self.node1)
        self.graph1.add_node(self.node2)
        self.graph1.add_vertex(0, 1, foo)

    def test_init(self):
        self.assertEqual(self.empty_graph.current_node, 0)
        self.assertEqual(len(self.empty_graph.nodes), 0)

    def test_get_current_tactic_name(self):
        self.assertEqual(self.graph1.get_current_tactic_name(), "Stop")
        self.assertEqual(self.empty_graph.get_current_tactic_name(), None)
        self.empty_graph.add_node(self.node2)
        self.assertEqual(self.empty_graph.get_current_tactic_name(), "GoToPositionNoPathfinder")

    def test_get_current_tactic(self):
        self.assertIsInstance(self.graph1.get_current_tactic(), Stop)
        self.assertEqual(self.empty_graph.get_current_tactic(), None)
        self.empty_graph.add_node(self.node2)
        self.assertIsInstance(self.empty_graph.get_current_tactic(), GoToPositionNoPathfinder)

    def test_add_node(self):
        self.assertEqual(len(self.graph1.nodes), 2)
        self.assertRaises(AssertionError, self.graph1.add_node, "not a node")

    def test_remove_node(self):
        self.assertRaises(AssertionError, self.graph1.remove_node, "not an int")
        self.assertRaises(AssertionError, self.graph1.remove_node, -1)
        self.assertRaises(AssertionError, self.graph1.remove_node, 420)
        self.graph1.remove_node(1)
        self.assertEqual(len(self.graph1.nodes), 1)
        self.assertEqual(len(self.graph1.nodes[0].vertices), 0)

    def test_add_vertex(self):
        self.assertEqual(len(self.graph1.nodes[0].vertices), 1)
        self.assertRaises(AssertionError, self.graph1.add_vertex, "not an int", 1, foo)
        self.assertRaises(AssertionError, self.graph1.add_vertex, -1, 1, foo)
        self.assertRaises(AssertionError, self.graph1.add_vertex, 420, 1, foo)
        self.assertRaises(AssertionError, self.graph1.add_vertex, 0, "not an int", foo)
        self.assertRaises(AssertionError, self.graph1.add_vertex, 0, -1, foo)
        self.assertRaises(AssertionError, self.graph1.add_vertex, 0, 420, foo)
        self.assertRaises(AssertionError, self.graph1.add_vertex, 0, 1, "not a callable")
        self.graph1.add_vertex(0, 1, foo)
        self.assertEqual(len(self.graph1.nodes[0].vertices), 1)

    def test_remove_vertex(self):
        self.assertRaises(AssertionError, self.graph1.remove_vertex, "not an int", 1)
        self.assertRaises(AssertionError, self.graph1.remove_vertex, -1, 1)
        self.assertRaises(AssertionError, self.graph1.remove_vertex, 420, 1)
        self.assertRaises(AssertionError, self.graph1.remove_vertex, 0, "not an int")
        self.assertRaises(AssertionError, self.graph1.remove_vertex, 0, -1)
        self.assertRaises(AssertionError, self.graph1.remove_vertex, 0, 420)
        self.graph1.add_node(self.node2)
        self.graph1.remove_vertex(0, 2)
        self.assertEqual(len(self.graph1.nodes[0].vertices), 1)
        self.graph1.remove_vertex(0, 1)
        self.assertEqual(len(self.graph1.nodes[0].vertices), 0)

    @unittest.skip("I don't know whuy the f**k it is broken here.")
    def test_exec(self):
        next_ai_command = self.graph1.exec()
        expected_ai_command = AICommand(1, AICommandType.STOP)
        self.assertEqual(self.graph1.current_node, 1)
        self.assertEqual(next_ai_command, expected_ai_command)

        self.assertRaises(EmptyGraphException, self.empty_graph.exec)

        self.empty_graph.add_node(self.node2)
        self.empty_graph.add_node(self.node1)
        self.empty_graph.add_vertex(0, 1, foo2)

        next_ai_command = self.empty_graph.exec()
        expected_ai_command = AICommand(0, AICommandType.MOVE,
                                        **{"pose_goal": Pose(Position(500, 0))})
        self.assertEqual(self.empty_graph.current_node, 0)
        self.assertEqual(next_ai_command, expected_ai_command)

        next_ai_command = self.empty_graph.exec()
        expected_ai_command = AICommand(0, AICommandType.MOVE,
                                        **{"pose_goal": Pose(Position(500, 0))})
        self.assertEqual(self.empty_graph.current_node, 0)
        self.assertEqual(next_ai_command, expected_ai_command)

    def test_set_current_node(self):
        self.assertRaises(AssertionError, self.graph1.set_current_node, "not an int")
        self.assertRaises(AssertionError, self.graph1.set_current_node, -1)
        self.assertRaises(AssertionError, self.graph1.set_current_node, 420)
        self.graph1.nodes[0].set_flag(Flags.WIP)
        self.graph1.set_current_node(1)
        self.assertEqual(self.graph1.current_node, 1)
        self.assertEqual(self.graph1.nodes[0].tactic.status_flag, Flags.INIT)

    def test_str(self):
        expected_string = ""
        for i in range(len(self.graph1.nodes)):
            expected_string += "Node " + str(i) + ": " + str(self.graph1.nodes[i]) + "\n"
        self.assertEqual(str(self.graph1), expected_string)
Пример #14
0
class TestGraph(unittest.TestCase):
    def setUp(self):
        config_service = ConfigService().load_file("config/sim_standard.cfg")
        self.game_state = GameState()
        self.game = Game()
        self.game.set_referee(Referee())
        self.game.ball = Ball()
        game_world = ReferenceTransferObject(self.game)
        game_world.set_team_color_svc(TeamColorService(TeamColor.YELLOW_TEAM))
        self.game_state.set_reference(game_world)
        self.game_state = GameState()
        self.empty_graph = Graph()
        self.graph1 = Graph()
        self.tactic1 = Stop(self.game_state, 1)
        self.tactic2 = GoToPositionNoPathfinder(self.game_state, 0,
                                                Pose(Position(500, 0), 0))
        self.node1 = Node(self.tactic1)
        self.node2 = Node(self.tactic2)
        self.vertex1 = Vertex(1, foo)
        self.graph1.add_node(self.node1)
        self.graph1.add_node(self.node2)
        self.graph1.add_vertex(0, 1, foo)

    def test_init(self):
        self.assertEqual(self.empty_graph.current_node, 0)
        self.assertEqual(len(self.empty_graph.nodes), 0)

    def test_get_current_tactic_name(self):
        self.assertEqual(self.graph1.get_current_tactic_name(), "Stop")
        self.assertEqual(self.empty_graph.get_current_tactic_name(), None)
        self.empty_graph.add_node(self.node2)
        self.assertEqual(self.empty_graph.get_current_tactic_name(),
                         "GoToPositionNoPathfinder")

    def test_get_current_tactic(self):
        self.assertIsInstance(self.graph1.get_current_tactic(), Stop)
        self.assertEqual(self.empty_graph.get_current_tactic(), None)
        self.empty_graph.add_node(self.node2)
        self.assertIsInstance(self.empty_graph.get_current_tactic(),
                              GoToPositionNoPathfinder)

    def test_add_node(self):
        self.assertEqual(len(self.graph1.nodes), 2)
        self.assertRaises(AssertionError, self.graph1.add_node, "not a node")

    def test_remove_node(self):
        self.assertRaises(AssertionError, self.graph1.remove_node,
                          "not an int")
        self.assertRaises(AssertionError, self.graph1.remove_node, -1)
        self.assertRaises(AssertionError, self.graph1.remove_node, 420)
        self.graph1.remove_node(1)
        self.assertEqual(len(self.graph1.nodes), 1)
        self.assertEqual(len(self.graph1.nodes[0].vertices), 0)

    def test_add_vertex(self):
        self.assertEqual(len(self.graph1.nodes[0].vertices), 1)
        self.assertRaises(AssertionError, self.graph1.add_vertex, "not an int",
                          1, foo)
        self.assertRaises(AssertionError, self.graph1.add_vertex, -1, 1, foo)
        self.assertRaises(AssertionError, self.graph1.add_vertex, 420, 1, foo)
        self.assertRaises(AssertionError, self.graph1.add_vertex, 0,
                          "not an int", foo)
        self.assertRaises(AssertionError, self.graph1.add_vertex, 0, -1, foo)
        self.assertRaises(AssertionError, self.graph1.add_vertex, 0, 420, foo)
        self.assertRaises(AssertionError, self.graph1.add_vertex, 0, 1,
                          "not a callable")
        self.graph1.add_vertex(0, 1, foo)
        self.assertEqual(len(self.graph1.nodes[0].vertices), 1)

    def test_remove_vertex(self):
        self.assertRaises(AssertionError, self.graph1.remove_vertex,
                          "not an int", 1)
        self.assertRaises(AssertionError, self.graph1.remove_vertex, -1, 1)
        self.assertRaises(AssertionError, self.graph1.remove_vertex, 420, 1)
        self.assertRaises(AssertionError, self.graph1.remove_vertex, 0,
                          "not an int")
        self.assertRaises(AssertionError, self.graph1.remove_vertex, 0, -1)
        self.assertRaises(AssertionError, self.graph1.remove_vertex, 0, 420)
        self.graph1.add_node(self.node2)
        self.graph1.remove_vertex(0, 2)
        self.assertEqual(len(self.graph1.nodes[0].vertices), 1)
        self.graph1.remove_vertex(0, 1)
        self.assertEqual(len(self.graph1.nodes[0].vertices), 0)

    @unittest.skip("I don't know whuy the f**k it is broken here.")
    def test_exec(self):
        next_ai_command = self.graph1.exec()
        expected_ai_command = AICommand(1, AICommandType.STOP)
        self.assertEqual(self.graph1.current_node, 1)
        self.assertEqual(next_ai_command, expected_ai_command)

        self.assertRaises(EmptyGraphException, self.empty_graph.exec)

        self.empty_graph.add_node(self.node2)
        self.empty_graph.add_node(self.node1)
        self.empty_graph.add_vertex(0, 1, foo2)

        next_ai_command = self.empty_graph.exec()
        expected_ai_command = AICommand(
            0, AICommandType.MOVE, **{"pose_goal": Pose(Position(500, 0))})
        self.assertEqual(self.empty_graph.current_node, 0)
        self.assertEqual(next_ai_command, expected_ai_command)

        next_ai_command = self.empty_graph.exec()
        expected_ai_command = AICommand(
            0, AICommandType.MOVE, **{"pose_goal": Pose(Position(500, 0))})
        self.assertEqual(self.empty_graph.current_node, 0)
        self.assertEqual(next_ai_command, expected_ai_command)

    def test_set_current_node(self):
        self.assertRaises(AssertionError, self.graph1.set_current_node,
                          "not an int")
        self.assertRaises(AssertionError, self.graph1.set_current_node, -1)
        self.assertRaises(AssertionError, self.graph1.set_current_node, 420)
        self.graph1.nodes[0].set_flag(Flags.WIP)
        self.graph1.set_current_node(1)
        self.assertEqual(self.graph1.current_node, 1)
        self.assertEqual(self.graph1.nodes[0].tactic.status_flag, Flags.INIT)

    def test_str(self):
        expected_string = ""
        for i in range(len(self.graph1.nodes)):
            expected_string += "Node " + str(i) + ": " + str(
                self.graph1.nodes[i]) + "\n"
        self.assertEqual(str(self.graph1), expected_string)