473,851 Members | 2,245 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Self-Rejuvenating Immortal Artificial Intelligence

http://www.scn.org/~mentifex/jsaimind.html is a free, public-domain AI
in JavaScript that may be copied to your Web site with your own changes.

Freshly updated and modified from the AI Mind-1.1 appearing in
http://isbn.nu/0595654371 -- AI4U textbook of artificial intelligence --
the new AI Mind forgets its oldest unused memories in order to make
room for memories of fresh experience, and is therefore immortal.

Interested parties may start the immortal AI Mind running in the
Microsoft Internet Explorer Web browser and see how long it lives.

When you go out to lunch, leave the AI Mind running on your PC
and see what reactions you get from others when you return.

Any Chief Web Officer (CWO) or JavaScript programmer may customize
the free AI source code and install it anew as a chaotic attractor.

http://victoria.tc.ca/~uj797/jsaimind.html is another Seed AI. Have fun.
Jul 20 '05 #1
5 2314
Arthur T. Murray:
Freshly updated and modified from the AI Mind-1.1 appearing in
http://isbn.nu/0595654371 -- AI4U textbook of artificial intelligence --
the new AI Mind forgets its oldest unused memories in order to make
room for memories of fresh experience, and is therefore immortal.


Designed to forget? Immortal? Sounds more like ephemeral.

Cheers,
Michael C Price
----------------------------------------
http://mcp.longevity-report.com
http://www.hedweb.com/manworld.htm
Jul 20 '05 #2
uj***@victoria. tc.ca (Arthur T. Murray) wrote in message news:<41******@ news.victoria.t c.ca>...
Interested parties may start the immortal AI Mind running in the
Microsoft Internet Explorer Web browser and see how long it lives.


Why not a decent browser like Mozilla?

--
Dan
Jul 20 '05 #3
uj***@victoria. tc.ca (Arthur T. Murray) wrote:
http://www.scn.org/~mentifex/jsaimind.html is a free, public-domain AI
in JavaScript that may be copied to your Web site with your own changes. Freshly updated and modified from the AI Mind-1.1 appearing in
http://isbn.nu/0595654371 -- AI4U textbook of artificial intelligence --
the new AI Mind forgets its oldest unused memories in order to make
room for memories of fresh experience, and is therefore immortal. Interested parties may start the immortal AI Mind running in the
Microsoft Internet Explorer Web browser and see how long it lives. When you go out to lunch, leave the AI Mind running on your PC
and see what reactions you get from others when you return. Any Chief Web Officer (CWO) or JavaScript programmer may customize
the free AI source code and install it anew as a chaotic attractor. http://victoria.tc.ca/~uj797/jsaimind.html is another Seed AI. Have fun.


Anyone contemplating participating should probably read this first:

http://www.nothingisreal.com/mentifex_faq.html

FYI

xanthian.
Jul 20 '05 #4
Arthur T. Murray wrote:
http://www.scn.org/~mentifex/jsaimind.html is a free,
public-domain AI in JavaScript
Scripts that are expected to execute in a web browser environment need
to be written with a consideration of that environment. Some
considerations are common to many programming projects, others directly
follow from the choice of a browser as an environment. A factor that is
common to both is the use of global variables. Common principles that
are applied to programming (and certainly applicable to javascript
programming) are: 1. never give a variable more scope than it needs, 2.
never create more global variables than are absolutely necessary.

The second follows form the first to some extent, but is very important
in a web browser environment as most browser scripts do not get used in
isolation. They share the global scope with all other scripts used on a
given page, and anything that the browser decides should be available as
a property of the global object (which includes all HTML elements that
are given a name or an ID attribute in Internet Explorer). The risk of
naming collisions is real and should be directly addressed in script
design.

When a script declares 90 global variables, but does not declare one
function local variable, then the design of that script seems
ill-conceived form the outset. A perception that is re-enforced by that
observation that, for example, the variable - c - is declared globally
but is only used within one function, where the first reference to it
assigns it a - keyCode - value form an - event - object.

This mass of global variables seems to be being partly employed in place
of passing functions arguments as parameters. A strange design decision
that results in code that is excessively convoluted, repetitive and
difficult to follow. Code that will eventually exceed its creator's
ability to comprehend its complexity, and may already have done so. A
global variable is declared as:-

| var midway = 0; // audRecog: a stopping point for backward searches.

- and used to limit various loop statements such as:-

| for (i = t; i > midway; --i) { // loop backwards through time
| audMemory[i].audExam(); // activate auditory engram nodes
| audMemory[i] = new audNode(aud0,0, aud2,aud3,aud4, aud5);
| } // End of cycling back to the loosely "midway" time-point.

