AW000 → AW001 → AW002 → AW003 → AW004
In AW003, we introduced memory and observed that previous interactions could be recorded.
This notebook asks the next question.
What changes when memory influences future decisions?
To answer this question, we extend the previous world by introducing a simple decision process based on memory while keeping everything else unchanged.
The purpose is not yet to study learning, adaptation, or intelligence.
Instead, we examine the smallest possible way in which memory can influence an agent’s future behavior.
As in the previous notebooks, we begin by defining what exists before writing any Python code.
Compared with AW003, this notebook introduces only one new element.
This artificial world now contains the following entities.
| Entity | Description |
|---|---|
| Universe | The environment in which the agents exist. |
| Agent #1 | The first active entity. |
| Agent #2 | The second active entity. |
| Energy | The internal state of each agent. |
| Transfer | A mechanism through which one agent can transfer part of its energy to the other. |
| Memory | A record of previous interactions maintained by each agent. |
| Decision | An action selected by an agent using its current state and memory. |
To answer the question, we extend the previous artificial world by introducing decisions based on memory.
This artificial world now contains
Each agent now records its experiences in memory. These memories persist through time and provide the foundation for future decision-making.
No learning, adaptation, communication, or strategy has yet been introduced.
By intentionally introducing only one new element, we isolate the effect of memory-based decision itself.
The following diagram illustrates the ontology introduced above and the relationships among the entities in this artificial world.
class Agent:
def __init__(self, name, money):
self.name = name
self.money = money
self.memory = []
def receive_money(self, other, amount):
self.money += amount
self.memory.append(
f"Received {amount} from {other.name}."
)
def give_money(self, other, amount):
self.money -= amount
self.memory.append(
f"Gave {amount} to {other.name}."
)
other.receive_money(self, amount)
agent_1 = Agent("Agent 1", 100)
agent_2 = Agent("Agent 2", 200)
print("Initial state")
print(agent_1.name, agent_1.money)
print(agent_2.name, agent_2.money)
for interaction in range(1, 4):
agent_1.give_money(agent_2, 20)
print()
print(f"After interaction {interaction}")
print(agent_1.name, agent_1.money)
print(agent_2.name, agent_2.money)
Initial state Agent 1 100 Agent 2 200 After interaction 1 Agent 1 80 Agent 2 220 After interaction 2 Agent 1 60 Agent 2 240 After interaction 3 Agent 1 40 Agent 2 260
print("Agent 1 memory")
for record in agent_1.memory:
print(record)
print()
print("Agent 2 memory")
for record in agent_2.memory:
print(record)
Agent 1 memory Gave 20 to Agent 2. Gave 20 to Agent 2. Gave 20 to Agent 2. Agent 2 memory Received 20 from Agent 1. Received 20 from Agent 1. Received 20 from Agent 1.
Run the simulation once and observe how each agent accumulates a persistent memory of its experiences. Although these memories are not yet used to determine actions, they establish a foundation for future behavioral rules.
The simulation shows that previous interactions can now influence future decisions.
Although the transfer mechanism remains unchanged, each agent consults its memory before selecting its next action.
The behavior of an agent therefore depends not only on its current state but also on its remembered experience.
Memory becomes functionally meaningful when it influences future decisions.
The artificial world now contains agents that not only interact and remember but also use those memories when acting.
This naturally leads to the next question explored in AW005.