Remove a certain rule
Examples
create_agent() %>%
add_rule('minors move',
age >= 18,
.consequence = \(me, abm) {
spot <- grid_get_free_neighboring_spots(me, abm) %>%
dplyr::slice_sample(n = 1)
grid_move(me, abm,
new_x = spot$.x,
new_y = spot$.y) %>%
return()
}) %>%
remove_rule('minors move')
#> # A tibble: 0 × 0
#> # ABM agent
#> * 0 agent characteristic(s),
#> * 0 agent variable(s),
#> * 0 agent rule(s),
create_grid_environment(seed = 1271, size = 5) %>%
add_variable(n_agents = \(me, abm) nrow(convert_agents_to_tibble(me))) %>%
add_rule('no more agents',
n_agents == 0,
.consequence = stop_abm) %>%
remove_rule('no more agents')
#> # A tibble: 0 × 0
#> # ABM grid environment
#> * 5x5, 0 agents
#> * 0 environment characteristic(s),
#> * 1 environment variable(s),
#> * 0 environment rule(s),
#> * not initiated