https://www.youtube.com/watch?v=W4IP3eTTfJ8

Here's the consciousness module. It's a mini consciousness that only knows 
about reboots and reboot commands... but it demos some principal components of 
an artificial consciousness. Not sure how many more principal components there 
are... we'll find out as we build more modules for more applications.

The consciousness has two basic states: "satisfied" or "confused". Besides 
reporting these status changes, it outputs predictions about the future.

Cheers

cmodule RebootConsciousness > DynPrintLog 
<http://code.botcompany.de:8081/tb/show-snippet.php?id=1016205> {
  DoubleRange <http://code.botcompany.de:8081/tb/show-snippet.php?id=1019120> 
typicalTimeToReboot = new(1000, 0);
  
  start-thread {
    theTest();
    /*watchQuotedLog_future(rebootLogFile(), 1000, voidfunc(S s) {
      new Matches m;
      if "* Rebooting computer"
        predictReboot();
    });*/
    
    dm_vmBus_onMessage_q 
<http://code.botcompany.de:8081/tb/show-snippet.php?id=1020081> 
doingCleanReboot(r predictReboot);
  }
  
  void theTest {
    LS lastLines = unquoteAll 
<http://code.botcompany.de:8081/tb/show-snippet.php?id=1002782>(lastNLines 
<http://code.botcompany.de:8081/tb/show-snippet.php?id=1004746>(2, 
rebootLogFile 
<http://code.botcompany.de:8081/tb/show-snippet.php?id=1027020>()));
    pnl 
<http://code.botcompany.de:8081/tb/show-snippet.php?id=1008448>(lastLines);
    analyzeLines(lastLines);
  }
  
  void analyzeLines(LS lastLines) {
    if (empty 
<http://code.botcompany.de:8081/tb/show-snippet.php?id=1002108>(lastLines)) ret;
    if (l 
<http://code.botcompany.de:8081/tb/show-snippet.php?id=1001518>(lastLines) == 
1) ret with <http://code.botcompany.de:8081/tb/show-snippet.php?id=1024021> 
confused <http://code.botcompany.de:8081/tb/show-snippet.php?id=1000716>("Only 
one event: " + lastLines);
    
    S line1 = first 
<http://code.botcompany.de:8081/tb/show-snippet.php?id=1000628>(lastLines), 
line2 = second 
<http://code.botcompany.de:8081/tb/show-snippet.php?id=1005162>(lastLines);
    new Matches <http://code.botcompany.de:8081/tb/show-snippet.php?id=1001496> 
m;
    new Matches <http://code.botcompany.de:8081/tb/show-snippet.php?id=1001496> 
m2;
    if (match 
<http://code.botcompany.de:8081/tb/show-snippet.php?id=1001842>("* Rebooting 
computer", line1, m)
      && match 
<http://code.botcompany.de:8081/tb/show-snippet.php?id=1001842>("* Boot 
timestamp changed from * to *", line2, m2)) {
      long ts1 = parseLong 
<http://code.botcompany.de:8081/tb/show-snippet.php?id=1001246>(m.get(0)), ts2 
= parseLong 
<http://code.botcompany.de:8081/tb/show-snippet.php?id=1001246>(m2.get(2));
      if (ts2 > ts1) {
        notConfused("All OK! A reboot happened after my reboot command");
        double timeToReboot = toSeconds 
<http://code.botcompany.de:8081/tb/show-snippet.php?id=1006755>(ts2-ts1);
        setField(typicalTimeToReboot := DoubleRange 
<http://code.botcompany.de:8081/tb/show-snippet.php?id=1019120>(
          min 
<http://code.botcompany.de:8081/tb/show-snippet.php?id=1001796>(typicalTimeToReboot.start,
 timeToReboot),
          max 
<http://code.botcompany.de:8081/tb/show-snippet.php?id=1001664>(typicalTimeToReboot.end,
 timeToReboot));
      } else
        confused 
<http://code.botcompany.de:8081/tb/show-snippet.php?id=1000716>("Timestamps are 
weird: " + lastLines);
    } else
      confused 
<http://code.botcompany.de:8081/tb/show-snippet.php?id=1000716>("Was expecting 
reboot cmd & then reboot effect: " + lastLines);
  }
  
  void confused 
<http://code.botcompany.de:8081/tb/show-snippet.php?id=1000716>(S msg) {
    printAndProgramLog 
<http://code.botcompany.de:8081/tb/show-snippet.php?id=1019467>("Confused: " + 
msg);
  }
  
  void notConfused(S msg) {
    printAndProgramLog 
<http://code.botcompany.de:8081/tb/show-snippet.php?id=1019467>("I am very 
satisfied. " + msg);
  }
  
  void predict(S msg) {
    printAndProgramLog 
<http://code.botcompany.de:8081/tb/show-snippet.php?id=1019467>("I predict: " + 
msg);
    dm_sayInEnglish 
<http://code.botcompany.de:8081/tb/show-snippet.php?id=1017864>(msg);
  }
  
  void predictReboot enter {
    predict("A reboot will happen in between "
      + formatDouble 
<http://code.botcompany.de:8081/tb/show-snippet.php?id=1007643>(typicalTimeToReboot.start,
 1) + " and "
      + formatDouble 
<http://code.botcompany.de:8081/tb/show-snippet.php?id=1007643>(typicalTimeToReboot.end,
 1) + " seconds");
  }
}

------------------------------------------
Artificial General Intelligence List: AGI
Permalink: 
https://agi.topicbox.com/groups/agi/T11ea636ab80258b4-M8019ba8bb36b53a630f74119
Delivery options: https://agi.topicbox.com/groups/agi/subscription

Reply via email to