MainLoop module of the

English and Russian bilingual ghost.pl AI in Perl

Mens Latina in Latin -- MindForth for Robots


Abstract
The MainLoop module calls several housekeeping modules to launch the Artificial General Intelligence (AGI) and then repeatedly calls the main modules for sensory input and for rational intelligence in control of voluntary motor output.


1. Diagram of MainLoop Mind-Module


  /^^^^^^^^^^^\                                    Motor Output
 /   EYE       \            _________________     /YYYYYYYYYYYY\
|               |CONCEPTS  /                 \   | | ||| ||| || |
|   _______     |   | | | /     MainLoop      \  | | ||| ||| || |
|  / old   \    |   | | | \___________________/  | | ||| ||| || |
| /  dog    \!!!|!!!|!|!|   |    | | |    |      | |S||| ||| || |
| \ recog   /---|---|-|-+ __V___ | | |  __V___   | |H||| ||| || |
|  \_______/    |  p| | |(Tabula)| } | /      \  | |A|||R|||P|| |
|               |  e| | | \Rasa/ | | |(Volition) | |K|||U|||E|| |
|               |  r| | |  \__/  | | | \______/\ | |E|||N|||T|| |
|               |  s| |d|   _____| | |   |   |  \| |?|||?|||?|| |
|   visual      |  o| |o|  |     | | |  _V   |   \ | ||| ||| || |
|               |  n| |g|  |Mind-| | | /  \  |   |\  ________   |
|   memory      |  s| |s|  |Boot | | |/Emo-\ |   | \/        \  |
|               |   |f| |  |_____| | |\tion/ |   | ( Motorium ) |
|   channel     |   |e| | _________V | \__/  |   |  \________/  |
|               |   |a| |/          \|  _____V_  | |||||||||||| |
|               |   |r| |\ReJuvenate/| (EnThink) | |||||||||||| |
|   _______     |   | | | \________/ |  \_____/  | |||||||||||| |
|  /new    \    |   |_|_|      ______V__         | |||||||||||| |
| / percept \   |  /     \    /         \        | |||||||||||| |
| \ engram  /---|-(  Psy  )--( Sensorium )       | |||||||||||| |
|  \_______/    |  \_____/    \_________/        | |||||||||||| |


2. Algorithm of the MainLoop

In Forth, MainLoop is a module that loops repeatedly until terminated, In JavaScript, MainLoop() calls itself repeatedly.


3. Code of MainLoop() from ghost.pl Strong AI Mind in Perl


MainLoop: {  # 2016jan25: for inclusion of TabulaRasa() & MindBoot()
  TabulaRasa();  # 2016jan25: one-time call as in MindForth AI.
  MindBoot();    # 2016jan25: one-time call as in MindForth AI.
  while ($t < $cns) {  # 2015may02: Until CNS memory is full. 
    $age = $age + 1;   # 2015apr26
    if ($fyi > 2) {  # 2016feb08: if mode is Diagnostic 
#     print "\nEnter a simple sentence in English or Russian: \n"; #2017-11-27
      print "\nEnter simple English or Russian to the Artificial Intelligence: \n"; #2017-11-27
    }  # 2016feb07: end of test for Diagnostic or Tutorial mode. 
    if ($t > ($cns - 64)) {  ReJuvenate() }  # 2016apr18: near end of memory.
    $tai = $t;  # 2016apr14: time of AI for diagnostic screen display
    $tpu = $t;  # 2018-06-26: isolate tpu from later input-and-output.
    Sensorium(); # 2016mar26: as avenue to auditory input module.
    if ($fyi > 2) {  # 2017-04-12: Tutorial Mode
    }  # 2017-04-12: end of test for #3 Tutorial Mode or higher. 
    Volition();  # 2017-03-18: to link Emotion() Think() and ()Motorium.
    if ($fyi > 2) {  # 2017-04-12: if in #3 Tutorial or #4 Diagnostic Mode...
      my $rsvp = 0;  # 2018-06-2016: counter for response-delay;
      until ($rsvp == 500000) {  # 2018-06-26: upper limit on count;
        $rsvp++;  # 2018-06-26: Increment $rsvp counter
      }  # 2018-06-26: end of loop waitng for user-response.
#     print "\n \nMindGrid of ghost267.pl born $birth\n";  #2018-07-06
      print "Psy and Ear arrays hold your input and the AI output: \n\n"; # 2016JUL10
      print "time tru psi hlc act mtx jux pos dba num "; # 2017jun08
      print "mfn pre iob seq tkb rv  pho audpsi \n"; # 2017jun08
#     $tai = ($tai - 44);  # 2018-06-28: temporary KbRetro() TEST; REMOVE
#     $tai = ($tai - 60);  # 2018-07-06: temporary KbRetro() TEST; REMOVE
      do {  # 2016mar26: Show @psy and @ear engrams of recent input.
        $tai++;  # 2017-03-31: increment $tai up until current time $t.
        print "t=$tai. $psy[$tai], ";  # 2017jun08: show @psy concept array 
        print " aud= $ear[$tai], \n";  # 2016apr14: show @ear auditory array
        if ($tai == $krt) { print "   \n" }  # 2016apr15: Show a gap.
      } while ($tai < ($t - 2));  # 2017-11-28: show @ear array at recent time-points  
    }  # 2016feb08: end of test for Tutorial mode
#  $hlc = "en";  # 2016feb24: If no Russian input, switch to default English.
#  $hlc = "ru";  # 2016may21: Alternate between English and Russian default?
  }  # 2016feb10: end of main while-loop 
}  # 2016jan25: End of MainLoop as an entity.


4. Troubleshooting and Debugging

4.1.a. Symptom: (Something goes wrong.)
4.1.b. Solution: (AI Mind Maintainer devises solution.)


5. Variables for MainLoop

$cns -- (adjustable) size of "central nervous system" memory in the Ghost Perl AI


6. Resources


Please see

http://cyborg.blogspot.com/2009/11/mainloop.html

http://github.com/kernc/mindforth/blob/master/wiki/MainLoop.wiki

http://mind.sourceforge.net/alife.html


7. AiTree of Mind-Modules for Natural Language Understanding


See AI 101 AI 102 AI 103 year-long community college AI course curriculum.


Artificial Intelligence in Ancient Latin -- is available from Amazon in various countries:
Australia - Canada - France - Germany - Italy - Japan - Netherlands - Singapore - Spain - United Kingdom - United States.
Ada's Technical Books
425 15th Avenue East
Seattle, WA 98122
USA Tel. 206-322-1058


Website Counter