Yet the - midway - variable is never incremented, decremented or
assigned a value. It remains zero throughout the execution of the code.
Whatever concept the name "midway" was chosen to represent has become
lost in the spaghetti if indirect references, and its actual use in
place of the value zero is also concealing the possibility of using more
efficient looping constructs such as:-

if((i = t) > 0){
do{
... // loop body
}while(i--);
}

Another important factor in the design of a browser script is its
efficiency. In addition to executing scripts, web browsers have a mass
of other tasks that they need to do, such as maintaining and refreshing
the display, processing user input, and the like. Usually a long running
script will seriously inhibit those processes. Breaking long script
execution up using setTimout or event driven execution helps to allow
the browser to keep up with its required house-keeping tasks but it is
still necessary to code efficiently.

This script is so intensive when it is executing that the browser GUI
virtually grinds to a halt. As a result it is worth considering the
extent to which that is a consequence of what the script must do, as
opposed to just being a consequence of bad implementation. A question
that is partly answered by an examination of some of the code, such as
the - Listen - function:-

| function Listen() { // ATM 2aug2002; or your ID & date.
| quiet = false; // So that aLife() will not yet call Think().
| fyi = "Calling the Listen module; when done press [ENTER]";
| Voice(); // Display the Voice:brain fyi message.
| inert = 0; // Upon input, retreat from calling Ego().
| pov = "*"; // symbol to display "external" point-of-view
| document.onkeyp ress = function (evt) {
| c = event.keyCode;
<snip - 40 lines of code>
| return true; // The work of the module is done.
| } // End of "document.onkey press"
| } // End of Listen() for each character of user input.

The - Listen - function is called from an onkeydown event handler on the
text input field:-

| <INPUT TYPE="TEXT" NAME="ear" value=""
| SIZE="80" onKeyDown="List en()">

As a result it will be executed whenever a key is pressed down while
that field has focus. The - Listen - function itself assigns an event
handler to the - document.onkeyp ress - each time it is executed, though
no other part of the script ever re-sets or re-assigns anything to that
property. However, the function assigned is not merely a reference to a
function, it is a function expression evaluated within the body of a
function. Meaning that each evaluation of the expression results in the
creation of a *new* anonymous function object and the assigning of a
reference to that function object to the - document.onkeyp ress -
property. And this happens every time the user presses a key down while
entering text within the text field, even though all of the function
objects created (and subsequently freed and garbage collected) are
essentially identical. This is a ludicrous processing overhead to impose
on an action as simple as entering text, and completely avoidable.

Similar absurd inefficiencies manifest themselves throughout the rest of
the code. E.G.:-

| function Tutorial() { // ATM 14may2002; or your ID & date.
| if (document.all["cb3"].checked == true) {

An - if - statement evaluates its expression and passes the result to
the internal - ToBoolean - function (which will type-convert a
non-boolean value, or just return a boolean when its argument is already
that type), making its decision based on the result. The type-converting
comparison operator - == - always produces a boolean result but, when
comparing a boolean property (such as the - checked - property of a
checkbox) with a boolean literal (true or false) the result is always
directly related to the trueness of the original boolean property. Thus
a comparison operation with a boolean literal is redundant:-

if( document.all["cb3"].checked ){
... // checked is true.
}

if( !document.all["cb3"].checked ){
... // checked is NOT true (false).(! - is the NOT operator)
}

| tutor = true; // a flag for Tutorial()

The - tutor - global variable is set to - true - in this branch (when -
checked - is true) and - false - in the other (when - checked - is
false). The two branches are mutually exclusive and set - tutor - to a
value directly related to the value of - checked -, so it would be more
efficient to directly assign the value of - checked - to the - tutor -
variable, and doing so in the expression of the - if - statement would
avoid having to re-resolve the - checked - property of the checkbox
element:-

if( (tutor = document.all["cb3"].checked) ){
... // checkbox is checked
}
// the current value of - checked - has been assigned to - tutor.

| document.all["teacher"].style.visibili ty='visible';
| msg++; // Increment so as to cycle through the Tutorial display.
|
| if (msg==1) meme="There is no warranty [...]";
| if (msg==2) meme="You may put AI as mi [...]";
| if (msg==3) meme="Entry of user input [...]";
<snip - 43 other similar - if - statements>
| if (msg==48) meme="The AI Textbook is t [...]";
| if (msg==49) meme="On supercomputers yo [...]";
| if (msg==50) meme="You are witnessing t [...]";

49 consecutive - if - statement in which the evaluation of any one
expression to true logically precludes the possibility of any of the
following - if - statement expressions evaluating as true is massively
inefficient coding. An - if/else if - logic would be better (as
evaluation would stop an the first true result) but 49 - if/else if -
clauses, where the value of one variable is compared with a sequence of
numbers, is exactly the situation that the - switch - statement was
designed to handle.

However, defining the 49 output strings as elements of an array (in a
suitably stable containing scope, probably globally) and using the
numeric - msg - variable to index that array would reduce that entire
sizeable block of code down to one property accessor expression:-

stringsListArra y[ msg ]

- that could just replace - meme - in the following string construction.

| memeplus = ("<font size='+2' color='navy'>" + meme +"<\/b><\/font>");
^^^^^
A closing B tag, without a corresponding opening tag, in this context is
an error and will be subject to browser error-correction when assigned
to the - innerHTML - property. The browsers has no choice but ignore the
invalid closing B tag, but asking it to process that input, recognise
the error and correct it, is needlessly wasteful in such a processor
intensive script.

| document.all.te acher.innerHTML = memeplus;
| if (msg>49) msg = 0; // Loop back through the Tutorial messages.
| } // end of if-clause to see if Tutorial is checked.
| if (document.all["cb3"].checked == false) {

Again, a comparison of a boolean property with a boolean value is
pointless and inefficient. However, this - if - statement is mutually
exclusive with the one for the preceding branch so a simple - else -
separating the two branches is all that is required (avoiding the second
test entirely):-

if( (tutor = document.all["cb3"].checked) ){
... // String outputting branch
}else{
... // output hiding branch
}

| document.all["teacher"].style.visibili ty='hidden';
| tutor = false;
| } // end of if-clause to see if Tutorial is NOT checked.
| document.forms[0].ear.focus(); // await input

continuously re-focusing the form input field will encourage the browser
to scroll the page so that the field is within the display, making the
troubleshooting and transcript outputs inaccessible when they exceed the
remaining display area in the browser window.

| } // end of Tutorial() function

The dubious - if - statement logic re-occurs in many locations
including:-

| function psiDecay() { // ATM 21jun2002; or your ID & date.
| for (i = t; i>midway; --i) { // Loop backwards in recent time.
^ ^ ^
The variable - i - is a global variable, it really should be local. If
it were local it would be resolved quicker, and there would be less
chance of chaos following if a future modification decided to call a
function within this loop that also attempted to loop with the same
global - i - variable (as all but 4 of the loops within the code use the
same - i - variable that is likely to happen at some point).

| Psi[i].psiExam(); // Cycle through recent Psi nodes.
| if (psi1 > 0) { // Find any mindcore psi1 positive activation.
| if (psi1 == 1) psi1 = 0;
| if (psi1 == 2) psi1 = 0;
| if (psi1 == 3) psi1 = 0;
| if (psi1 == 4) psi1 = 0;
| if (psi1 == 5) psi1 = 0;
| if (psi1 == 6) psi1 = 0;
| if (psi1 == 7) psi1 = 0;
| if (psi1 == 8) psi1 = 0;
| if (psi1 == 9) psi1 = 0;
| if (psi1 == 10) psi1 = 0;
| if (psi1 == 11) psi1 = 0;
| if (psi1 == 12) psi1 = 0;
| if (psi1 == 13) psi1 = 0;
| if (psi1 == 14) psi1 = 0;
| if (psi1 == 15) psi1 = 0;
| if (psi1 == 16) psi1 = 0;
| // if (psi1 == 17) psi1 = 0;
| // if (psi1 == 18) psi1 = 0;
| // if (psi1 == 19) psi1 = 0;
| // if (psi1 == 20) psi1 = 0;
| // if (psi1 == 21) psi1 = 0;
| // if (psi1 == 22) psi1 = 0;
| // if (psi1 == 23) psi1 = 0;
| if (psi1 > 16) psi1 = (psi1 - 16); // above the range.
| Psi[i] = new psiNode(psi0,ps i1,psi2,psi3,ps i4,psi5,psi6);
| } // end of if-clause finding and reducing positive activations
| } // end of backwards loop
| } // End of psiDecay(); return to Think().

If - psi1 - is greater than zero it must either be less than or equal to
16 (so set to zero) or greater than 16 (so set to (psi1 - 16)).
Simplifying the code to:-

function psiDecay() {
for (var i = t; i>midway; --i) {
Psi[i].psiExam();
if (psi1 > 0) {
psi1 -= (psi1 > 16)?16:psi1;
Psi[i] = new psiNode(psi0,ps i1,psi2,psi3,ps i4,psi5,psi6);
}
}
}

