1% :- if(( ( \+ ((current_prolog_flag(logicmoo_include,Call),Call))) )). 
    2% :- swi_module(mud_simple_decl_parser, [parserVars/3,parserVars/4,asserta_parserVars/3]).
    3/* * <module> simple_decl_parser - an example of simple parsing of an inform7 like languages.
    4%
    5% Logicmoo Project PrologMUD: A MUD server written in Prolog
    6% Maintainer: Douglas Miles
    7% Dec 13, 2035
    8%
    9*/
   10% :- endif.
   11
   12:- check_clause_counts.   13:- include(prologmud(mud_header)).   14:- check_clause_counts.   15
   16:-discontiguous((translation_spo/6,parserTest/2,parserTest/3,translation_w//1)).   17:-dynamic((translation_spo/6,parserTest/2,parserTest/3,translation_w//1)).   18:-thread_local(loosePass/0).   19:-thread_local(debugPass/0).   20:-dynamic(parserVars/4).   21
   22
   23glue_words(W):- member(W,[is,a,the,in,carries,'An','A','The',was,of,type]).
   24
   25toCamelAtom(List,O):-((\+((member(IS,List),glue_words(IS))),toCamelAtom00(List,O))),!.
   26
   27% toCamelAtom00(I,O):-toCamelAtom0(I,O).
   28toCamelAtom00(I,O):-toCamelcase(I,O).
   29
   30 % :- set_prolog_flag(subclause_expansion,true).
   31
   32
   33vtColor(vRed).
   34
   35ttValueType(vtColor).
   36
   37'==>'((isa(X,ttValueType)/(X\==vtValue)),
   38  (genls(X,vtValue),completelyAssertedCollection(X))).
   39
   40completelyAssertedCollection(vtValue).
   41
   42isa(vtValue,ttValueType).
   43
   44
   45typeGenls(ttValueType,vtValue).
   46
   47
   48:-must(vtColor(vRed)).   49:-must((isa(vRed,REDISA),genls(REDISA,vtValue))).   50
   51
   52 % :- set_prolog_flag(subclause_expansion,false).
   53
   54:- baseKB:ensure_loaded(library(multimodal_dcg)).   55
   56
   57asserta_parserVars(N,V,Type):- show_failure(current_agent(A)),asserta(parserVars(A,N,V,Type)).
   58:-export(parserVars/3).   59parserVars(N,V,Type):- show_failure(current_agent(A);A=iCurrentAgentFn),
   60   (parserVars_local(A,N,V,Type)*->true;parserVars_falback(global,N,V,Type)).
   61
   62parserVars_local(A,(N1;N2),V,Type):-!,parserVars_local(A,N1,V,Type);parserVars_local(A,N2,V,Type).
   63parserVars_local(A,N,V,Type):-parserVars(A,N,V,Type).
   64
   65parserVars_falback(_,N,V,Type):-parserVars_local(global,N,V,Type).
   66
   67toCol(Txt,I,TCOL):-member(TCOL,[tCol,tObj,tSpatialThing,vtValue,ttTypeType]),show_success(toCol_0,toCol_0(Txt,I,TCOL)),!.
   68
   69toCol_0(Txt,O,TCOL):-member(Pfx-Sfx- _ISACISA, 
   70         [
   71          ''-''-_,
   72          't'-''-'tCol',
   73          'tt'-'Type'-'ttTypeType',
   74          'vt'-''-'ttValueTypeType',
   75          'v'-''-'vtValue',
   76          'i'-'7'-'tSpatialThing',
   77          'i'-'7'-'ttSpatialType',
   78          't'-'Able'-'ttTypeByAction',
   79          'tt'-''-'ttTypeType',
   80          ''-''-_
   81           ]),atom_concat(Pfx,Txt,I),atom_concat(I,Sfx,O),isa(O,TCOL),!.
   82
   83is_a --> is_was, [a].
   84is_a --> is_was.
   85
   86is_was --> [is].
   87is_was --> [was].
   88is_was --> [be].
   89is_was --> [are].
   90
   91is_in --> is_was, [in].
   92is_in --> is_was, [inside,of].
   93is_in --> is_was, [carried,by].
   94
   95is_type_of --> is_a, [type,of].
   96is_type_of --> is_a, [type].
   97
   98detn(exists) --> [the].
   99detn(exists) --> ['The'].
  100detn(exists) --> [some].
  101detn(all) --> [all].
  102detn(indef) --> [a].
  103detn(indef) --> ['A'].
  104detn(indef) --> [an].
  105detn(indef) --> ['An'].
  106
  107collection(I,Col,More)--> detn(_),!,collection(I,Col,More).
  108collection(I,Col,true)--> collection0(I,Col).
  109collection(I,Col,More)--> attribute(_Pred,I,_Value,More),collection0(I,Col).
  110collection(I,Col,More)--> attribute(_Pred,I,_Value,More),{call_u(isa(I,Col))}.
  111
  112
  113collection0(I,Col)--> [A,B,C],{toCamelAtom([A,B,C],O),collection00(O,I,Col)}.
  114collection0(I,Col)--> [A,B],{toCamelAtom([A,B],O),collection00(O,I,Col)}.
  115collection0(I,Col)--> [O],{collection00(O,I,Col)}.
  116
  117collection00(A,I,Col):-mudKeyword(I,W),string_equal_ci(A,W),toCol(A,I,Col).
  118collection00(M,I,Col):-toCol(M,I,Col).
  119collection00(A,I,Col):-toPropercase(A,O),toCol(O,I,Col).
  120
  121subject(I,More)-->subject(I,_,More).
  122subject(I,T,true)-->(['This'];['this']),!,{must((parserVars(isThis,I,T);parserVars(_,I,T)))}.
  123subject(I,T,true)--> [IT],{string_equal_ci(IT,ITLC),parserVars(isParserVar(ITLC),I,T)},!.
  124subject(I,T,true)--> [IT],{string_equal_ci(IT,ITLC),parserVars((ITLC),I,T)},!.
  125subject(I,T,More)--> dcgOptional(detn(_)),collection(I,T,More),{(asserta_parserVars(isThis,I,T))}.
  126
  127object(I,More)-->object(I,_,More).
  128object(I,T,true)-->([it];['It'];['This'];['this']),!,{must((parserVars(object,I,T);parserVars(_,I,T)))}.
  129object(I,T,More)--> detn(_),!,collection(I,T,More),{(asserta_parserVars(object,I,T))}.
  130object(I,T,More)--> collection(I,T,More),{(asserta_parserVars(object,I,T))}.
  131
  132% big , red , flat, etc
  133attribute(Pred,I,C,t(Pred,I,C))--> [W],{ \+ glue_words(W),collection00(W,C,vtValue), isa(C,What),\=(What,vtValue),isa(What,ttValueType),argIsa(Pred,2,What)}.
  134
  135
  136dcgParse213(A1,A2,A3,S,E):-append([L|Left],[MidT|RightT],S),phrase(A2,[MidT|RightT],EE),     ((phrase(A1,[L|Left],[]),phrase(A3,EE,E))).
  137dcgParse213(A1,A2,A3,S,E):-debugPass,append([L|Left],[MidT|RightT],S),phrase(A2,[MidT|RightT],EE), trace, must((phrase(A1,[L|Left],[]),phrase(A3,EE,E))).
  138
  139p_predicate(Pred,_Arg1Isa,_Arg2Isa)-->predicate0(Pred),{current_predicate(Pred/_),!}.
  140p_predicate(Pred,_Arg1Isa,_Arg2Isa)-->{loosePass},predicate0(Pred).
  141
  142
  143predicate0(mudStowing)-->[carries].
  144predicate0(mudWielding)-->[wields].
  145predicate0(mudLikes)-->[likes].
  146predicate0(mudColor)-->[is,colored].
  147predicate0(localityOfObject)-->is_in.
  148predicate0(Pred)-->[has,Color],{i_name(mud,Color,Pred)}.
  149predicate0(isa)-->is_type_of.
  150predicate0(Pred)-->[is,the,Color],{i_name(mud,Color,Pred)}.
  151predicate0(Pred)-->[Likes],{atom_concat(Like,'s',Likes),i_name(mud,Like,Pred)}.
  152predicate0(Pred)-->[is,Colored],{atom_concat(Color,'ed',Colored),i_name(mud,Color,Pred)}.
  153predicate0(isa)-->is_a.
  154predicate0(mudRelates)-->is_was.
  155predicate0(isa)-->[is].
  156
  157 % :- set_prolog_flag(subclause_expansion,true).
  158
  159
  160tCol('tRoom').
  161
  162% :-ignore(show_call(phrase(collection(I,T,More),[red,room]))).
  163
  164%TODO "All couches are things."
  165
  166% assert_text(iWorld7,"couches are hard sometimes").
  167
  168parserTest(A,B):-parserTest(A,B,_).
  169
  170:-assertz_if_new(parserTest(iWorld7,"A television is usually in the living room.")).  171
  172% :-assert_text_now(iWorld7,"You are in a well kept garden.").
  173
  174
  175translation_spo(Prolog,localityOfObject,I,C) --> dcgParse213(subject(I,More1),is_in,object(C,More2)),{conjoin(More1,More2,Prolog)}.
  176
  177
  178% :-assertz_if_new(parserTest(iKitchen7,"This is the red room.")).
  179
  180:-assertz_if_new(parserTest(iWorld7,"The player carries the sack.")).  181translation_spo(Prolog,Pred,I,C) --> dcgParse213(subject(I,Arg1Isa,More1),p_predicate(Pred,Arg1Isa,Arg2Isa),object(C,Arg2Isa,More2)),{conjoin(More1,More2,Prolog)}.
  182
  183:-assertz_if_new(parserTest(iWorld7,"room is type of tRegion")).  184translation_spo(Prolog,isa,I,C) --> dcgParse213(subject(I,tCol,More1),is_type_of,object(C,tCol,More2)),{conjoin(More1,More2,Prolog)}.
  185
  186:-assertz_if_new(parserTest(iWorld7,"The Living room is a room.")).  187tCol('tSack').
  188
  189:-assertz_if_new(parserTest(iWorld7,"The sack is a container.")).  190translation_spo(Prolog,isa,I,C) --> dcgParse213(subject(I,More1),is_a,object(C,tCol,More2)),{conjoin(More1,More2,Prolog)}.
  191
  192
  193:-assert_if_new(vtSize('vBulky')).  194
  195translation_spo(Prolog,isa,I,C) --> dcgParse213(subject(I,More1),is_was,object(C,_,More2)),{conjoin(More1,More2,Prolog)}.
  196translation_spo(Prolog,Pred,I,C) --> dcgParse213(subject(I,More1),is_was,attribute(Pred,I,C,More2)),{conjoin(More1,More2,Prolog)}.
  197
  198%:-assertz_if_new(parserTest(iWorld7,"A coffee table is in the living room.")).
  199%:-assertz_if_new(parserTest(iWorld7,"It is bulky.")).
  200
  201tCol('tRemoteControl').
  202:-assertz_if_new(parserTest(iWorld7,"A remote control is in the living room.")).  203:-assertz_if_new(parserTest(iWorld7,"A tv guide is a type of item.")).  204
  205tCol('tTvGuide').
  206:-assertz_if_new(parserTest(iWorld7,"A tv guide is in the living room.")).  207
  208%:-assertz_if_new(parserTest(iWorld7,"The paper clip is on the coffee table.")).
  209
  210:-assertz_if_new(parserTest(iWorld7,"A tv guide is a type of book.")).  211
  212toplevel_type(InstISA):-member(InstISA,[tWorld,tRegion,tAgent,tItem,tObj,ftSpec,tCol,ftTerm]).
  213% toplevel_type(InstISA):-ftSpec(InstISA).
  214
  215
  216get_ctx_isa(InstISA,Inst,InstISA):- toplevel_type(InstISA),must((isa(Inst,InstISA))),!.
  217get_ctx_isa(Inst,Inst,InstISA):- must(show_call(once(((toplevel_type(InstISA),isa(Inst,InstISA)))))),!.
  218
  219assert_text(InstIn,String):- get_ctx_isa(InstIn,Inst,InstISA),!,assert_text(Inst,InstISA,String).
  220
  221assert_text(Inst,InstISA,String):-  
  222                            % context changed   and not the tWorld?                                                  % v this is for when there was no prior context
  223  (parserVars(context,Inst0,_) -> (((Inst0 \==Inst),InstISA\==tWorld) -> (asserta_parserVars(isThis,Inst,InstISA)); true) ; (asserta_parserVars(isThis,Inst,InstISA))), 
  224    locally(parserVars(context,Inst,InstISA),assert_text_now(Inst,InstISA,String)).
  225
  226assert_text_now(Inst,InstISA,String):-   
  227 on_f_log_ignore(( 
  228  % parse the string to attributed text
  229 to_word_list(String,WL),!,to_icase_strs(WL,IC),!,   
  230   ((phrase(translation_dbg_on_fail(Inst,InstISA,PrologO),IC),
  231   assertz_if_new(asserted_text(Inst,String,PrologO)),     
  232     ain(onSpawn(PrologO)))))).
  233
  234:- kb_shared(asserted_text/3).  235
  236tCol(describedTyped).
  237describedTyped(tRegion).
  238describedTyped(tObj).
  239(describedTyped(Col),isa(Inst,Col),mudDescription(Inst,String)/ 
  240  ( \+asserted_text(Inst,String,_), \+assert_text(Inst,String))) ==> mudDescriptionHarder(Inst,String).
  241
  242:- export(to_icase_strs/2).  243to_icase_strs(WL,IC):-maplist(to_icase_str,WL,IC).
  244
  245
  246:- export(to_icase_str/2).  247% to_icase_str(SL,IC):-string_to_atom(SL,SA),string_to_atom(SS,SA),when(?=(IC,Y),(trace,(Y=SA;Y=SS))).
  248to_icase_str(SL,IC):-string_to_atom(SL,SA),string_to_atom(SS,SA),when(nonvar(IC);?=(IC,IC),(IC=SA;IC=SS)).
  249
  250
  251% somethingCanBe(tFountainDrink,[vSmall,vMedium,vLarge]).
  252
  253translation_for(Room,'tRegion',(isa(Room,'tCorridor'),isa(Room,'tWellLit')),WS,[]):-concat_atom(WS,' ',O),if_defined(tag_pos(O,IO),fail),IO = 
  254 ('S'('NP'('PRP'('You')),'VP'('VBP'(find),'NP'('PRP'(yourself)),'PP'('IN'(in),'NP'('NP'('DT'(the),'NN'(middle)),'PP'('IN'(of),
  255  'NP'('NP'('DT'(a),'ADJP'('RB'(well),'JJ'(lit)),'NN'(corridor)),'PP'('IN'(on),'NP'('DT'(the),'NN'('Enterprise')))))))))).
  256
  257translation_for(_Inst,_InstISA,t(M,Prolog),WS,WE):- once((append(LeftSide,RightSide,WS), modality(M,List,Replace),append(LeftL,List,LeftSide),
  258  append(LeftL,List,LeftSide),append(LeftL,Replace,Left),
  259   append(Left,RightSide,NewWS))),
  260   translation_w(Prolog,NewWS,WE),!.
  261translation_for(_Inst,_InstISA,Prolog) --> translation_w(Prolog).
  262translation_for(_Inst,_InstISA,Prolog,WS,WE):-locally(loosePass,translation_w(Prolog,WS,WE)).
  263
  264
  265translation_dbg_on_fail(Inst,InstISA,Prolog)-->translation_for(Inst,InstISA,Prolog),!.
  266translation_dbg_on_fail(Inst,InstISA,Prolog,WS,WE):-locally(debugPass,translation_for(Inst,InstISA,Prolog,WS,WE)).
  267
  268%:-assertz_if_new(parserTest(iWorld7,"Buffy the Labrador retriever is lounging here, shedding hair all over the place.")).
  269%:-assertz_if_new(parserTest(iWorld7,"You can also see a sugar candy doll house here.")).
  270
  271mudKeyword(tItem,"thing").
  272mudKeyword(isSelfRegion,"here").
  273mudKeyword(tThing,"object").
  274
  275==>
  276 type_action_info(tHumanControlled,
  277   actAddText(isOptional(tTemporalThing,isThis),ftText),
  278     "Development add some Text to a room.  Usage: addtext a sofa is in here").
  279
  280
  281a_command(Agent,actAddText(What,StringM)):- ground(What:StringM),
  282 locally(parserVars(isThis,What,ftTerm),
  283   locally(parserVars(isSelfAgent,Agent,tAgent),   
  284       must(assert_text(What,StringM)))).
  285
  286
  287translation_w(t(M,Prolog),WS,WE):- once((append(LeftSide,RightSide,WS), modality(M,List,Replace),append(LeftL,List,LeftSide),append(LeftL,Replace,Left),
  288   append(Left,RightSide,NewWS))),translation_w(Prolog,NewWS,WE),!.
  289translation_w(Prolog) --> translation_spo(More2,P,S,O),!,{conjoin(More2,t(P,S,O),Prolog)}.
  290
  291:-assertz_if_new(parserTest(iWorld7,"An emitter has a truth state called action keeping silent.",
  292   relationAllExists(mudActionKeepingSilient,tEmitter,ftBool))).  293translation_w(relationAllExists(mudActionKeepingSilient,tEmitter,ftBoolean))
  294  --> ['An',emitter,has,a,truth,state,called,action,keeping,silent].
  295
  296:-assertz_if_new(parserTest(iWorld7,"An object has a text called printed name.")).  297translation_w(relationAllExists(P,C,DT))  
  298  --> collection(C),[has,a],datatype(DT),[called],predicate_named(P).
  299
  300collection(C)-->subject(C,tCol,true).
  301datatype(ftBoolean)--> dcgOptional(detn(_)),[truth,state].
  302datatype(ftText)--> dcgOptional(detn(_)),[text].
  303datatype(ftTerm)--> dcgOptional(detn(_)),[value].
  304
  305predicate_named(Pred) --> dcgAnd(theText(Text),dcgLenBetween(1,5)),
  306  {toCamelAtom(Text,O),i_name(mud,O,Pred),ignore(assumed_isa(Pred,tPred))}.
  307
  308
  309assumed_isa(I,C):-isa(I,C),!.
  310assumed_isa(I,C):-loosePass,assert_isa(I,C),!.
  311
  312:- call(must(dcgAnd(dcgLenBetween(5,1),theText(_Text),[a,b,c],[]))).  313:- call(must(predicate_named(_P,[proper,-,named],[]))).  314
  315
  316:-assertz_if_new(parserTest(iWorld7,"An object can be proper-named or improper-named.",partitionedInto(tObj,tProperNamed,tImproperNamed))).  317translation_w(partitionedInto(C1,C2,C3)) --> collection(C1),[be],collection(C2),[or],collection(C3).
  318
  319
  320:-assertz_if_new(parserTest(iWorld7,"An object is usually improper-named.",relationMostInstance(isa,tObj,tImproperNamed))).  321translation_w(relationMostInstance(isa,C1,C2)) --> collection(C1),[is,usually],collection(C2).  
  322
  323:-assertz_if_new(parserTest(iWorld7,"A thing can be scenery.", relationSomeInstance(isa,tItem,tScenery))).  324translation_w(relationSomeInstance(isa,C1,C2)) --> collection(C1),[be],collection(C2).  
  325
  326:-assertz_if_new(parserTest(iWorld7,"The outside is a direction.", t(isa,vOutside,vtDirection))).  327translation_w(isa(C1,C2)) --> detn(def),col(v,C1),[is,a],col(vt,C2).  
  328
  329col(Pfx,C)-->subject(C,_,true),{atom_concat(Pfx,_,C)}.
  330col(_Pfx,C)-->{loosePass},subject(C,_,true).
  331
  332% set of small things in the world
  333tCol(tSmall).  % I dont like doing this with adjectives.. but it cant be argued to be sane
  334tSmall(X) <==> mudSize(X,vSmall).
  335
  336% set of green things in the world
  337tCol(tGreen).
  338tGreen(X) <==> mudColor(X,vGreen).
  339
  340:-check_clause_counts.  341
  342%:-assertz_if_new(parserTest(iWorld7,"All green books are small.", (tGreen(X),tBook(X))==>tSmall(X))).
  343%:-assertz_if_new(parserTest(iWorld7,"Most green books are small.", pfc_default((tGreen(X),tBook(X))==>tSmall(X)))).
  344
  345/*   The litmus
  346
  347A thing can be lit or unlit. A thing is usually unlit.
  348
  349Y can be C1 or C2.  
  350Y is [usually] C2.
  351
  352
  353An object has a text called printed name.  --> relationAllExists(mudPrintedName,tObj,ftText).
  354An object has a text called printed plural name.  --> mudPrintedPluralName(tObj,ftText).
  355An object has a text called an indefinite article.  --> mudIndefinateArticle(tObj,ftText).
  356An object can be plural-named or singular-named. An object is usually singular-named.  
  357                                                     --> partitionedInto(tObj,tSingularNamed,tPluralNamed). 
  358                                                         relationMostInstance(isa,tObj,tSingularNamed).
  359
  360An object can be proper-named or improper-named. An object is usually improper-named.
  361                                             --> partitionedInto(tObj,tProperNamed,tImproperNamed).  
  362                                                 relationMostInstance(isa,tObj,tImproperNamed).
  363
  364A room can be privately-named or publically-named. A room is usually publically-named.
  365                                             --> partitionedInto(tRoom,tPrivatelyNamed,tPublicallyNamed). 
  366                                                 relationMostInstance(isa,tObj,tPublicallyNamed).
  367
  368
  369A room can be lighted or dark. A room is usually lighted.
  370A room can be visited or unvisited. A room is usually unvisited.
  371A room has a text called description.
  372
  373
  374
  375
  376A thing can be edible or inedible. A thing is usually inedible.
  377A thing can be fixed in place or portable. A thing is usually portable.
  378
  379A thing can be scenery.   -->  relationSomeInstance(isa,tItem,tScenery).
  380A thing can be wearable.  -->  relationSomeInstance(isa,tItem,tWearAble).
  381
  382A thing can be pushable between rooms.   -->  relationSomeInstance(isa,tItem,tPushAble).  % between rooms?
  383
  384A direction is a type of value.  -->  isa(vtDirection,ttValueType).
  385The north is a direction.  -->  isa(vNorth,vtDirection).
  386The northeast is a direction.  --> ..
  387The northwest is a direction.
  388The south is a direction.
  389The southeast is a direction.
  390The southwest is a direction.
  391The east is a direction.
  392The west is a direction.
  393The up is a direction.
  394The down is a direction.
  395The inside is a direction.
  396The outside is a direction.
  397
  398The north has opposite south. Understand "n" as north.   --> mudHasOpposite(vNorth,vSouth).  mudKeyword(vNorth,"n").
  399The northeast has opposite southwest. Understand "ne" as northeast.
  400The northwest has opposite southeast. Understand "nw" as northwest.
  401The south has opposite north. Understand "s" as south.
  402The southeast has opposite northwest. Understand "se" as southeast.
  403The southwest has opposite northeast. Understand "sw" as southwest.
  404The east has opposite west. Understand "e" as east.
  405The west has opposite east. Understand "w" as west.
  406Up has opposite down. Understand "u" as up.
  407Down has opposite up. Understand "d" as down.
  408Inside has opposite outside. Understand "in" as inside.
  409Outside has opposite inside. Understand "out" as outside.
  410
  411??????? TODO ?????????
  412The inside object translates into I6 as "in_obj".
  413The outside object translates into I6 as "out_obj".
  414
  415??????? TODO ?????????
  416The verb to be above implies the mapping up relation.
  417The verb to be mapped above implies the mapping up relation.
  418The verb to be below implies the mapping down relation.
  419The verb to be mapped below implies the mapping down relatio
  420
  421A door has an object called other side.
  422The other side property translates into I6 as "door_to".
  423Leading-through relates one room (called the other side) to various doors.
  424The verb to be through implies the leading-through relation.
  425
  426S33. Containers and supporters. The carrying capacity property is the exception to the remarks above
  427about the qualitative nature of the world model: here for the first and only time we have a value which can
  428be meaningfully compared.
  429Section SR1/6 - Containers
  430The specification of container is "Represents something into which portable
  431things can be put, such as a teachest or a handbag. Something with a really
  432large immobile interior, such as the Albert Hall, had better be a room
  433instead."
  434A container can be enterable.
  435A container can be opaque or transparent. A container is usually opaque.
  436A container has a number called carrying capacity.
  437The carrying capacity of a container is usually 100.
  438Include (- has container, -) when defining a container
  439
  440The specification of supporter is "Represents a surface on which things can be
  441placed, such as a table."
  442A supporter can be enterable.
  443A supporter has a number called carrying capacity.
  444The carrying capacity of a supporter is usually 100.
  445A supporter is usually fixed in place.
  446Include (-
  447has transparent supporter
  448-) when defining a supporte
  449
  450A door can be open or closed. A door is usually closed.
  451A door can be openable or unopenable. A door is usually openable.
  452A container can be open or closed. A container is usually open.
  453A container can be openable or unopenable. A container is usually unopenable.
  454
  455Before rules is a rulebook. [20]
  456Instead rules is a rulebook. [21]
  457Check rules is a rulebook. [22]
  458Carry out rules is a rulebook. [23]
  459After rules is a rulebook. [24]
  460Report rules is a rulebook. [25]
  461
  462Action-processing rules is a rulebook. [10]
  463The action-processing rulebook has a person called the actor.
  464Setting action variables is a rulebook. [11]
  465The specific action-processing rules is a rulebook. [12]
  466The specific action-processing rulebook has a truth state called action in world.
  467The specific action-processing rulebook has a truth state called action keeping silent.
  468The specific action-processing rulebook has a rulebook called specific check rulebook.
  469The specific action-processing rulebook has a rulebook called specific carry out rulebook.
  470The specific action-processing rulebook has a rulebook called specific report rulebook.
  471The specific action-processing rulebook has a truth state called within the player''s sight.
  472The player''s action awareness rules is a rulebook. [13]
  473S16. The rules on accessibility and visibility, which control whether an action is physically possible, have
  474named outcomes as a taste of syntactic sugar.
  475Accessibility rules is a rulebook. [14]
  476Reaching inside rules is an object-based rulebook. [15]
  477Reaching inside rules have outcomes allow access (success) and deny access (failure).
  478Reaching outside rules is an object-based rulebook. [16]
  479Reaching outside rules have outcomes allow access (success) and deny access (failure).
  480Visibility rules is a rulebook. [17]
  481Visibility rules have outcomes there is sufficient light (failure) and there is
  482insufficient light (success).
  483S17. Two rulebooks govern the processing of asking other people to carry out actions:
  484Persuasion rules is a rulebook. [18]
  485Persuasion rules have outcomes persuasion succeeds (success) and persuasion fails (failure).
  486Unsuccessful attempt by is a rulebook. [19
  487
  488*/
  489:- include(prologmud(mud_footer)).  490:- all_source_file_predicates_are_transparent.