Monday, July 10, 2017

Bobr - a templates parser

I have written a small tool (bobr) that is capable of parsing my variable templates. It is not published yet.

In a quite realistic example I observed that both the input variables generated as well as the output variable (with many values) produce a relatively small space to search, while the hidden variables produce a huge one. I will not be able to search through it all. I thought of changing the algorithm so that it only searches through some small subspace.

I will also have a problem how to represent the model in terms of the hidden variable templates.

This is the template code I was parsing:


class boolean, person, place, profession, weapon;

object none;
object false:boolean, true:boolean;
object Dorban:person, Pregor:person, Thragos:person;
object warrior:profession, wizard:profession, thief:profession;
object Wyzima:place, Shadizar:place, Novigrad:place;
object bare_hands:weapon, axe:weapon, magic:weapon;

input variable reward:{false, true, none};
input variable response:{false, true, none};
input variable can_I_see_(X:person):boolean;
input variable do_I_have_(X:weapon):boolean;
input variable am_I_a_(X:profession):boolean;
input variable where_am_I:place;

output variable action:{
    goto_(X:place),
    do_nothing,
    attack_(X:person)_with_(Y:weapon),
    steal_(X:person)_(Y:weapon),
    tell_(X:person)_that_(Y:person)_has_(Z:weapon),
    tell_(X:person)_that_(Y:person)_is_a_(Z:profession),
    tell_(X:person)_that_(Y:person)_is_in_(Z:place),
    ask_(X:person)_whether_(Y:person)_has_(Z:weapon),
    ask_(X:person)_whether_(Y:person)_is_a_(Z:profession),
    ask_(X:person)_whether_(Y:person)_is_in_(Z:place)
    };

hidden variable (X:person)_has_(Y:weapon):boolean;
hidden variable (X:person)_is_a_(Y:profession):boolean;
hidden variable (X:person)_is_in_(Y:place):boolean;

hidden variable (X:person)_thinks_that_(Y:person)_has_(Z:weapon):boolean;
hidden variable (X:person)_thinks_that_(Y:person)_is_a_(Z:profession):boolean;
hidden variable (X:person)_thinks_that_(Y:person)_is_in_(Z:place):boolean;



No comments:

Post a Comment