Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update battle.jl #34

Merged
merged 2 commits into from
Oct 13, 2024
Merged

Update battle.jl #34

merged 2 commits into from
Oct 13, 2024

Conversation

BonelessPi
Copy link
Contributor

  • Pass ifempty=false to walk!() calls so that agents can start to fight
  • Rename battle() to create_battlefield() to better match the purpose of the function. Also helps avoid confusion with the unrelated function battle!()

* Pass ifempty=false to walk!() calls so that agents can start to fight
* Rename battle() to create_battlefield() to better match the purpose of the function. Also helps avoid confusion with the unrelated function battle!()
@BonelessPi
Copy link
Contributor Author

In response to #23

@Datseris
Copy link
Member

Datseris commented Oct 9, 2024

thanks. i assume you've run the example and the video works fine?

@@ -182,7 +182,7 @@ function captor_behavior!(agent, model)
## Prisoner runs away in the commotion
prisoner.shape = :utriangle
prisoner.capture_time = 0
walk!(prisoner, (rand(abmrng(model), -1:1, 2)..., 0), model)
walk!(prisoner, (rand(abmrng(model), -1:1, 2)..., 0), model, ifempty=false)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
walk!(prisoner, (rand(abmrng(model), -1:1, 2)..., 0), model, ifempty=false)
walk!(prisoner, (rand(abmrng(model), -1:1, 2)..., 0), model; ifempty=false)

i believe it makes for a more readable code if keywords are separated by ; can you change this here and in subsequent calls?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this change in new commit

@BonelessPi
Copy link
Contributor Author

battle.mp4

Here's the video that it generates for me. Technically the video starts after 5 steps have already passed in the model.

@Datseris Datseris merged commit 422c012 into JuliaDynamics:main Oct 13, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants