def create_game(self, game_id, game_description): """Create a game with the given game_id using the game description. Args: game_id (str) : Game is created with this ID. game_description (str) : Game description given in Game Description Language (GDL). """ with Frame(): self._create_game_predicate( Term.from_atom_name(game_id), prefix_gdl_statements_to_prolog(game_description), check=True)
def check_parse_variables(*variables): variables = ['?' + var for var in variables] for variable in variables: assert_true(prefix_gdl_statement_to_prolog(variable).is_variable()) term_list = prefix_gdl_statements_to_prolog('\n'.join(variables)) terms = [] # Check that all variable terms are unique while not term_list.is_nil(): term = term_list.get_arg(0) assert_not_in(term, terms) terms.append(term) term_list = term_list.get_arg(1) assert_equal(len(terms), len(variables))
def check_parse_statements(target, *gdl_statements): assert_equal( prefix_gdl_statements_to_prolog('\n'.join(gdl_statements)), target)