📄 javascript
字号:
// Transcript()
function Transcript() {
Transcribe(); // CR() "userline" and Speech() "output"
if (hardcopy == true) {
document.all.psicolumn.innerHTML = ""; // blank out Troubleshoot
document.all.encolumn.innerHTML = "";
document.all.audcolumn.innerHTML = "";
} // end of if-clause
document.all.tabula.innerHTML = dialog;
// document.body.insertAdjacentHTML('BeforeEnd', tsml);
if (hardcopy == false) tsml = ""; // for reset
} // end of Transcript()
// psiList() is called from Troubleshoot()
// and concatenates a list of Psi nodes
// to be displayed in Troubleshoot mode.
function psiList() {
for (i = nonce; i < (t +1); i++) { // or use nlt?
Psi[i].psiExam(); // to examine each Psi concept node.
psidata += ("<BR>" + i + ". <b>" + psi1 + "<\/b> " + psi2 + " ");
psidata += (psi3 + " " + psi4 + " " + psi5 + " " + psi6);
} // end of loop from nonce to now.
} // end of psiList().
// enList() is called from the Troubleshoot() module
// and concatenates a list of En(glish) nodes
// to be displayed in Troubleshoot mode.
function enList() {
for (i = nonce; i < (t +1); i++) { // or use nlt?
enLexicon[i].enExam(); // examine and list each node
endata += ("<BR>" + i + ". <b>" + en1 + "<\/b> " + en2 + " ");
endata += (en3 + " " + en4 + " " + en5 + " " + en6);
} // end of loop from nonce to now
} // end of enList().
// audList() is called from the Troubleshoot() module
// and concatentates a list of auditory engrams
// to be displayed in Troubleshoot mode.
function audList() {
for (i = nonce; i < (t +1); i++) { // or use nlt?
audMemChan[i].audRecall(); // activate each audEngram
auddata += ("<BR>" + i + ". <b>");
if (gram3 == "#") auddata += ("<font color='red'>");
auddata += (gram1 + "<\/b> ");
if (gram3 == "#") auddata += ("<\/font>");
if (gram1 == " ") gram2 = " "; // to avoid displaying "0"
auddata += (gram2+" "+gram3+" "+gram4+" "+gram5+" "+gram6);
} // end of loop from nonce to now
} // end of audList().
// Troubleshoot() is called from aLife() when
// the user has clicked on the Troubleshoot checkbox.
function Troubleshoot() {
psiList(); // to compile the list of Psi nodes.
enList(); // to examine En(glish) lexical nodes.
audList(); // collect the auditory memory engrams.
if (trouble == true) {
document.all.tabula.innerHTML = ""; // blank out any Transcript text
document.all.psicolumn.innerHTML = psidata;
document.all.encolumn.innerHTML = endata;
document.all.audcolumn.innerHTML = auddata;
} // end of if-clause
tsml = "";
psidata = "f/mt act pre pos seq enx"; // for reset.
endata = "nen act fin g fex rv"; // for reset.
auddata = "pho act pov beg ctu utg"; // For reset.
return;
}
// deadEnd() is a way to halt the AI:
function deadEnd() {
message=("<font color='red'>"+"Mental function halted."+"<\/font>");
Voice();
}
// Security() is called at first by Bootstrap() and may
// be a round-robin element in the time-delayed main
// quasi-loop that keeps the AI from speeding.
function Security() {
if (document.forms[1].elements[2].checked) {
document.forms[0].ear.focus(); // INPUT FORM cursor.
} // end of if-clause
if (death == false) {
// DIY AI: You may customize the messages WITHIN quote marks:
message = ("Time = " + t + "; CNS size is set to " + cns);
if (t > (cns-64)) { // Fewer than 64 engram slots are left!
message = "WARNING! Consider clicking Refresh. ";
message += ("Only " + (cns-t) + " CNS engram slots are left.");
}
Voice();
}
else {
deadEnd();
} // end of else-clause
if (death == false) aLife(); // 23feb2001: for Tutorial loop.
} // end of Security()
// spreadAct() is called by Activate()
// to spread activation among concepts.
function spreadAct() {
if (pre > 0) { // if a pre(vious) concept exists...
for (i = zone; i > midway; --i) {
Psi[i].psiExam(); // examine the range of Psi concepts
if (psi1 == pre) { // if a match of "pre" is found...
if (attn > 1) { // i.e, during user input...
psi2 = (psi2 + bulge); // pass on some activation
Psi[i] = new psiNode(psi1,psi2,psi3,psi4,psi5,psi6);
} // end of inner if-clause
else { // i.e., during reentrant thinking...
psi2 = (psi2 + bulge);
Psi[i] = new psiNode(psi1,psi2,psi3,psi4,psi5,psi6);
} // end of else-clause
} // end of middle if-clause looking for one "pre"
break; // after finding one "pre" within the zone.
} // end of backwards loop
} // end of outer if-clause
if (seq > 0) { // if a sub(seq)uent concept exists...
for (i = zone; i < t; i++) { // prepare to search zone
Psi[i].psiExam(); // examine the forwards range....
if (psi1 == seq) { // if a match of "seq" is found...
if (attn > 1) { // i.e, during user input...
psi2 = (psi2 + bulge);
Psi[i] = new psiNode(psi1,psi2,psi3,psi4,psi5,psi6);
} // end of inner if-clause
else { // i.e., during reentrant thinking...
psi2 = (psi2 + bulge); // augment the dir. obj.
Psi[i] = new psiNode(psi1,psi2,psi3,psi4,psi5,psi6);
} // end of else-clause
} // end of middle if-clause looking for one "seq"
break; // after finding one "seq" within the zone
} // end of forwards loop
} // end of outer if-clause
} // end of spreadAct()
// Activate() is called from oldConcept() so as to
// reactivate older nodes of a newly active concept.
function Activate() {
bulge = 0;
for (i=(t + 1); i>midway; --i) {
Psi[i].psiExam(); // examine each Psi node.
if (psi1 == mt) { // if concept "mt" is found...
psi2 = (psi2 + 8); // try a high value; MONITOR!
Psi[i] = new psiNode(psi1,psi2,psi3,psi4,psi5,psi6);
bulge = psi2; // for use in spreadAct()
pre = psi3; // for use in spreadAct()
seq = psi5; // for use in spreadAct()
zone = i; // for use in spreadAct()
spreadAct();
pre = 0;
seq = 0;
} // end of if-clause
} // end of backwards loop
act = 0; // safety measure
} // end of "Activate()"
// psiExam() is a method of psiNode()
// for access to core concept nodes.
function psiExam() {
psi1 = this.mt;
psi2 = this.act;
psi3 = this.pre;
psi4 = this.pos;
psi5 = this.seq;
psi6 = this.enx;
}
// psiNode() is called from Instantiate()
// to create or modify a psi concept node:
function psiNode(mt,act,pre,pos,seq,enx) {
this.mt = mt; // move-tag
this.act = act; // activation level
this.pre = pre; // previous associand
this.pos = pos; // part-of-speech
this.seq = seq; // subsequent associand
this.enx = enx; // transfer to En(glish)
this.psiExam = psiExam; // method.
}
// Instantiate() is called from newConcept() or
// oldConcept() to create a new node of a concept.
function Instantiate() {
Psi[t] = new psiNode(mt,act,pre,pos,seq,enx);
}
// enExam() is a method of enNode()
// for access to English lexical nodes.
function enExam() {
en1 = this.mt;
en2 = this.act;
en3 = this.fin;
en4 = this.g;
en5 = this.fex;
en6 = this.rv;
}
// enNode() is called from Attach()
// to create or modify an English concept node:
function enNode(mt,act,fin,g,fex,rv) {
this.mt = mt; // move-tag
this.act = act; // activation level
this.fin = fin; // fiber-in (to psi)
this.g = g; // grammar category
this.fex = fex; // fiber-out (from psi)
this.rv = rv; // recall-vector
this.enExam = enExam; // method.
}
// Attach() is called from newConcept()
// to create a node on a quasi-concept-fiber
// by "attaching" associative tags to it.
function Attach() {
enLexicon[t] = new enNode(mt,0,fin,g,fex,rv);
}
// oldConcept() is called from Retro() to create a
// fresh concept-node for a recognized input word.
function oldConcept() {
if (attn > 2) act = 33; // high value for current input;
else act = 8; // a lower residual value during "reEntry()".
if (par == 3) { // if a direct object is being parsed...
g = 5; // g(rammar) category equals five (noun).
act = (act - 4); // reduce act(ivation).
pos = 5; // let part-of-speech equal five (noun).
par = 4; // obviate the parse-flag by incrementing it.
}
if (par == 2) { // if a verb is being parsed...
g = 8; // g(rammar) category equals eight (verb).
act = (act - 2); // reduce act(ivation).
pos = 8; // let part-of-speech equal eight (verb).
par = 3; // obviate the parse-flag by incrementing it.
}
if (par == 1) { // if a subject is being parsed...
pre = 0; // let there be no pre(vious) associand.
g = 5; // g(rammar) category equals five (noun).
pos = 5; // let part-of-speech equal five (noun).
par = 2; // obviate the parse-flag by incrementing it.
}
for (i=t; i>midway; --i) { // cycle back through English lexicon.
enLexicon[i].enExam(); // examine each English concept node.
if (mt == en1) {
if (en3 > 0) fin = en3; // retrieve the "fiber-in" flag;
if (en5 > 0) fex = en5; // retrieve the "fiber-out" flag.
break; // use only the most recent engram-node.
} // end of searching if-clause.
} // end of the backwards loop.
Attach(); // create new node of lexical item.
// This code has a bearing on emerging consciousness:
if (pov == "#") mt = fin; // external "pov"
if (pov == "*") mt = fex; // internal "pov"
f = mt;
enx = mt;
Instantiate();
pos = 0;
unk = pre;
Activate();
pre = unk;
unk = 0;
// The next lines store "seq" retroactively:
if (pre > 0) {
for (i=t; i>midway; --i) {
Psi[i].psiExam(); // examine the psi nodes
if (pre == psi1) {
Psi[i] = new psiNode(psi1,psi2,psi3,psi4,mt,psi6);
break;
} // end of inner if-clause
} // end of loop
} // end of outer if-clause
pre = mt; // for next "nen"
if (par > 3) {
pre = 0;
par = 1;
} // end of if-clause
act = 0;
} // end of oldConcept()
// newConcept() is called from Retro() when the
// Artificial Mind must learn the concept of a new word.
function newConcept() {
nen = (nen + 1); // increment "nen" beyond Bootstrap() concepts.
prevg = par; // keep track of the par(se) flag.
mt = nen; // let psi and n(umeric) En(glish) have same identifier.
fin = nen; // let f(iber)-in also have the same numeric identifier.
fex = nen; // let f(iber)-ex also have the same numeric identifier.
if (par == 3) { // if a direct object is being parsed...
g = 5; // g(rammar) category equals five (noun).
act = 24; // let act(ivation) equal...
pos = 5; // let part-of-speech equal five (noun).
par = 4; // obviate the parse-flag by incrementing it.
}
if (par == 2) { // if a verb is being parsed...
g = 8; // g(rammar) category equals eight (verb).
act = 28; // let act(ivation) equal...
pos = 8; // let part-of-speech equal eight (verb).
par = 3; // obviate the parse-flag by incrementing it.
}
if (par == 1) { // if a subject is being parsed...
g = 5; // g(rammar) category equals five (noun).
act = 32; // let act(ivation) equal...
pos = 5; // let part-of-speech equal five (noun).
par = 2; // obviate the parse-flag by incrementing it.
}
Attach(); // to create an ENglish node.
fin = 0;
fex = 0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -