Showing 2 of 5 files from the diff.

@@ -29,6 +29,7 @@
Loading
29 29
@deprecate space_neighbors nearby_agents
30 30
@deprecate node_neighbors nearby_positions
31 31
@deprecate get_node_contents agents_in_pos
32 +
@deprecate pick_empty random_empty
32 33
33 34
# Predefined models
34 35
include("models/Models.jl")

@@ -7,7 +7,7 @@
Loading
7 7
- agents_in_pos(position, model)
8 8
=#
9 9
10 -
export nodes, agents_in_pos, find_empty_nodes, pick_empty, has_empty_nodes
10 +
export nodes, agents_in_pos, find_empty_nodes, random_empty, has_empty_nodes
11 11
12 12
"""
13 13
    nodes(model::ABM{A, <:DiscreteSpace}) → ns
@@ -55,10 +55,10 @@
Loading
55 55
end
56 56
57 57
"""
58 -
    pick_empty(model::ABM{A, <:DiscreteSpace})
58 +
    random_empty(model::ABM{A, <:DiscreteSpace})
59 59
Return a random position without any agents, or `nothing` if no such positions exist.
60 60
"""
61 -
function pick_empty(model::ABM{<:AbstractAgent,<:DiscreteSpace})
61 +
function random_empty(model::ABM{<:AbstractAgent,<:DiscreteSpace})
62 62
    empty_nodes = find_empty_nodes(model)
63 63
    isempty(empty_nodes) && return nothing
64 64
    rand(empty_nodes)
@@ -76,9 +76,9 @@
Loading
76 76
per node position. This function does nothing if there aren't any empty positions.
77 77
"""
78 78
function add_agent_single!(agent::A, model::ABM{A,<:DiscreteSpace}) where {A<:AbstractAgent}
79 -
    node = pick_empty(model)
80 -
    isnothing(node) && return agent
81 -
    agent.pos = node
79 +
    position = random_empty(model)
80 +
    isnothing(position) && return agent
81 +
    agent.pos = position
82 82
    add_agent_pos!(agent, model)
83 83
    return agent
84 84
end
Files Coverage
src 88.87%
Project Totals (13 files) 88.87%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading