The Action Plugin and Action Addon Framework


The Smart Robot Action Addon

The Smart Robot Action Addon is a toy example which shows movements of a robot under a maze. There are some actions to create the maze, to set the initial position of the robot and an action to move the robot. There is also the possibility to insert a treasure that must be found by the robot. The Addon stores the number of times that the robot was in each cell of the maze, so the "intelligence" can make moves in a smarter way. The robot can also store the position of walls that it see when it moves in the maze. The Smart Robot Action Addon provides a single atom #smartRobot. It takes three inputs where former is the action name and the others are the options related to action:

#smartRobot[A, AO1, AO2]{O,P}[W : L]
Input:
A
action type, can be addWall, setDimension, setPosition, putTreasure, move, addDetectedWall, printMazeDetectedByTheRobot, finishedFirstExecution
AO1
option related to the type of action A

AO2
option related to the type of action A

The Atom Action #smartRobot allows you to build the maze, to position inside a treasure, to move the robot, to memorize the walls identified and print the maze "reconstructed" by the robot.

The Action addWall allows to add a wall at the specified location; the parameters AO1 and AO2 specify respectively the row and the column where to insert the wall.
The Action setDimension allows to specify the size of the maze; every time this action is executed, if the specified size are different from the current one, the maze is destroyed and then recreated; the parameters AO1 and AO2 specify respectively the number of rows and the number columns.
The Action setPosition allows to specify the position of the robot in the maze; the parameters AO1 and AO2 specify respectively the row and the column where to insert the robot.
The Action putTreasure allows to place the treasure in the labyrinth; the parameters AO1 and AO2 specify respectively the row and the column where to insert the treasure.
The Action move allows to specify the direction in which the robot has to move; the labyrinth with everything in it is printed at the end of each movement of the robot; the parameter AO1 can take specific values(up, down, left, right), the parameter AO2 is not used.
The Action addDetectedWall allows to add a wall identified by the robot at the specified location; the parameters AO1 and AO2 specify respectively the row and the column where to insert the wall.
The Action printMazeDetectedByTheRobot allows to print to standard output the maze that the robot has "reconstructed", the parameters are not used.


The Smart Robot Action Addon provides some External Atoms:
&getPosition[](R, C)
Output:
R
row that identifies the cell in which the robot is currently located.

C
column that identifies the cell where the robot is currently located.

&previousMovement[](Pm)
Output:
Pm
previous movement of the robot (up, down, left, right).

&weights[](Wup, Wdown, Wleft, Wright)
Output:
Wup
number of times the robot went up.

Wdown
number of times the robot went down.

Wleft
number of times the robot went left.

Wright
number of times the robot went right.

&foundTreasure[]()
is true if the robot found the treasure
&exploredTheWholeMaze[]()
is true if the robot explored the whole maze.

You can check it out its source here.

For other action addons return to the section Action Addons of The Action Plugin and Action Addon Framework.



Last edited 2013-04-23

 

General
dlvhex source code @ github.com
Description-Of-A-Project

Popular Plugins
Action Plugin
DecisionDiagrams Plugin
Description Logics Plugin
Description Logics Lite Plugin
MELD: Belief Merging Plugin
Nested HEX Plugin
MCSIE Plugin
String Plugin
dlvhex-semweb Project

Documentation
User Guide
README
doxygen
Writing Plugins in C++
Writing Plugins in Python