The ghost.pl AI needs improvement in the area of being able to demonstrate thinking with a prepositional phrase not just once but repeatedly, so into the EnThink() module we will insert diagnostic code that shows us the values of key variables at the start of each cycle of thought.
Oh, gee, this coding of the AI Mind is actually fun, especially in Perl, whereas in JavaScript there is often too much time-pressure during the entering of input. We have inserted a line of code which causes an audible beep and reveals to us the status of the $whatcon and $tpr variables just before the AI generates a thought in English -- a language which we must state explicitly, because our ghost.pl AI is just as capable of thinking in Russian. When we at first enter no input, the AI beeps periodically and shows us the values as zero. When we enter "john writes books for money", the AI shows us "whatcon= 0 tpr= 4107" because the concept of the preposition "FOR" has gone into conceptual memory at time-point "t = 4107". The AI responds to the input by outputting "THE STUDENTS READ THE BOOKS", because activation spreads from the concept of "BOOKS" to the innate idea that "STUDENTS READ BOOKS". Then we hear a beep and we see "whatcon= 0 tpr= 0" because the $tpr flag has been reset to zero somewhere in the vast labyrinth of semi-AI-complete code. Now let us enter the same input and follow it up with a query, "what does john write". Then we get "whatcon= 1 tpr= 0" and the output "THE JOHN WRITES THE BOOKS FOR THE MONEY", after which the diagnostic message reverts to "whatcon= 0 tpr= 0" because of resetting to zero.
Now we want to let the AI Mind run for a while until we repeat the query. The AI makes a mistake. We had better not let it be in control of our nuclear arsenal, not if we want to avoid global thermonuclear war, Matthew. The AI-gone-crazy says "THE JOHN WRITES THE BOOKS FOR THE BOOKS AND THE JOHN WRITE". (Oops. We step away for a moment to watch and listen to Helen Donath in 1984 singing the Waltz from "Spitzentuch der Koenigin" with the Vienna Symphony. Then we linger while Zubin Mehta and the Wiener Philharmoniker in 1999 play the "Einzugsmarsch" from "Der Zigeunerbaron". How are we going to code the Singularity if the Cable TV continues to play Strauss waltzes?) The trained eye of the Mind Maintainer immediately recognizes two symptoms of a malfunctioning artificial intelligence. First, a spurious instance of the $tpr flag is causing the AI to output "THE BOOKS FOR THE BOOKS," and secondly, the $etc variable for detecting more than one active thought must be causing the attempt by the Ghost in the Machine to make two statements joined by the conjunction "AND". We had better expand our diagnostic message to tell us the contents of the $etc variable. We do so, but we see only a value of zero, because apparently a reset occurs so quickly that no other value persists long enough to be seen in the diagnostic message. Meanwhile the AI is stuck in making statements about John writing.
We address the problem of a spurious $tpr flag by inserting fake $tru values during instantiations in the InStantiate() and EnParser() modules. We use the values 111 to 999 for $tru in the EnParser() module and 101 to 107 in the InStantiate() module, so that the middle zero lets us know when the flag-panel of a concept has been finalized in the InStantiate() module. Immediately the fake truth-value of "606" for the $tru flag of the word "MONEY", that has a spurious value of "4107" in the $tpr slot of the conceptual flag-panel, lets us k now that $tpr has not been reset to zero quickly enough to prevent a carried-over and spurious value from being set for the concept of "MONEY". Since the preposition "FOR" is being instantiated at a point in the EnParser() module where a fake truth-value of "888" appears, we can concentrate on that particular snippet of code.