Another common behavior is pushing. In the game of Sokoban a person is supposed to push boxes around a maze onto targets. The box should only move if it could move onto a target spot or a regular ground tile. If the box is blocked because it is facing a wall in the direction of the push then neither it not the person pushing it should move.A simple solution pattern distributes the responsibility of checking for walls and moving between the person and the box agent
A simple modification will allow the person to move more boxes. When a box receives the “push_right” message it could check for another box to the right. If there is another box then it would recursively propagate the “push_right” to all the boxes to the right. When the right most box receives the message it could start moving the box to its left to move right making all the boxes move including the person. The scheme can be further refined to limit the number of boxes that can be pushed. A numerical attribute called strength defined by the person can be propagated and decremented from left to right. If the number of boxes exceeds the strength then the boxes cannot be pushed.