62 lines
2.1 KiB
Markdown
62 lines
2.1 KiB
Markdown
# Calculator-Example
|
|
|
|
This is a simple example of an calculator "agent system" using the [Agents Platform](https://git.chai.uni-hamburg.de/UMS-Agenten/Agenten-Plattform) and based on [Agent Template](https://git.chai.uni-hamburg.de/UMS-Agenten/Agent-Template).
|
|
|
|
Start by `docker compose up` and open web interface of management at <http://localhost:8080/>.
|
|
|
|
## Calculator
|
|
A riddle is a math expression, e.g., `x * y =`.
|
|
The values of the variables `x` and `y` are defined via text files, e.g., a line `x = 10` in text file assigns the value to `12` to the variable `x`.
|
|
|
|
For example, the result of a riddle `x * x =` would be `100` with the explanation `10 * 10 = 100`.
|
|
|
|
## Riddle Example
|
|
In this example the values of the variables are [`x = 10`](./data/share/example/x.txt), [`y = 15`](./data/share/example/y.txt), and [`z = 20`](./data/share/example/z.txt); see the files in [`./data/share/example/`](./data/share/example/).
|
|
|
|
1. You can send a riddle to management via the web interface (http://localhost:8080/app/new) by filling out the form and clicking "Send Message.":
|
|

|
|
2. The message to management will look like this:
|
|
```json
|
|
{
|
|
"id": "test1",
|
|
"sub_ids": [],
|
|
"riddle": {
|
|
"context": "",
|
|
"question": "y + x =",
|
|
"solutions_before": []
|
|
},
|
|
"solution": [],
|
|
"data": [
|
|
{
|
|
"type": "text",
|
|
"file_plain": "example/z.txt",
|
|
"file_extracted": null
|
|
},
|
|
{
|
|
"type": "text",
|
|
"file_plain": "example/y.txt",
|
|
"file_extracted": null
|
|
}
|
|
],
|
|
"status": {
|
|
"extract": {
|
|
"required": true,
|
|
"finished": false
|
|
},
|
|
"solve": {
|
|
"required": true,
|
|
"finished": false
|
|
},
|
|
"validate": {
|
|
"required": true,
|
|
"finished": false
|
|
},
|
|
"trial": 0,
|
|
"solved": false
|
|
},
|
|
"contacts": 0
|
|
}
|
|
```
|
|
3. Afterwards, messages will be sent between agents while they solve the riddle. These messages are viewable in the web interface (<http://localhost:8080/app/table>).
|
|
4. The result can finally be found in the latest message:
|
|
 |