def test_expand_alternatives_3(blank_resource_db):
    db = blank_resource_db
    a = RequirementSet.trivial()
    b = make_single_set(make_req_a(db))
    expected = RequirementSet.trivial()

    assert a.expand_alternatives(b) == expected
Beispiel #2
0
    def reach_from_state(
        cls,
        game: GameDescription,
        initial_state: State,
    ) -> "GeneratorReach":

        reach = cls(game, initial_state, graph_module.RandovaniaGraph.new())
        game.world_list.ensure_has_node_cache()
        reach._expand_graph(
            [GraphPath(None, initial_state.node, RequirementSet.trivial())])
        return reach
def test_trivial_merge(blank_game_description):
    db = blank_game_description.resource_database
    res_a, id_req_a = make_req_a(db)
    trivial = RequirementSet.trivial()
    impossible = RequirementSet.impossible()

    the_set = RequirementSet([
        RequirementList([id_req_a]),
    ])

    assert trivial.union(trivial) == trivial
    assert trivial.union(the_set) == the_set
    assert the_set.union(trivial) == the_set
    assert trivial.union(impossible) == impossible
    assert impossible.union(the_set) == impossible
    assert the_set.union(impossible) == impossible
    assert the_set.union(the_set) == the_set
Beispiel #4
0
 def as_set(self, database: ResourceDatabase) -> RequirementSet:
     result = RequirementSet.trivial()
     for item in self.items:
         result = result.union(item.as_set(database))
     return result
Beispiel #5
0
 def __init__(self, game: GameDescription,
              configuration: BaseConfiguration):
     self.game = game
     self.configuration = configuration
     self.additional_requirements = [RequirementSet.trivial()] * len(
         game.world_list.all_nodes)
def test_set_as_str_trivial():
    assert RequirementSet.trivial().as_str == "Trivial"
def test_trivial_requirement_as_set():
    assert Requirement.trivial().as_set(None) == RequirementSet.trivial()
def test_expand_alternatives_2():
    a = RequirementSet.impossible()
    b = RequirementSet.trivial()
    expected = RequirementSet.trivial()

    assert a.expand_alternatives(b) == expected