home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / mind.zip / MIND.CMD
OS/2 REXX Batch file  |  1993-11-17  |  6KB  |  168 lines

  1. /*  Mind.rexx17NOV93A, an Amiga Rexx program for artificial intelligence. */
  2. /*  For related AI theory see "Mind" on Amiga Library (Fish) Disk #411.   */
  3. /*  This version associatively prioritizes verbs to find and speak aloud  */
  4. /*  the verb most germane to the noun chosen as subject of a sentence.    */
  5. j = 0; n = 0; p = 0; top = 0; v = 0; z = 0    /*  Initialize the values.  */
  6. /*  Preparation for running Mind.rexx as a single-file distribution.      */
  7. SAY ""  /*  Mind.rexx lives in RAM so as to attain the speed of thought.  */
  8. SAY "Launching Mind.rexx from Volume" PRAGMA('d',"RAM:")
  9. SAY "We are now in Volume" PRAGMA('d')
  10. n = 1; noun.n = "animal"
  11. n = 2; noun.n = "human"
  12. n = 3; noun.n = "robot"
  13. stop = n
  14. DO n = 1 TO stop
  15.   store = value('noun.n') || ".noun"
  16.   OPEN(node.n,store,'w')
  17.   CLOSE(node.n)
  18.   END
  19. OPEN(verb.1,"find.verb",'w')
  20.   WRITELN(verb.1,"human.animal")  /*  Mind.rexx creates some associative  */
  21.   WRITELN(verb.1,"robot.human")   /*  RAM.verb files for use in those     */
  22.   WRITELN(verb.1,"animal.robot")  /*  environments where no other files   */
  23.   WRITELN(verb.1,"human.human")   /*  are distributed with this program.  */
  24.   CLOSE(verb.1)
  25. OPEN(verb.2,"know.verb",'w')
  26.   WRITELN(verb.2,"man.world")     /*  In more controlled channels of      */
  27.   WRITELN(verb.2,"robot.world")   /*  distribution, such as Fish CD-ROMs, */
  28.   WRITELN(verb.2,"human.robot")   /*  groups of RAM.noun & RAM.verb files */
  29.   WRITELN(verb.2,"robot.human")   /*  may be distributed along with the   */
  30.   WRITELN(verb.2,"animal.human")  /*  Mind.rexx program, if necessary.    */
  31.   CLOSE(verb.2)
  32. OPEN(verb.3,"see.verb",'w')
  33.   WRITELN(verb.3,"animal.human")  /*  As the mind algorithm progresses,   */
  34.   WRITELN(verb.3,"human.world")   /*  the mind organism may create its    */
  35.   WRITELN(verb.3,"robot.human")   /*  own linguistic memory files, or the */
  36.   WRITELN(verb.3,"animal.robot")  /*  user may save various mindsets.     */
  37.   CLOSE(verb.3)
  38. SAY ""
  39. SAY "Project Mentifex presents Mind.rexx for artificial intelligence."
  40. DO FOREVER
  41.   SAY "Press <RETURN> to continue, <Q> to QUIT:"; PULL opt
  42.   IF opt = "Q" THEN LEAVE
  43.   CALL Soma()
  44.   SAY ""
  45.   SAY "Done with Soma, switching into Psi mode...."
  46.   CALL Psi()
  47.   SAY ""
  48.   SAY "Now forming sentence with the verb of highest priority...."
  49.   CALL sent()
  50.   END
  51. SAY "Program terminated."
  52. EXIT
  53. /*  This Mind.rexx program is being released into the public domain by    */
  54. /*  Project Mentifex, Post Office Box 31326, Seattle, WA 98103-1326 USA.  */
  55. /*  Anyone may add to this program, but please do not copyright the code. */
  56. /*  Please release your improvements into the public-domain channels.     */
  57. Soma:
  58.   SAY "Loading up all nouns stored as files ending in .noun ...."
  59.   nouncom = 'List >RAM:nounlist' #?.noun QUICK FILES NOHEAD
  60.   ADDRESS COMMAND nouncom
  61.   nounload = Open(bank,nounlist,'r')
  62.   n = 0
  63.   DO WHILE ~EOF(bank)
  64.     n = n + 1
  65.     line = ReadLn(bank)
  66.     PARSE VAR line node "." rest
  67.     noun.n = node || . || n || . || v
  68.     END
  69.   CLOSE(bank)
  70.   nstop = n - 1
  71.   SAY ""
  72.   SAY "Loading up all verbs stored as files ending in .verb ...."
  73.   verbcom = 'List >RAM:verblist' #?.verb QUICK FILES NOHEAD
  74.   ADDRESS COMMAND verbcom
  75.   verbload = Open(zeitwort,verblist,'r')
  76.   z = 0
  77.   DO WHILE ~EOF(zeitwort)
  78.     z = z + 1
  79.     zeile = ReadLn(zeitwort)
  80.     PARSE VAR zeile actus "." cetera
  81.     verb.z = actus || . || z || . || p
  82.     END
  83.   CLOSE(zeitwort)
  84.   zstop = z - 1
  85.   RETURN
  86. /*  This Amiga REXX implementation of the Mentifex AI mind-model is being */
  87. /*  written from the core of the mind outwards, that is, first the basic  */
  88. /*  conceptual apparatus and the linguistic structures are implemented.   */
  89. /*  Whosoever has the resources to do so, please devise a way to add      */
  90. /*    - vision:  videocamera input and a visual memory channel;           */
  91. /*    - audition:  speech-input or general sound into auditory memory;    */
  92. /*    - robotics:  a motorium of arms and legs under volitional control.  */
  93. Psi:
  94. DO z = 1 TO zstop
  95.   SAY z " verb.z = " verb.z
  96.   END
  97. SAY ""
  98.   DO n = 1 TO nstop
  99.     SAY "Noun " n "=" noun.n
  100.     END
  101. SAY ""
  102. SAY "Type in the noun that you choose to be the subject of a sentence:"
  103. PULL vybor
  104. IF vybor = "" THEN vybor = "nothing"
  105. SAY "You choose" vybor "."
  106. SAY ""
  107. SAY "Now matching for" vybor "as a branch of access to verbs."
  108. DO z = 1 TO zstop
  109.   PARSE VAR verb.z action "." loipa
  110.   verbseek = action || . || verb
  111.   SAY ""
  112.   SAY "Calling Verblook...."
  113.   CALL Verblook()
  114.   END
  115. RETURN
  116. /*  Whosoever publishes papers and reports on your work with Mind.rexx,   */
  117. /*  please mail a reprint to the postal address of Project Mentifex.      */
  118. /*  Further distribution and implementation on CD-ROM are appreciated.    */
  119. /*  If anyone at MCC can combine the Cyc project of Douglas Lenat with    */
  120. /*  the Mentifex mind-engine, please try your best.                       */
  121. Verblook:
  122. SAY "Now in Verblook...."
  123. SAY "Verbseek = " verbseek
  124. look = Open(verbfile,verbseek,'r')
  125. DO WHILE ~EOF(verbfile)
  126.   item = ReadLn(verbfile)
  127.   PARSE UPPER VAR item comp "." obj    /*  Parse for comparand & object.  */
  128.     SAY "Vybor and comparand = " vybor "and" comp
  129.     IF comp = vybor THEN CALL Increment()
  130.   END
  131.   CLOSE(verbfile)
  132. RETURN
  133. /*  Whosoever can move Mind.rexx to other REXX platforms, please do so.   */
  134. /*  Most internal Mind.rexx functions need a parallel implementation on   */
  135. /*  massively parallel machines.                                          */
  136. Increment:
  137. SAY "z =" z " and verb.z =" verb.z
  138. incverb = verb.z
  139. PARSE VAR incverb base '.' ordv '.' pri
  140. SAY "incverb = " base " . " ordv " . " pri
  141. p = pri + 1
  142. verb.z =ábase || . || z || . || p
  143. p =á0
  144. RETURN
  145. /*  This Mind.rexx AI program is more philosophy than technology.         */
  146. /*  Accordingly, please find philosophers to consult with as you program  */
  147. /*  to implement your public-domain, free-for-all-humanity improvements.  */
  148. sent:
  149. SAY ""
  150. bonmot = vybor   /*  French "bon mot" (good word) is the chosen subject.  */
  151. SAY "The" bonmot "will..."
  152. ADDRESS COMMAND say "The" bonmot "will"
  153. /*  predicate  */
  154. DO z = 1 TO zstop
  155.   SAY z verb.z
  156.   END
  157. DO z = 1 TO zstop
  158.   ziel = verb.z
  159.   PARSE VAR ziel averb '.' ord '.' pri
  160.   IF pri > top THEN motjuste = averb
  161.   IF pri > top THEN top = pri
  162.   END
  163. SAY "...(do the action) " motjuste "."
  164. ADDRESS COMMAND say motjuste
  165. motjuste = "blank"
  166. top = 0
  167. RETURN
  168.