- and avoiding the execution of up to 16 unnecessary statements.
that may be copied to your Web site
with your own changes.
Given that the script referenced above errored, locked-up and then
crashed my IE 6 twice in succession, exposing innocent members of the
public to it would not be a good idea.
Freshly updated and modified from the AI Mind-1.1 appearing
in http://isbn.nu/0595654371 -- AI4U textbook of artificial
intelligence -- the new AI Mind forgets its oldest unused
memories in order to make room for memories of fresh
experience, and is therefore immortal.
This is not a definition of immortality that I would recognise.
Interested parties may start the immortal AI Mind running
in the Microsoft Internet Explorer Web browser and see how
long it lives.

<snip>

There is no good reason that the script should only "work" on IE
browsers, beyond its author's superficial familiarity with web browser
scripting.

As an exercise in javascript authoring the script is very badly designed
and ineptly implemented. It has no merits whatsoever, even if it did
achieve what is claimed for it (which doesn't appear to be the case). So
you should stop spamming comp.lang.javas cript with cross-posted
references to your javascript "AI" as the only interest that group may
have in it would be as an example of how not to design and implement a
browser script.

Richard.
Jul 20 '05 #5
Richard Cornford wrote:
Arthur T. Murray wrote:
http://www.scn.org/~mentifex/jsaimind.html is a free,
public-domain AI in JavaScript


[a ca. 300 lines essay about how (not) to write scripts]


I really appreciate your explanations, though most of it known,
but do you really think ATM is worth it? Do not feed the troll:

<http://www.nothingisre al.com/mentifex>

And BTW, please do not crosspost over main hierarchies and
please do not crosspost without Followup-to. Thanks.
X-Post sci.* cut, F'up2 poster

PointedEars
Jul 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4736
by: Marc | last post by:
Hi all, I was using Tkinter.IntVar() to store values from a large list of parts that I pulled from a list. This is the code to initialize the instances: def initVariables(self): self.e = IntVar() for part, list in info.masterList.items():
15
2602
by: Ralf W. Grosse-Kunstleve | last post by:
****************************************************************************** This posting is also available in HTML format: http://cci.lbl.gov/~rwgk/python/adopt_init_args_2005_07_02.html ****************************************************************************** Hi fellow Python coders, I often find myself writing:: class grouping:
18
2292
by: Ralf W. Grosse-Kunstleve | last post by:
My initial proposal (http://cci.lbl.gov/~rwgk/python/adopt_init_args_2005_07_02.html) didn't exactly get a warm welcome... And Now for Something Completely Different: class autoinit(object): def __init__(self, *args, **keyword_args): self.__dict__.update(
4
2803
by: David Coffin | last post by:
I'd like to subclass int to support list access, treating the integer as if it were a list of bits. Assigning bits to particular indices involves changing the value of the integer itself, but changing 'self' obviously just alters the value of that local variable. Is there some way for me to change the value of the BitSequence object itself? I've also tried wrapping and delegating using __getattr__, but I couldn't figure out how to handle...
4
1825
by: marek.rocki | last post by:
First of all, please don't flame me immediately. I did browse archives and didn't see any solution to my problem. Assume I want to add a method to an object at runtime. Yes, to an object, not a class - because changing a class would have global effects and I want to alter a particular object only. The following approach fails: class kla: x = 1
7
1917
by: Andrew Robert | last post by:
Hi Everyone, I am having a problem with a class and hope you can help. When I try to use the class listed below, I get the statement that self is not defined. test=TriggerMessage(data) var = test.decode(self.qname)
24
2321
by: Peter Maas | last post by:
The Python FAQ 1.4.5 gives 3 reasons for explicit self (condensed version): 1. Instance variables can be easily distinguished from local variables. 2. A method from a particular class can be called as baseclass.methodname(self, <argument list>). 3. No need for declarations to disambiguate assignments to local/instance variables.
84
7254
by: braver | last post by:
Is there any trick to get rid of having to type the annoying, character-eating "self." prefix everywhere in a class? Sometimes I avoid OO just not to deal with its verbosity. In fact, I try to use Ruby anywhere speed is not crucial especially for @ prefix is better- looking than self. But things grow -- is there any metaprogramming tricks or whatnot we can throw on the self? Cheers,
13
12040
by: Kurda Yon | last post by:
Hi, I found one example which defines the addition of two vectors as a method of a class. It looks like that: class Vector: def __add__(self, other): data = for j in range(len(self.data)): data.append(self.data + other.data)
6
1821
by: Bart Kastermans | last post by:
I am playing with some trees. In one of the procedures I wrote for this I am trying to change self to a different tree. A tree here has four members (val/type/left/right). I found that self = SS does not work; I have to write self.val = SS.val and the same for the other members (as shown below). Is there a better way to do this? In the below self is part of a parse tree, F is the parse tree of a function f with argument x. If a node...
0
9895
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11011
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10352
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9503
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7900
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7072
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5735
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5931
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4547
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.