Thursday, June 29, 2017

Hidden variables templates

I have an idea. I do not have any program that would parse the below code, and beyond the syntax I do not have much. But the idea is interesting. It is about building the hidden variables automatically.

class place, character, boolean;

object false:boolean, true:boolean;

object Wyzima:place, Novigrad:place, Shadizar:place;

object Dorban:character, Pregor:character, Thragos:character;

hidden variable (A:character)_can_see_(B:character):boolean;
hidden variable (A:character)_has_told_(B:character)_that_(C:variable)_is_(D:boolean):boolean;
hidden variable (A:character)_is_in_(B:place):boolean;
hidden variable (A:character)_thinks_that_(B:variable)_is_(C:boolean):boolean;

The last four lines contain hidden variable templates. I imagine that the parser would use them to generate hidden variables automatically. For example the first template would create the following variables:

hidden variable Dorban_can_see_Dorban:boolean;
hidden variable Dorban_can_see_Pregor:boolean;
hidden variable Dorban_can_see_Thragos:boolean;
hidden variable Pregor_can_see_Dorban:boolean;
hidden variable Pregor_can_see_Pregor:boolean;
hidden variable Pregor_can_see_Thragos:boolean;
hidden variable Thragos_can_see_Dorban:boolean;
hidden variable Thragos_can_see_Pregor:boolean;
hidden variable Thragos_can_see_Thragos:boolean;

The second template uses a boolean hidden variable to build another variable upon it. This way we can achieve indefinitely many variables, but of course I would expect the recursion to stop somewhere.

My problem is how to express the model in terms of the hidden variables generated this way. I have no idea how to do it. Maybe something like logical rules would work?

No comments:

Post a Comment