Table 13 presents the algorithm of a rudimentary embodied system.
Table 13: algorithm of a rudimentary embodied system.
01 experiment = e1 02 Loop(cycle++) 03 if (mood = BORED) 04 selfSatisfiedDuration = 0 05 experiment = pickOtherExperiment(experiment) 06 anticipatedResult = anticipate(experiment) 07 if (experiment = e1) 08 result = r1 09 else 10 result = r2 11 recordTuple(experiment, result) 12 if (result = anticipatedResult) 13 mood = SELF-SATISFIED 14 selfSatisfiedDuration++ 15 else 16 mood = FRUSTRATED 17 selfSatisfiedDuration = 0 18 if (selfSatisfiedDuration > 3) 19 mood = BORED 20 print cycle, experiment, result, mood
Table 13, Lines 03 to 05: if the agent is bored, it picks another experiment arbitrarily from amongst the predefined list of experiments at its disposal. Line 06: the anticipate(experiment) function searches memory for a previously learned tuple that matches the chosen experiment, and returns its result as the next anticipated result. Lines 07 to 10 implement the environment: e1 always yields r1, and other experiments always yield r2. Line 11: the agent records the tuple 〈experiment, result〉 in memory. Lines 12 to 17: if the result was anticipated correctly then the agent is self-satisfied, otherwise it is frustrated. Lines 18 and 19: if the agent has been self-satisfied for too long (arbitrarily 3 cycles), then it becomes bored.
Notably, this system implements a single program called Existence which does not explicitly differentiate the agent from the environment. Lines 07 to 10 are considered the environment, and the other lines the agent. The environment does not have a state, as we promised in the previous page.
If you have no interest in programming, then you can skip the rest of this page and proceed to the next page.
If you an have interest in programming, but do not wish to do the optional programming activities, then we recommend you browse through Project 1 below, just to get a sense of how the code is organized.
If you wish to do the optional programming activities, then your activity for lesson 1 is to install Project 1 in your favorite development environment (any IDE, for example, we use Eclipse), and run it. You should get a trace similar to that shown on the next page. If you do not like java, well, you may reprogram it in the language of your choice.
To install Project 1, you can either:
Project 1 (click to see the code in your browser):
If you have troubles running this demo on your computer, or if you have advice for other participants, please share them in the Developmental AI MOOC Gooogle+ community using the links at the bottom of the page.
See public discussions about this page or start a new discussion by clicking on the Google+ Share button. Please type the #IDEALMOOC013 hashtag in your post: