global {
file shape_file_buildings <- file('../includes/building.shp');
...
init {
create building from: shape_file_buildings with: [type::string(read ('NATURE')), nb_people::float(read('NB_PEOPLE'))] {
if type='Industrial' {
set color <- rgb('blue') ;
}
create people number: nb_people {
set location <- any_location_in (myself);
}
}
...
}
...
}
entities {
species building {
string type;
int nb_people;rgb color <- rgb('gray') ;
aspect base {
draw shape color: color ;
}
}
}
--
You received this message because you are subscribed to the Google Groups "GAMA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gama-platfor...@googlegroups.com.
To post to this group, send email to gama-p...@googlegroups.com.
Visit this group at http://groups.google.com/group/gama-platform.
For more options, visit https://groups.google.com/groups/opt_out.
--
let list_people type:list of: people <- list(people);
init {
create building from: shape_file_buildings with: [type::string(read ('NATURE')), nb_people::int(read('NB_PEOPLE')), no_bat::int(read('NO_BAT'))]
{
if type='Industrial' {
set color <- rgb('blue') ;
}
if type='Residential' {
set color <- rgb('red') ;
}
if type='' {
set color <- rgb('white') ;
}
}
let residential_buildings type: list of: building <- list(building) where (each.type='Residential');
let industrial_buildings type: list of: building <- (building as list) where (each.type='Industrial') ;
loop b over: residential_buildings {
create people number: b.nb_people {
set speed <- min_speed + rnd (max_speed - min_speed) ;
set start_work <- min_work_start + rnd (max_work_start - min_work_start) ;
set end_work <- min_work_end + rnd (max_work_end - min_work_end) ;
set living_place <- b;
set location <- any_location_in (living_place);
set working_place <- one_of(industrial_buildings) ;
}
//let list_people type:list of: people <- list(people); Je comprends pas du tout cette ligne
set tot_people <- nb_people+tot_people;
}
write 'Total number of people: ' +tot_people;
create road from: shape_file_roads ;
let weights_map type: map <- (list (road)) as_map [each:: each.destruction_coeff];
set the_graph <- as_edge_graph(list(road)) with_weights weights_map;
}
Cheers,
Patrick