Skip to content

Instantly share code, notes, and snippets.

@pjpetersik
Last active April 6, 2022 09:58
Show Gist options
  • Save pjpetersik/9ad74324d2170a707f11de22f800df8b to your computer and use it in GitHub Desktop.
Save pjpetersik/9ad74324d2170a707f11de22f800df8b to your computer and use it in GitHub Desktop.
using Plots
model = Model(50)
@gif for t ∈ 1:150
step!(model)
postions = [ agent.position for agent in model.peloton ]
arr = hcat(postions...)
energy = [ agent.energy for agent in model.peloton ]
scatter(arr[1,:], arr[2,:], xlims=(-0.2, 1.), ylims=(0,1), marker_z=energy, color=:RdYlGn_9, clims=(0., 1), clabel="Energy")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment