23:- multifile(baseKB:agent_action_queue/3). 24:- dynamic(baseKB:agent_action_queue/3). 25
26:- thread_local(t_l:disable_px/0). 27:- retractall(t_l:disable_px). 28
29:- must(\+ t_l:disable_px). 30
31
38:- set_prolog_flag(runtime_speed, 0). 39:- set_prolog_flag(runtime_safety, 2). 40:- set_prolog_flag(runtime_debug, 2). 41:- set_prolog_flag(unsafe_speedups, false). 42
43:- set_prolog_flag(expect_pfc_file,always). 44
45
46listing_break(G):- cwc, listing(G),break.
47
48:- dynamic(baseKB:agent_call_command/2). 49:- import(baseKB:agent_call_command/2). 50
52
53
54:- assert_until_eof(infSupertypeName). 55:- call_on_eof(dmsg(infSupertypeName)). 56
57:- include(prologmud(mud_header)). 58
59
61
63:- expects_dialect(pfc). 64
65
66:- expects_dialect(swi). 67
68:- kb_global(baseKB:( irc_event_hooks/3)). 69:- kb_global(baseKB:( deliver_event_hooks/2)). 70:- kb_global(baseKB: irc_user_plays/3). 71
72:- kb_global(baseKB: mudDescription/2). 73:- kb_global(baseKB: term_specifier_text/2). 74:- kb_global(baseKB: type_action_info/3). 75:- kb_global(baseKB: update_charge/2). 76:- kb_global(baseKB: update_stats/2). 77:- kb_global(baseKB: use_usable/4). 78:- kb_global(baseKB: text_actverb/2). 79:- kb_global(baseKB: vtActionTemplate/1). 81:- kb_global(baseKB: mud_test/1). 82:- kb_global(baseKB: mud_test/2). 83:- kb_global(baseKB: mud_test_local/0). 84:- kb_global(baseKB: mud_test_local/1). 85:- kb_global(baseKB: mud_test_local/2). 86:- kb_global(baseKB: world_agent_plan/3). 87:- kb_global(baseKB: action_info/2). 88:- kb_global(baseKB: action_rules/4). 89:- kb_global(baseKB: action_verb_useable/5). 90:- kb_global(baseKB: agent_command/2). 91:- kb_global(baseKB: agent_command_fallback/2). 92:- kb_global(baseKB: agent_text_command/4). 93:- kb_global(baseKB: check_permanence/4). 94
95:- expects_dialect(pfc). 96
97
98:-op(0,fx, ('disabled')). 99:-op(0,fx, ('enabled')). 100:-op(0,fy, ('disabled')). 101:-op(0,fy, ('enabled')). 103
104:- multifile(user_db:grant_openid_server/2). 105:- dynamic(user_db:grant_openid_server/2). 106
107:- kb_shared('$was_imported_kb_content$'/2). 108:- discontiguous('$was_imported_kb_content$'/2). 109:- kb_shared( disabled/1). 110:- discontiguous( disabled/1). 111:- kb_shared( enabled/1). 112:- discontiguous( enabled/1). 113:- kb_shared(was_enabled/1). 114:- discontiguous( was_enabled/1). 115:- kb_shared(listing_mpred_hook/1). 116
117:- kb_shared(genls/2). 118:- kb_shared( isa/2). 119
120:- style_check((-(singleton))). 121
129
130
131:- set_prolog_flag(double_quotes, atom). 132:- set_prolog_flag(double_quotes, string).
133:- set_prolog_flag(generate_debug_info, true). 134
137
140:- kb_shared( tChannel/1). 141
142
143:- kb_shared( pfcManageHybrids/0). 144:- kb_shared( defnSufficient/2). 147:- thread_local(t_l:repl_to_string/2). 148:- thread_local(t_l:repl_writer/2). 149:- thread_local(t_l:into_form_code/0). 152:- kb_shared( loading_module_h/1). 153:- kb_shared( registered_module_type/2). 154:- kb_shared( must_compile_special_clause_file/1). 155
157:- kb_shared( decl_coerce/3). 158:- kb_shared( listen_to_ops/2). 159:- kb_shared( deduce_facts/2). 160:- kb_shared( default_type_props/3). 161:- kb_shared( fact_always_true/1). 162:- kb_shared( fact_is_false/2). 163:- kb_shared( fact_maybe_deduced/1). 164:- kb_shared( never_assert_u/2). 165:- kb_shared( impl_coerce_hook/3). 166
167:- kb_shared( create_random_fact/1). 172
174
175:- kb_shared( now_unused/1). 176:- kb_shared( provide_mpred_read_attributes/3). 177:- kb_shared( provide_mpred_setup/4). 178:- kb_shared( provide_mpred_clauses/3). 179:- kb_shared( provide_mpred_op/2). 180:- kb_shared( provide_mpred_write_attributes/2). 181
184
186:- dynamic(lmcache:after_mpred_load/0). 187:- thread_local(use_cyc_database/0). 188:- kb_shared( use_cyc_database/0). 189
190:- kb_shared( fact_is_false/2). 192
193
195:- kb_shared( only_if_pttp/0). 196:- kb_shared( use_kif/2). 210
211:- kb_global(baseKB: term_specifier_text/2). 212:- kb_global(baseKB: update_charge/2). 213:- kb_global(baseKB: update_stats/2). 214:- kb_global(baseKB: use_usable/4). 215:- kb_global(baseKB: text_actverb/2). 216:- kb_global(baseKB: vtActionTemplate/1). 217:- kb_global(baseKB: mud_test/0). 218:- kb_global(baseKB: mud_test/1). 219:- kb_global(baseKB: mud_test/2). 220:- kb_global(baseKB: mud_test_local/0). 221:- kb_global(baseKB: mud_test_local/1). 222:- kb_global(baseKB: mud_test_local/2). 223:- kb_global(baseKB: world_agent_plan/3). 224:- kb_global(baseKB: action_info/2). 225:- kb_global(baseKB: action_rules/4). 226:- kb_global(baseKB: action_verb_useable/5). 227:- kb_global(baseKB: agent_command/2). 228:- kb_global(baseKB: agent_text_command/4). 229:- kb_global(baseKB: check_permanence/4). 230
231
233
235
237
238:- op(500,fx,'~'). 239:- op(1050,xfx,('=>')). 240:- op(1050,xfx,'<==>'). 241:- op(1050,xfx,('<-')). 242:- op(1100,fx,('==>')). 243:- op(1150,xfx,('::::')). 244
245:- dynamic(baseKB:mudTermAnglify/2). 246:- discontiguous(baseKB:mudTermAnglify/2). 247
248tWorld(iWorld7).
249
254ttExpressionType(ftProlog).
255
257
259
262
264
265ttExpressionType(ftChangeQuantity).
266:- assert((ftChangeQuantity(X):- compound(X),arg(X,1,Q),quotedIsa(Q,ftNumber))). 267
268
270
272
273:- dynamic(tItem/1). 274:- dynamic(ttAgentType/1). 275
276
277
278:- dynamic(disjointWith/2). 279/*
280disjointWith(A,B):- A=B,!,fail.
281disjointWith(A,B):- disjointWithT(A,B).
282disjointWith(A,B):- disjointWithT(AS,BS),transitive_subclass_or_same(A,AS),transitive_subclass_or_same(B,BS).
283disjointWith(A,B):- once((type_isa(A,AT),type_isa(B,BT))),AT \= BT.
284*/
285
286disjointWith(Sub, Super) ==> disjointWith( Super, Sub).
287disjointWith(tObj,tRegion).
288disjointWith(ttSpatialType,ttAbstractType).
289
290
291rtBinaryPredicate(arity).
292
295
297prologHybrid(relationMostInstance(rtBinaryPredicate,tCol,vtValue)).
299prologHybrid(relationAllInstance(rtBinaryPredicate,tCol,vtValue)).
300relationAllInstance(BP,_,_)==>rtBinaryPredicate(BP).
301
302
303% (isa(Inst,Type), tCol(Inst)) ==> isa(Type,ttTypeType).
304% (isa(TypeType,ttTypeType) , isa(Inst,TypeType), genls(SubInst,Inst)) ==> isa(SubInst,TypeType).
305
306(sometimesSlow, ttExpressionType(FT),{compound(FT)})==>meta_argtypes(FT).
307
308tCol(vtDirection).
309
310 311
312tCol(tCol).
313
314:- must(ain(tCol(tAgent))). 315
316
324dividesBetween(tHominid,tMale,tFemale).
325dividesBetween(tAgent,tHumanControlled,tNpcAgent).
326dividesBetween(tObj,tItem,tAgent).
327dividesBetween(tItem,tMassfull,tMassless).
328disjointdividesBetween(tObj,tMassfull,tMassless).
329dividesBetween(tSpatialThing,tObj,tRegion).
330dividesBetween(tTemporalThing,tObj,tRegion).
331formatted_resultIsa(ftDiceFn(ftInt,ftInt,ftInt),ftInt).
333
335
336
337
338
339rtArgsVerbatum(functorIsMacro).
340% tCol(ArgsIsa):-mpred_is_trigger(ArgsIsa).
341% tCol(ArgsIsa):-ttRelationType(ArgsIsa).
342% TODO decide if OK
343%(mpred_prop(_,_,meta_argtypes(ArgTypes)),{is_declarations(ArgTypes)}) ==> meta_argtypes(ArgTypes).
344
345tSet(COL)==>tCol(COL).
346ttExpressionType(COL)==>tCol(COL).
347
348
349tCol(functorIsMacro).
350tCol(tCol).
351tCol(tFunction).
352tCol(tPred).
353tCol(tRelation).
354tCol(ttExpressionType).
355tCol(ttSpatialType).
356tCol(vtActionTemplate).
357tSet(tCol).
358tSet(tContainer).
359tSet(tFunction).
360tSet(tPred).
361tSet(tRegion).
362tSet(tRelation).
363ttTypeType(ttExpressionType).
364ttTypeType(ttSpatialType).
365
366ftSpec(vtActionTemplate).
367
368isa(tRegion,ttSpatialType).
369isa(tRelation,ttAbstractType).
370
373
375
377
378
379tCol(tFly).
380
381prologHybrid(localityOfObject(tObj,tSpatialThing)).
382
383
384persistInMudIsa(tItem).
385persistInMudIsa(tAgent).
386persistInMudIsa(tRegion).
387
388sometimesHack(genls).
389
390~tPathway(apathFn(iOfficeRoom7, vNorth)).
391
392tPathway(PATH):- cwc, PATH=@=apathFn(iOfficeRoom7, vNorth),trace_or_throw(error(tPathway(PATH))).
393
394
395(sometimesSlow, tCol(Col), {isa_from_morphology(Col,Type)}) ==> isa(Col,Type).
396
397(sometimesSlow, tInstance(Inst), {isa_from_morphology(Inst,Type)}) ==> isa(Inst,Type).
398
399% HOW TO MAKE THIS FAST? isa(Inst,Type) <= {isa_from_morphology(Inst,Type)}.
400
401%((disjointWith(P1,P2) , genls(C1,P1), {dif:dif(C1,P1)}) ==> disjointWith(C1,P2)).
402% (disjointWith(C1,P2) <- (genls(C1,P1), {dif:dif(C1,P1)}, disjointWith(P1,P2))).
403
404% :- rtrace.
405completelyAssertedCollection(Complete)==> {must( baseKB: ( \+ ttExpressionType(Complete)))}.
406
407
408==> tSourceCode(iSourceCode7,comment("PrologMUD Server code")).
409==> tSourceData(iSourceData8,comment("PrologMUD WorldState Data")).
410
411
414
415
417
418tCol(completelyAssertedCollection).
419rtArgsVerbatum(completeIsaAsserted).
420tSpatialThing(I)==>completeIsaAsserted(I).
421genls(completelyAssertedCollection,tCol).
422completelyAssertedCollection(tItem).
423completelyAssertedCollection(tRegion).
424completelyAssertedCollection(tObj).
426completelyAssertedCollection(tAgent).
427completelyAssertedCollection(tCarryAble).
428completelyAssertedCollection(vtVerb).
430
431
432ttTypeType(completeIsaAssertedType).
433
434completeIsaAssertedType(Col) ==> (isa(I,Col) ==> completeIsaAsserted(I)).
435completeIsaAssertedType(tAgent).
436completeIsaAssertedType(tCarryAble).
437completeIsaAssertedType(tObj).
438
439tCol(ttTypeByAction).
440:-must(ain(tCol(ttTypeByAction))). 441:- nortrace. 442
443
444
445genls(ttTypeByAction,completelyAssertedCollection).
446
448dividesBetween(tItem,tMassfull,tMassless).
449dividesBetween(tSpatialThing,tObj,tRegion).
450dividesBetween(tObj,tItem,tAgent).
451dividesBetween(tObj,tMassfull,tMassless).
452dividesBetween(tAgent,tHumanControlled,tNpcAgent).
453
454((sometimesBuggy,genls(A,B)/ground(genls(A,B)))==>{call((call((trace,(must(ain(tCol(A))),must(ain(tCol(B))))))))}).
455
456((sometimesBuggy,dividesBetween(S,C1,C2),{ground(S:C1:C2)}) ==> ((disjointWith(C1,C2) , genls(C1,S) ,genls(C2,S)))).
457
459
460neg(isa(I,Super)) :- {ground(isa(I,Super))}, (isa(I,Sub), disjointWith(Sub, Super)).
462
463
464tCol(ttSpatialType).
465
466
482
483typeCheckDecl(vtActionTemplate(ArgTypes),is_declarations(ArgTypes)).
484
485% Representations
486vtActionTemplate(ArgTypes)/is_declarations(ArgTypes) ==> meta_argtypes(ArgTypes).
487
488((meta_argtypes(ArgTypes)/get_functor(ArgTypes,F)),vtVerb(F))==>vtActionTemplate(ArgTypes).
489
490
491
492argIsa(aDirectionsFn,2,ftListFn(vtDirection)).
493argIsa(apathFn,1,tRegion).
494argIsa(apathFn,2,vtDirection).
495argIsa(localityOfObject,1,tObj).
496argIsa(localityOfObject,2,tSpatialThing).
497argIsa(mudColor,1,tObj).
498argIsa(mudColor,2,vtColor).
499argIsa(mudFacing,1,tObj).
500argIsa(mudFacing,2,vtDirection).
501argIsa(mudMemory,2,ftTerm).
502
503tCol(vtVerb).
504
505
506
507tCol(tChannel).
508tSet(tItem).
509tCol(vtVerb).
510
529prologIsFlag(tThinking(tAgent)).
530
531==> prologHybrid(isEach(mudLastCmdSuccess/3,mudLastCommand/2,mudNamed/2, mudSpd/2,mudStr/2,typeGrid/3)).
532
533singleValuedHybrid(F)==>(singleValued(F),prologHybrid(F)).
534
535:- dynamic(isa/2). 536:- dynamic(mudDescription/2). 537:- dynamic((tItem/1, tRegion/1, instVerbOverride/3,mudNamed/2, determinerString/2, mudKeyword/2 ,descriptionHere/2, mudToHitArmorClass0/2, tThinking/1, tDeleted/1, mudWeight/2, mudPermanence/3, act_term/2, mudAgentTurnnum/2, mudAtLoc/2, mudEnergy/2, mudHealth/2, mudDescription/2, mudFacing/2, mudCmdFailure/2, mudSpd/2, typeGrid/3, mudHeight/2, mudMemory/2, pathName/3, mudPossess/2, mudScore/2, mudStm/2, mudStr/2, wearsClothing/2)). 538:- dynamic((mudArmorLevel/2, mudLevelOf/2, mudToHitArmorClass0/2, mudBareHandDamage/2,
539 chargeCapacity/2, mudEnergy/2, tCol/1, tAgent/1, tItem/1, tRegion/1, instVerbOverride/3,
540 mudNamed/2, determinerString/2, mudKeyword/2 ,descriptionHere/2, tThinking/1, mudWeight/2,
541 mudPermanence/3, act_term/2, mudAgentTurnnum/2, mudAtLoc/2, mudEnergy/2, mudHealth/2,
542 mudDescription/2, mudFacing/2, failure/2, gridValue/4, mudHeight/2, mudMemory/2, isa/2, pathName/3, mudPossess/2, mudScore/2, mudStm/2, mudStr/2, mudWearing/2)). 543
544
545
546==> prologMultiValued(mudDescription(ftTerm,ftString),[prologOrdered,prologHybrid]).
547prologMultiValued(mudDescription(ftTerm,ftText), [predProxyAssert(add_description),predProxyRetract(remove_description),predProxyQuery(query_description)],prologHybrid).
548==> prologMultiValued(mudDescription(ftTerm,ftText),[predProxyAssert(add_description),prologHybrid]).
549==> prologMultiValued(mudKeyword(ftTerm,ftString),prologHybrid).
550prologMultiValued(mudMemory(tAgent,ftTerm),prologHybrid).
551prologMultiValued(mudNamed(ftTerm,ftTerm),prologHybrid).
552prologMultiValued(mudPossess(tObj,tObj),prologHybrid).
553prologMultiValued(nameString(ftTerm,ftString),prologHybrid).
554prologMultiValued(pathDirLeadsTo(tRegion,vtDirection,tRegion),prologHybrid).
555prologMultiValued(pathName(tRegion,vtDirection,ftString),prologHybrid).
556prologMultiValued(genls(tCol,tCol),prologHybrid).
557==> prologSingleValued(typeGrid(tCol,ftInt,ftListFn(ftString)),prologHybrid).
558
559prologMultiValued(typeGrid(tCol,ftInt,ftListFn(ftString)),prologHybrid).
560
561prologMultiValued(verbAsWell(ftTerm,ftAction,ftAction),prologHybrid).
562
563prologNegByFailure(mudNeedsLook(tObj,ftBoolean),prologHybrid).
564prologNegByFailure(tAgent(ftID),prologHybrid).
565prologNegByFailure(tCol(ftID),prologHybrid).
566prologNegByFailure(tCol(ftID),prologHybrid).
567prologNegByFailure(tItem(ftID),prologHybrid).
568prologNegByFailure(tRegion(ftID),prologHybrid).
569prologNegByFailure(tThinking(tAgent),prologHybrid).
570pathName(Region,Dir,Text)==>mudDescription(apathFn(Region,Dir),Text).
571
572
573==> prologSingleValued(chargeCapacity(tChargeAble,ftInt),prologHybrid).
574prologSingleValued(location_center(tRegion,xyzFn(tRegion,ftInt,ftInt,ftInt)),prologHybrid).
575==> prologSingleValued(mudAgentTurnnum(tAgent,ftInt),[relationMostInstance(tAgent,0)],prologHybrid).
577
578
579singleValuedHybrid(mudArmor(tObj,ftInt)).
580singleValuedHybrid(mudArmorLevel(tWearAble,ftInt)).
581:- mpred_notrace_exec. 582
583singleValuedHybrid(mudAtLoc(tObj,xyzFn(tRegion,ftInt,ftInt,ftInt))).
584singleValuedHybrid(mudAttack(tObj,ftInt)).
585singleValuedHybrid(mudBareHandDamage(tAgent,ftInt)).
587
588
590singleValuedHybrid(mudEnergy(tChargeAble,ftInt)).
591==> prologSingleValued(mudEnergy(tObj,ftInt),[relationMostInstance(tAgent,90),relationMostInstance(tChargeAble,130)],prologHybrid).
592==> prologSingleValued(mudHygiene(tObj,ftInt),[relationMostInstance(tObj,90)],prologHybrid).
593
594:- mpred_notrace_exec. 595:- ain(==>((prologSingleValued(mudFacing(tObj,vtDirection),[relationMostInstance(tObj,vNorth)],prologHybrid)))). 596
597
598singleValuedHybrid(mudPermanence(tItem,vtVerb,vtPerminance)).
599singleValuedHybrid(mudHealth(tObj,ftInt)).
600singleValuedHybrid(mudHeight(tObj,ftInt)).
601singleValuedHybrid(mudHeight(tSpatialThing,ftInt)).
602singleValuedHybrid(mudID(tObj,ftID)).
603singleValuedHybrid(mudLevelOf(tCarryAble,ftInt)).
604singleValuedHybrid(mudWeight(tObj,ftInt)).
605
606singleValuedHybrid(mudMaxHitPoints(tAgent,ftInt),[prologHybrid],prologHybrid).
607singleValuedHybrid(mudLastCommand(tAgent,ftAction)).
608==> prologSingleValued(mudNonHunger(tAgent,ftInt),[relationMostInstance(tAgent,90)],prologHybrid).
609==> prologSingleValued(mudMoveDist(tAgent,ftInt),[relationMostInstance(tAgent,1)]).
610==> prologSingleValued(mudNeedsLook(tAgent,ftBoolean),relationMostInstance(tAgent,vFalse),prologHybrid).
611singleValuedHybrid(mudScore(tAgent,ftInt)).
612singleValuedHybrid(mudSpd(tAgent,ftInt)).
613singleValuedHybrid(mudStm(tAgent,ftInt)).
614singleValuedHybrid(mudStr(tAgent,ftInt)).
615singleValuedHybrid(mudToHitArmorClass0(tAgent,ftInt)).
617
618==> prologSingleValued(spawn_rate(tCol,ftInt)).
619==> prologSingleValued(stat_total(tAgent,ftInt)).
620
621resultIsa(apathFn,tPathway).
623'<==>'(mudDescription(apathFn(Region,Dir),Text),pathName(Region,Dir,Text)).
624'<==>'(nameString(apathFn(Region,Dir),Text),pathName(Region,Dir,Text)).
625
626
627rtDeduceArgTypes(pathDirLeadsTo).
628rtDeduceArgTypes(F)/current_predicate(F,P),argIsa(F,N,T)/arg(N,P,E),{call(P)}==>isa(E,T).
629
630vtValue(Val)/(atom(Val),i_name_lc(Val,KW))==>mudKeyword(Val,KW).
631
632ttPredAndValueType(Str)/
633 (i_name('mud',Str,Pred),
634 i_name('vt',Str,VT)) ==>
635 (rtRolePredicate(Pred),
636 ttValueType(VT),
637 mudKeyword(VT,Str),mudKeyword(Pred,Str),
638 argIsa(Pred,2,VT),
639 argIsa(Pred,1,tTemporalThing)).
640
642ttPredAndValueType("size").
643ttPredAndValueType("texture").
644ttPredAndValueType("color").
645:- mpred_notrace_exec. 646ttPredAndValueType("shape").
647ttPredAndValueType("material").
648
649
652
654
655ttValueType(vtSize).
656ttValueType(vtTexture).
657ttValueType(vtColor).
658
659ttValueType(VT)==>tInferInstanceFromArgType(VT).
660
661prologHybrid(typeHasGlyph(tCol,ftString)).
662prologHybrid(mudMaxHitPoints(tAgent,ftInt)).
663prologHybrid(mudStowing(tAgent,tItem)).
665
666prologHybrid(text_actverb(ftText,vtVerb)).
667:- sanity(((argIsa(text_actverb,1,C);argQuotedIsa(text_actverb,1,C)))). 668
669:-dynamic((latitude/2, mudMoveDist/2, longitude/2)). 670prologHybrid(typeHasGlyph,2).
671prologHybrid(mudActAffect/3).
672prologHybrid(mudAtLoc,2).
673prologHybrid(mudColor/2).
674prologHybrid(mudHealth,2).
675prologHybrid(mudMaterial/2).
676prologHybrid(mudNeedsLook,2).
677:- kb_global(baseKB:mudNeedsLook/2). 678prologHybrid(mudNeedsLook/2,[completeExtentAsserted]).
679prologHybrid(mudShape/2).
680prologHybrid(mudSize/2).
681prologHybrid(mudTexture/2).
682prologHybrid(pathDirLeadsTo/3).
683prologDynamic(mudMoveDist/2).
684:- dynamic(mudMoveDist/2). 685meta_argtypes(mudMoveDist(tAgent,ftInt)).
687prologDynamic(stat_total/2).
688
689:- dynamic(vtBasicDir/1). 690
691tCol(vtBasicDir).
692:- must(ain(tCol(vtBasicDirPlusUpDown))). 694tCol(vtDirection).
695tCol(vtVerb).
696:- dynamic(stat_total/2). 697:- dynamic(spawn_rate/2). 698tCol(mobMonster).
700prologDynamic(agent_command(tAgent,ftAction)).
701:- ain(prologSideEffects(agent_command(tAgent,ftAction))). 703prologDynamic(mud_test(ftTerm,ftCallable)).
704prologDynamic(use_action_templates(ftTerm)).
705
706
707prologHybrid(typeHasGlyph(tCol,ftString)).
708prologHybrid(mudColor(tSpatialThing,vtColor)).
709prologHybrid(mudKnowing(tAgent,ftAssertion)).
710==> prologHybrid(mudLabelTypeProps(ftString,tCol,ftVoprop)).
711prologHybrid(mudListPrice(tItem,ftNumber)).
712:-dynamic(mudOpaqueness/2). 713prologHybrid(mudOpaqueness(ftTerm,ftPercent)).
714prologHybrid(mudPossess(tAgent,tObj)).
715prologHybrid(mudShape(tSpatialThing,vtShape)).
716prologHybrid(mudSize(tSpatialThing,vtSize)).
717prologHybrid(mudTextSame(ftText,ftText)).
718prologHybrid(mudTexture(tSpatialThing,vtTexture)).
719meta_argtypes(aDirectionsFn(ftTerm,ftListFn(ftTerm))).
720
721==>prologListValued(mudGetPrecepts(tAgent,ftListFn(tSpatialThing))). 722
723prologListValued(mudNearBody(tAgent,ftListFn(tSpatialThing)),[]).
724prologListValued(mudNearReach(tAgent,ftListFn(tSpatialThing))). 725prologMultiValued(action_rules(tAgent,vtVerb,ftListFn(ftVar),ftVoprop)).
726prologMultiValued(mudLastCmdSuccess(tAgent,ftAction,ftBoolean)).
727prologMultiValued(descriptionHere(ftTerm,ftString)).
728prologMultiValued(descriptionHere(ftTerm,ftString),prologOrdered).
729prologMultiValued(determinerString(ftTerm,ftString)).
730prologMultiValued(typeHasGlyph(ftTerm,ftString)).
731prologMultiValued(gridValue(tRegion,ftInt,ftInt,tObj)).
732prologMultiValued(instVerbOverride(ftTerm,ftAction,ftAction)).
733:- mpred_notrace_exec. 734prologMultiValued(isa(ftTerm,tCol)).
735prologMultiValued(mudActAffect(ftTerm,ftTerm,ftTerm)).
736prologMultiValued(mudActAffect(tItem,vtVerb,ftTerm(ftVoprop))).
737prologMultiValued(mudCmdFailure(tAgent,ftAction)).
738
739
740==> tPred(isEach(tAgent/1, mudEnergy/2,mudHealth/2, mudAtLoc/2, failure/2, typeGrid/3, gridValue/4, isa/2, tItem/1, mudMemory/2, pathName/3, mudPossess/2, tRegion/1, mudScore/2, mudStm/2, mudFacing/2, localityOfObject/2, tThinking/1, mudWearing/2, mudFacing/2, mudHeight/2, act_term/2, nameString/2, mudDescription/2, pathDirLeadsTo/3, mudAgentTurnnum/2)).
741prologHybrid(mudToHitArmorClass0 / 2).
742prologHybrid(mudAtLoc/2).
743prologBuiltin((baseKB:agent_command/2)).
744==> prologHybrid(isEach(argIsa/3, formatted_resultIsa/2, typeHasGlyph/2, inRegion/2,
745 mudContains/2, isa/2, mudLabelTypeProps/3, mudMemory/2, mudPossess/2, mudStowing/2,
746 genls/2, mudToHitArmorClass0/2, pddlSomethingIsa/2, resultIsa/2,
747 completeExtentAsserted/1, subFormat/2, tCol/1, tRegion/1, completelyAssertedCollection/1,
748 ttExpressionType/1, typeProps/2)).
749
750==> prologHybrid(isEach(tItem/1, tRegion/1, instVerbOverride/3,mudNamed/2, determinerString/2, mudKeyword/2 ,descriptionHere/2, mudToHitArmorClass0/2, tThinking/1, tDeleted/1, mudWeight/2, mudPermanence/3, act_term/2, mudAgentTurnnum/2, mudAtLoc/2, mudEnergy/2, mudHealth/2, mudDescription/2, mudFacing/2, mudCmdFailure/2, mudSpd/2, typeGrid/3, mudHeight/2, mudMemory/2, isa/2, pathName/3, mudPossess/2, mudScore/2, mudStm/2, mudStr/2, wearsClothing/2)).
751==> prologHybrid(isEach( mudArmorLevel/2, mudLevelOf/2, mudToHitArmorClass0/2, mudBareHandDamage/2, chargeCapacity/2, mudEnergy/2, tCol/1, tAgent/1, tItem/1, tRegion/1, instVerbOverride/3,mudNamed/2, determinerString/2, mudKeyword/2 ,descriptionHere/2, tThinking/1, mudWeight/2, mudPermanence/3, act_term/2, mudAgentTurnnum/2, mudAtLoc/2, mudEnergy/2, mudHealth/2, mudDescription/2, mudFacing/2, failure/2, gridValue/4, mudHeight/2, mudMemory/2, isa/2, pathName/3, mudPossess/2, mudScore/2, mudStm/2, mudStr/2, mudWearing/2)).
752
754
755arity(typeHasGlyph,2).
756arity(mudTermAnglify,2).
757arity(mudMaxHitPoints,2).
758
759
760prologHybrid(instVerbOverride(ftTerm,ftAction,ftAction)).
764isa(vtDirection,ttValueType).
765
766prologMultiValued(agent_text_command(tAgent,ftText,tAgent,ftAction)).
767
768formatted_resultIsa(apathFn(tRegion,vtDirection),tPathway).
769
770prologBuiltin(is_vtActionTemplate/1).
771
772is_vtActionTemplate(C):-nonvar(C),get_functor(C,F),!,atom_concat(act,_,F).
773
774defnSufficient(ftAction,is_vtActionTemplate).
775defnSufficient(ftAction,vtVerb).
776defnSufficient(ftTerm,vtValue).
777
778:- use_module(library(logicmoo_plarkc)). 779
780:- install_constant_renamer_until_eof. 781:- set_prolog_flag(do_renames_sumo,never). 782
783genls('FemaleAnimal',tAgent).
784genls('MaleAnimal',tAgent).
785==>genls(isEach('PortableObject','ProtectiveAttire','SomethingToWear'),tCarryAble).
786==>genls(isEach('ProtectiveAttire','SomethingToWear'),tWearAble).
787==>genls(isEach(tRegion,tAgent),tChannel).
788
789genls(tAgent,tObj).
790genls(tAgent,tSpatialThing).
791genls(tItem,tObj).
792genls(tItem,tSpatialThing).
793genls(tObj,tSpatialThing).
794genls(tPred,tRelation).
795genls(tRegion,tSpatialThing).
796genls(ttObjectType,tCol).
797genls(ttSpatialType,tCol).
798genls(tFunction,tRelation).
799tPred(meta_argtypes).
800meta_argtypes(aDirectionsFn(ftTerm,ftListFn(ftTerm))).
801meta_argtypes(apathFn(tRegion,vtDirection)).
802meta_argtypes(xyzFn(tRegion,ftInt,ftInt,ftInt)).
803
805
806genls(ttTypeByAction,tCol).
807
808% :-locally(set_prolog_flag(assert_attvars,true),ain(((ttTypeByAction(X) ==> tCol(X))))).
809
810% (isa(Inst,Type),isa(Type,ttTypeByAction)) ==> isa(Inst,tHasAction).
811
812ttTypeByAction(C),isa(I,C),{\+ is_in_world(I)} ==> \+ isa(I,C).
813
830
831
832genls(tAgent,tObj).
833genls(tAgent,tSpatialThing).
834genls(tItem,tObj).
835genls(tItem,tSpatialThing).
836genls(tObj,tSpatialThing).
837genls(tPred,tRelation).
838genls(tRegion,tSpatialThing).
839genls(tFunction,tRelation).
840
841genls(tCarryAble,tItem).
842genls(tChargeAble,tItem).
843genls(tContolDevice,tChargeAble).
844
845genls(tDoor,tFurniture).
846 847genls(tDrinkAble,tItem).
848genls(tEatAble,tItem).
849genls(tFurniture,tObj).
850genls(tFurniture,tPartofObj).
851genls(tHumanControlled,tAgent).
852genls(mobMonster,tAgentGeneric).
853genls(tNpcAgent,tAgent).
854genls(tPathway,tDoor).
855genls(tUseAble,tItem).
856genls(tWearAble,tItem).
857genls(vtBasicDir,vtBasicDirPlusUpDown).
858genls(vtBasicDirPlusUpDown,vtDirection).
859genls(vtDirection,vtValue).
860
861:- kb_shared(vtPosture/1). 862
863tCol(vtPosture).
864genls(vtPosture,vtVerb).
865
866
867action_to_able(actSearch,tSearchAble).
868action_to_able(actOperate,tOperateAble).
869action_to_able(actObserve,tObserveAble).
870(action_to_able(ACT,ABLE)==> ((argIsa(ACT,1,Type),isa(Type,ttObjectType))==> genls(Type,ABLE))).
871
872
873genlInverse(mudContains,mudInsideOf).
874
875
876arity(mudInsideOf,2).
877
878vtBasicDir(vEast).
879vtBasicDir(vNorth).
880vtBasicDir(vSouth).
881vtBasicDir(vWest).
882vtBasicDirPlusUpDown(vDown).
883vtBasicDirPlusUpDown(vUp).
888nameString(apathFn(Region,Dir),Text):- pathName(Region,Dir,Text).
889meta_argtypes(mudMaterial(tSpatialThing,vtMaterial)).
890meta_argtypes(mudTexture(tSpatialThing,vtTexture)).
891meta_argtypes(mudWearing(tAgent,tWearAble)).
892meta_argtypes(pathName(tRegion,vtDirection,ftString)).
893meta_argtypes(resultIsa(tFunction,tCol)).
894meta_argtypes(wasSuccess(tAgent,vtActionTemplate,ftBoolean)).
895meta_argtypes(type_action_info(tCol,vtActionTemplate,ftText)).
898
899tCol(ttAgentType).
900
901prologHybrid(pathDirLeadsTo(tRegion,vtDirection,tRegion)).
902
903
904
905
906==> prologHybrid(mudAreaConnected(tRegion,tRegion),rtSymmetricBinaryPredicate).
907rtArgsVerbatum(mudAreaConnected).
908
909rtSymmetricBinaryPredicate(mudAreaConnected).
910
912
913ttAgentType(mobMonster).
915
916
917==> ftSpec(vtActionTemplate).
918
919disjointWith(tObj,tRegion).
920disjointWith(tRegion,tObj).
921
922
923ttTemporalType(tAgent).
924ttTemporalType(tItem).
925ttTemporalType(tObj).
926ttTemporalType(tRegion).
927
928tCol(tChannel).
929tChannel(A):- tAgent(A).
930tChannel(A):- tRegion(A).
931tChannel(iGossupChannel).
933:-ain_expanded(isa(tObj,ttTemporalType)). 934:-ain_expanded(isa(tRegion,ttTemporalType)). 935
939
941genls(ttSetOrCollection, tCol).
943
944meta_argtypes(verb_affordance(vtVerb,tTemporalThing,rtStatPred,ftChangeQuantity,ftChangeQuantity)).
945
946prologHybrid(dividesBetween(tCol,tCol,tCol)).
947
949
950dividesBetween(tAgentGeneric,tAgent,tNonCorporialAgent).
951dividesBetween(tAgent,tMale,tFemale).
952dividesBetween(tAgent,tNpcAgent,tHumanControlled).
953dividesBetween(tItem,tMassfull,tMassless).
954dividesBetween(tObj,tItem,tAgent).
955dividesBetween(tObj,tMassfull,tMassless).
956dividesBetween(tSpatialThing,tObj,tRegion).
957dividesBetween(tTemporalThing,tObj,tRegion).
958formatted_resultIsa(ftDiceFn(ftInt,ftInt,ftInt),ftInt).
959
960isa(iDungeonMaster,tNonCorporialAgent).
961
962genls(tNonCorporialAgent,tMassless).
963
964isa(tRegion,ttTemporalType).
965
966completelyAssertedCollection(tNonCorporialAgent).
967completelyAssertedCollection(tAgentGeneric).
968completelyAssertedCollection(tItem).
969completelyAssertedCollection(tRegion).
970completelyAssertedCollection(tObj).
971completelyAssertedCollection(tAgent).
972completelyAssertedCollection(tCarryAble).
973completelyAssertedCollection(vtVerb).
974genls(ttTypeByAction,completelyAssertedCollection).
975
976arity(mudAreaConnected,2).
977
978
979% ensure_some_pathBetween(R1,R2):- cwc,must((ain(pathDirLeadsTo(R1,aRelatedFn(vtDirection,R1,R2),R2)),ain(pathDirLeadsTo(R2,aRelatedFn(vtDirection,R2,R1),R1)))),!.
980
981% mudAreaConnected(R1,R2)/ground(mudAreaConnected(R1,R2)) ==> isa(R1,tRegion),isa(R2,tRegion),mudAreaConnected(R2,R1).
982
983(mudAreaConnected(R1,R2)/
984 (ground(mudAreaConnected(R1,R2)),
985 \+ pathDirLeadsTo(R1,_,R2),
986 {sys_random_path_dir(Dir)},reverse_dir(Dir,Rev),\+ pathDirLeadsTo(R1,Dir,_NotR2),
987 \+ pathDirLeadsTo(R2,Rev,_NotR1))) ==>
988 pathDirLeadsTo(R1,Dir,R2).
989
990
992
994rtPartialFunction(apathFn).
995rtReifiableFunction(apathFn).
996
997pathDirLeadsTo(R1,Dir,R2)/reverse_dir(Dir,Rev) ==> pathDirLeadsTo(R2,Rev,R1).
998pathDirLeadsTo(R1,_,R2) ==> mudAreaConnected(R1,R2).
999
1000singleValuedInArg(pathDirLeadsTo,2).
1001
1002
1006
1007
1008genls(tAgent,tObj).
1009genls(tItem,tObj).
1010genls(tClothing, tWashAble).
1011genls(tClothing, tWearAble).
1012genls(tFood,tEatAble).
1013genls(tFood, tItem).
1014genls(tClothing, tItem).
1015
1016genls( tCarryAble, tItem).
1017genls( tCarryAble, tDropAble).
1018
1032
1035
1036genls(tPortableDevice,tCarryAble).
1037
1038prologIsFlag(spatialInRegion/1).
1039
1040:-do_gc. 1041
1042genls(tClothing, tFoldAble).
1043genls(tClothing, tWearAble).
1044
1045genls(tLiquidContainer, tDrinkAble).
1046genls(tLiquidContainer, tCarryAble).
1047
1048
1049genls(tFoldAble, tCarryAble).
1051genls(tPortableDevice,tCarryAble).
1052genls(tPortableDevice,tPhysicalDevice).
1053genls(tPhysicalDevice,tUseAble).
1054genls(tWearAble, tCarryAble).
1055genls(tFood,tCarryAble).
1056genls(tCarryAble,tObj).
1057genls(tPartofObj,tNotTakAble).
1058genls(tBodyPart,tPartofObj).
1059genls(tSpatialThing,tLookAble).
1060genls(tFurnature,tOntoAble).
1061genls(tFurnature,tItem).
1062
1063genls(tPartofFurnature,tPartofObj).
1064
1065
1066
1067
1068
1069
1070%(isa(I,Sub), disjointWith(Sub, Super)) ==> neg(isa(I,Super)).
1071
1072
1073 % mdefault(genls(tPartofObj,tItem)).
1074
1075
1076(sometimesBuggy,dividesBetween(S,C1,C2)/ground(v(S,C1,C2))) ==> (disjointWith(C1,C2) , genls(C1,S) ,genls(C2,S)).
1077
1079
1080
1081isa(tRegion,ttSpatialType).
1082isa(tRelation,ttAbstractType).
1083==>typeProps(tTorso,[mudColor(isLikeFn(mudColor,tSkin)),mudShape(vUnique)]).
1084==>typeProps(tSkin,[mudColor(vUnique),mudShape(vUnique)]).
1085
1088mudLabelTypeProps("--",tRegion,[]).
1089
1091
1092typeProps(tAgent,[predInstMax(mudHealth,500)]).
1094genls(tIndoorsIsolatedFromOutside, tRegion).
1096genls(tPlaceLikeSpaceInAHOC,tRegion).
1097
1098:- if( \+ current_prolog_flag(address_bits, 32)). 1100:- endif. 1101
1102
1104typeProps(tAgent,[mudMoveDist(1)]).
1106typeProps(tAgent,[predInstMax(mudHealth,500), predInstMax(mudEnergy,200), mudHealth(90),
1107 1108 mudFacing(vNorth), mudAgentTurnnum(0), mudScore(1)]).
1111
1112typeProps(tFood,[mudHeight(0)]).
1113
1114
1116typeProps(tItem,mudEnergy(140)).
1117
1118% I am developing a Conflict learning system that works for full FOL .. it works to produces conflict duce_tru horn clauses(HC) heads (as well as normally what is derived from HCs) of cource if i tried to ground the Conflists it produce exponeticals so what i do is enure all conflicts can be found by backchaining at a depth of three
1119typeProps(C,Ps)==> (isa(I,C)==>props(I,Ps)).
1120
1122
1124typeProps(tObj,mudOpaqueness(100)).
1125typeProps(tRegion,mudOpaqueness(1)).
1126% CRAZY typeProps(tSpatialThing,mudHeight(1)).
1127
1128% :-end_module_type(dynamic).
1129
1130
1131pass3==> (mudLabelTypeProps(Lbl,Type,Props)/ground(typeHasGlyph(Type,Lbl))==> (typeHasGlyph(Type,Lbl) , typeProps(Type,Props))).
1132
1133ps3:- cwc, with_mpred_trace_exec(ain(pass3)).
1134
1136mudLabelTypeProps("wl",tWall,[mudHeight(3),mudWeight(4)]).
1137
1138%TOO SLOW isa(I,SC)<=isa(I,C),genls(C,SC).
1139
1140wearsClothing(A,I)==>tAgent(A),tClothing(I).
1141
1142
1144rtBinaryPred(mudUniversallyRelated).
1145
1146synonomousExternalContext(conceptuallyRelated,iInform7System,mudUniversallyRelated).
1147
1149tSpatialTanability(mudIncorporationRelation).
1151tSpatialTanability(mudProducesRelation). 1152tSpatialTanability(mudSupportedBy). 1153tSpatialTanability(mudEnclosedBy). 1154
1155meta_argtypes(inPermeates(tSolidTangibleThinh, tLiquidTangibleThing)).
1156
1157tSpatialTanability(P)==>argsIsa(P,tTangible).
1167
1168
1169
1170genls(tBread, tFood).
1171
1172==>
1173 typeProps(tCrackers,
1174 [mudColor(vTan),tBread,
1175 mudShape(isEach(vCircular,vFlat)),
1176 mudSize(vSmall),
1177 mudTexture(isEach(vDry,vCoarse))]).
1178
1179nonvar_must_be(V,G):- (var(V);G),!.
1180
1181% TODO SPEED THIS UP
1182% mudKeyword(I,Str)<= {(nonvar(I);nonvar(Str)), nonvar_must_be(I,\+tCol(I)), nonvar_must_be(Str,string(Str))}, isa(I,Type),mudKeyword(Type,Str).
1183
1184pfc_slow((mudKeyword(Type,Str),tCol(Type),isa(I,Type)/(atom(I),ftID(I)) ==> mudKeyword(I,Str))).
1185
1186
1187baseKB:action_info(C,_)==>vtActionTemplate(C).
1188
1189completelyAssertedCollection(cachedPredicate).
1190
1191rtArgsVerbatum(cachedPredicate).
1192
1193ttRelationType(cachedPredicate).
1194cachedPredicate(P)/predicate_to_goal(P,Goal)==>{forall(call_u(Goal),ain(Goal))}.
1195
1196cachedPredicate(vtActionTemplate(_)).
1197
1198
1329
1330
1331:- dynamic(baseKB:mudNeedsLook/2). 1332:- export(baseKB:mudNeedsLook/2). 1333:- pfc_lib:import(baseKB:mudNeedsLook/2). 1334
1335
1336prologBuiltin(onEachLoad/0).
1337rtArgsVerbatum(onEachLoad).
1338rtArgsVerbatum(must).
1339
1340ttRelationType(rtStatPred).
1341
1342prologHybrid(normalAgentGoal(rtStatPred,ftTerm)).
1343
1344((rtRolePredicate(Pred)==>
1345 ((relationMostInstance(Pred,Type,Value))==>
1346 ((isa(X,Type))==>mdefault(t(Pred,X,Value)))))).
1347
1348
1349:- ain((relationMostInstance(Pred,Type,Value))==>
1350 ((isa(X,Type))==>mdefault(t(Pred,X,Value)))).
1351
1352
1353(rtStatPred(Pred)/must(atom(Pred))==>(
1354 arity(Pred,2),
1355 rtRolePredicate(Pred),
1356 singleValuedInArg(Pred,2),
1357 rtBinaryPredicate(Pred))).
1358
1359(((normalAgentGoal(Pred,N)/must(atom(Pred)) ==>
1360 ({kb_shared(Pred/2),
1361 AT=..[Pred,tAgent,ftPercent]},
1362 rtStatPred(Pred),
1363 meta_argtypes(AT),
1364 relationMostInstance(Pred,tAgent,N))))).
1365
1366normalAgentGoal(mudEnergy,140).
1367normalAgentGoal(mudHealth,90).
1368normalAgentGoal(mudHygiene,90).
1369
1370normalAgentGoal(mudNonHunger,90).
1371normalAgentGoal(mudBladderEmpty,90).
1372normalAgentGoal(mudSecureRoom,90).
1373normalAgentGoal(mudFun,90).
1374normalAgentGoal(mudNonLonelinessSocial,90).
1375normalAgentGoal(mudSadToHappy,90).
1376normalAgentGoal(mudComfort,90).
1377
1379
1382
1383prologHybrid(on_command_show(tAgent,vtActionTemplate,ftTerm)).
1384prologHybrid(agentTODO(tAgent,vtActionTemplate)).
1385prologHybrid(agentGOAL(tAgent,ftAssertable)).
1386
1387normalAgentGoal(Pred,Val) ==> ( t(Pred,A,V)/(V<Val) ==> agentTODO(A,actImprove(Pred))).
1388normalAgentGoal(Pred,Val) ==> ( t(Pred,A,V)/(V<Val) ==> agentGOAL(A,t(Pred,A,Val))).
1389
1390:-ain((normalAgentGoal(Pred,Val) ==> ( t(Pred,A,V)/(V<Val) ==> agentGOAL(A,t(Pred,A,Val))))).
1391% :-mpred_fwd((normalAgentGoal(Pred,Val) ==> ( t(Pred,A,V)/(V<Val) ==> agentGOAL(A,t(Pred,A,Val))))).
1392normalAgentGoal(Pred,Val)==> (tAgent(A)==>mdefault(t(Pred,A,Val))).
1393
1394
1395genls(tRoom,tRegion).
1396
1397tAgent(iExplorer7).
1398
1399mud_listing(M):- cwc, xlisting((M,-completely_expanded,-'$spft',-'$nt',-'$pt',- (==>))).
1400
1402
1403==> onQueueEmpty(must(mudFun(iExplorer7,_W))).
1404
1405vtActionTemplate(actImprove(rtStatPred)).
1406
1408
1410==> onQueueEmpty(sanity(clause(baseKB:vtActionTemplate(actImprove(rtStatPred)),true))).
1412==> onQueueEmpty(sanity( \+ clause(baseKB:vtActionTemplate(actImprove),true))).
1413
1414
1415
1453
1464
1465 1466
1467
1469