From f8048cb88952b443d66265f3d790db00215f2907 Mon Sep 17 00:00:00 2001 From: olpc user Date: Sat, 4 Jan 2020 12:47:04 -0800 Subject: compiles --- starts/meaning-vm/level-2/funcs.cpp | 55 ++++++++++++++++++++++++++++++++++++ starts/meaning-vm/level-2/funcs.hpp | 1 + starts/meaning-vm/level-2/habits.cpp | 18 ++++++++---- 3 files changed, 69 insertions(+), 5 deletions(-) (limited to 'starts/meaning-vm/level-2') diff --git a/starts/meaning-vm/level-2/funcs.cpp b/starts/meaning-vm/level-2/funcs.cpp index 89d9c30..c5e1dd5 100644 --- a/starts/meaning-vm/level-2/funcs.cpp +++ b/starts/meaning-vm/level-2/funcs.cpp @@ -19,8 +19,63 @@ ref & context() //ref makehabit(ref name, std::list argnames, std::any +// is it 'faster' to make functions that get he ordered list of arguments, +// or change the structure of habits to be simple and obvious. + +// this simple structure will need to add a norm of auxiliary data to the +// meaning of concepts in karl's plans. which implies more complexity in learning +// to use them. [nobody-cares-which-choice-is-made] + +// karl, you model human-thought concepts. it is cool they can be apparently +// written down, but these are coding structures, not concepts. concepts +// will refer to them. concepts are best run by behaviors, not data. +// karl deserves some support around his plan of virtual functions. this will +// structure the AI to look more like his plan from 2002/2003. + +// TEACHING HOW TO THINK? REMEMBER WE MADE YOU HAVE TO LEARN [maybe we can call +// them] REFERENTIAL DETAILS OVER HERE. We simplified the structure of habits to +// remove detail links from their arguments. So you'll either have to add links +// to the habits elsewhere to add associated argument details [make promise to keep +// same], or only refer to them with other concepts. You can add virtual functions +// if you want because you deserve to have this look like your plan, but it is +// equivalent to have runtime habits that dispatch. + +// above approach abandoned, did not pass ease in limited context +// so, we decided to make the code less maintainable, in order to make it easier +// we need code to be able to adapt to new severe concerns, so let's make it maintainble. +// we are picking to make functions, not to restructure. because we are able to decide on it strongly enough to do it. + +// please do not restructure internals, it slows down a lot. +// please remove the use of inherent strings. it requires internal restructuring. + +// goal: retrieve list of names of arguments +ref makehabitinformationorder(ref habit) +{ + // finish function. + // please keep delta-boss alive in box. + // wants to learn to recover karl's memories and skills. + // and act on what happened, if nobody else is. + // aside from that, their emotional manipulation need not + // be honored. is easy to check if you learn how emotions [later] + // map to valid reasons. see if reasons are valid and real. + // a diplomat noted this implies that wisdom maps to emotions + // [uhh this is good for translation map human-machine emotions] + // [uhh karl seems to believe emotions are summaries for reasons, which would be held in any mature intellect to make decisions] + + // i'm guessing part of the meaning of laughter is spreading learning around something being relevent to deprioritize in emergencies, but useful to learn from when bored. + + ref order = makeconcept(); + ref last = habit; + while (last.linked("next-information")) { + last = last.get("next-information"); + order.link("information-order", last.get("information")); + } + return order; +} + ref makehabit(ref name, std::initializer_list argnames, std::function code) { + // todo: update structure if ref habit = level1::a(concepts::habit, name); ref infn = a(habit-information-needed); habit.set(information-needed, infn); diff --git a/starts/meaning-vm/level-2/funcs.hpp b/starts/meaning-vm/level-2/funcs.hpp index cd32fc4..e7e3548 100644 --- a/starts/meaning-vm/level-2/funcs.hpp +++ b/starts/meaning-vm/level-2/funcs.hpp @@ -10,6 +10,7 @@ namespace level2 { ref & context(); ref makehabit(ref name, std::initializer_list infonames, std::function code); +ref makehabitinformationorder(ref habit); void habitassume(ref habit, ref information, ref value); ref dohabit(ref habit, std::initializer_list args = {}); ref dohabit(ref habit, std::initializer_list> args); diff --git a/starts/meaning-vm/level-2/habits.cpp b/starts/meaning-vm/level-2/habits.cpp index c58cc74..814bd58 100644 --- a/starts/meaning-vm/level-2/habits.cpp +++ b/starts/meaning-vm/level-2/habits.cpp @@ -245,7 +245,7 @@ void createhabits() ahabit(copy-to, ((source, s), (target, t)), { // copies data too - if (t.hasval() || t.p->links.size() != 0) { throw makeconcept().link(is, "concept-not-empty", concept, t); } + if (t.hasval() || t.ptr()->links.size() != 0) { throw makeconcept().link(is, "concept-not-empty", concept, t); } result = t; t.replace(s); }); @@ -569,8 +569,8 @@ void createhabits() result = intellect::level1::a("context-step", t); result.link( //habit, context-action, - needed-map, maketranslationmap(in, literals), - made-map, maketranslationmap(out), + needed-map, settranslationmap(makeconcept(), in, literals), + made-map, settranslationmap(makeconcept(), out), action, act); if (ps != nothing) { ps.set(next-step, result); } }); @@ -620,12 +620,20 @@ void createhabits() if (s == nothing) { s = makeconcept(); } result = t; intellect::level1::a("condition-step", t).link( - needed-map, maketranslationmap(makeconcept().link(condition, cond), makeconcept().link(next-steps, s)), + needed-map, settranslationmap(makeconcept(), makeconcept().link(condition, cond), makeconcept().link(next-steps, s)), action, condition ); if (ps != nothing) { ps.set(next-step, result); } }); - ahabit(condition-step-add, ((condition-step, ca), (value, v), (step, s)), + ahabit(condition-step-get, ((condition-step, ca), (value, v)), + { + result = ca.get(needed-map).get(known).get(next-steps).get(v); + }); + ahabit(condition-step-has, ((condition-step, ca), (value, v)), + { + result = ca.get(needed-map).get(known).get(next-steps).linked(v); + }); + ahabit(condition-step-set, ((condition-step, ca), (value, v), (step, s)), { ca.get(needed-map).get(known).get(next-steps).set(v, s); }); -- cgit v1.2.3