1. Skeleton model
This first step defines the environment for the gold-miner tutorial: gold mines, a market and a 3D display. The agents do not yet use BDI behavior.
Gold mines and market​
Each mine has a random quantity of gold. The default aspect shows its quantity with the triangle size and whether it is empty with its color. The market is drawn as a square.
species gold_mine {
int quantity <- rnd(1, 20);
aspect default {
draw triangle(200 + quantity * 50) color: (quantity > 0) ? #yellow : #gray border: #black;
}
}
species market {
int golds;
aspect default {
draw square(1000) color: #black;
}
}
Initialize the world​
The global section defines ten mines, stores the market agent in the_market, sets the simulation step and specifies the world geometry. The init block creates the market and mine agents.
global {
int nb_mines <- 10;
market the_market;
geometry shape <- square(20 #km);
float step <- 10 #mn;
init {
create market {
the_market <- self;
}
create gold_mine number: nb_mines;
}
}
Display the model​
The GUI experiment displays the market and mines in a 3D view.
experiment GoldBdi mode: gui {
output {
display map renderer: 3d {
species market;
species gold_mine;
}
}
}
See the complete BDI tutorial 1 source in the model library.