Mind.py

Roman Suzi rnd at onego.ru
Tue Aug 17 17:47:01 CEST 2004


This is non-threaded Mind in Python. I was having fun with this module
as it already was out of control at this early stage of development:

  os.execv(sys.argv[0], sys.argv) it appears must have all args as a

second arg, and I supposed that I must exclude sys.argv[0] from it.

All other modules are like this:

-><----------- Security.py

def Security(m):
    pass

-><-----------

But they are needed to have something non-trivial.

Rejuvenations are made as complete restarting the process. This is
in case Mind changed some modules by itself ;-) Or even it's main module
aLife.py ;-)

Have fun.


-><------------------------------------------------------------------

#!/usr/bin/python
# -*- mode: python -*-
# $Id:$

"""
aLife() (artificial life) is the Robot AI Mind main loop.
"""

import sys, time, os
from Security import Security
from Sensorium import Sensorium
from Emotion import Emotion
from Think import Think
from Volition import Volition
from Motorium import Motorium
from Voice import Voice

class Mind:  # Tabula rasa
    pass

rsvp = 1000

def aLife():  # ATM 27oct2002 or your ID & date.
    try:
       m = Mind()   # persistence to be added in future
       Security(m)  # For human control and operation of the AI.
       Sensorium(m) # Audition other human-robot input senses.
       Emotion(m)   # Quasi-physiological influence upon thought.
       Think(m)     # Syntax and vocabulary of natural languages.
       Volition(m)  # Contemplative selection of motor options.
       Motorium(m)  # Robotic activation of motor initiatives.
    except:
        sys.exit(0)
    rjc = int((sys.argv[1:2] or ['0'])[0])
    # If the AI has not met with misadventure,
    fyi = "aLife: calling itself t = %s rejuvenations = %i" % (time.strftime("%Y.%m.%d %H:%H:%S"), rjc)
    print fyi # Display the Voice:brain "For Your Information".
    Voice(m)
    time.sleep(rsvp/1000) # End of quasi-loop time-delay of rsvp-value milliseconds.
    sys.argv[1] = str(rjc + 1)
    os.execv(sys.argv[0], sys.argv) # Call aLife again.
# End of one pass through the aLife Mind that repeats itself.

if __name__ == "__main__":
   aLife()

# End of aLife.py



More information about the Python-list mailing list