Environment and agent
The environment is the maze and the agent is the red triangle. The agent does not know the map or where the flag is. The tip of the triangle shows the direction it faces.
Percept
At every moment the agent perceives only two things: is the right open, is the front open. The blue rings are the cells it currently sees as open. That is all it knows.
Rule
The agent chooses its action with a rule table: if the right is open, turn right and move; otherwise if the front is open, move; if both are closed, turn left. This is the right hand rule, like walking without taking your right hand off the wall. On the first turn the right was open, so it turned right and took a step.
Perceive, choose, act: turn 8
The loop is the same every turn: perceive, look up the rule, act, and the environment changes. So far it moved forward 7 times and turned in place 1 times. The red line is the path it walked.
Perceive, choose, act: turn 15
The loop is the same every turn: perceive, look up the rule, act, and the environment changes. So far it moved forward 13 times and turned in place 2 times. The red line is the path it walked.
Perceive, choose, act: turn 23
The loop is the same every turn: perceive, look up the rule, act, and the environment changes. So far it moved forward 18 times and turned in place 5 times. The red line is the path it walked.
Perceive, choose, act: turn 30
The loop is the same every turn: perceive, look up the rule, act, and the environment changes. So far it moved forward 25 times and turned in place 5 times. The red line is the path it walked.
Perceive, choose, act: turn 38
The loop is the same every turn: perceive, look up the rule, act, and the environment changes. So far it moved forward 32 times and turned in place 6 times. The red line is the path it walked.
It reached the flag
The agent reached the flag in 45 turns: 37 moves forward and 8 turns. Without ever knowing the map, only with the rule. But the path is not the shortest; following the wall it also walked into dead ends.
Why it matters
Every system in artificial intelligence can be seen as an agent: it perceives, decides and acts. This agent is a simple reflex agent that only looks at the current percept. In the next topics the agent thinks first: it sets the maze up as a search problem and finds the path before taking a step.