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

Simplify find_food #13

Closed
nmheim opened this issue Oct 8, 2021 · 1 comment
Closed

Simplify find_food #13

nmheim opened this issue Oct 8, 2021 · 1 comment

Comments

@nmheim
Copy link
Contributor

nmheim commented Oct 8, 2021

1. Hint: For the functional programming way of coding this can use `filter` and
`isa` to filter for a certain type and `StatsBase.sample` to choose a random
element from a vector. You can get an `Iterator` of values of your dictionary
via `values` which you might want to `collect` before passing it to `sample`.
2. Hint: You could also program this with a for-loop that iterates over your
agents in a random order.

Using filter is both slow and not super straight forward in this case. We could remove hint 1 and expand on hint 2.

@nmheim
Copy link
Contributor Author

nmheim commented Jun 13, 2022

closed in favour of #61

@nmheim nmheim closed this as completed Jun 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant