Uh oh!
There was an error while loading. Please reload this page.
Create wa-tor algorithm - #8899
Conversation
There was a problem hiding this comment.
Click here to look at the relevant links ⬇️
🔗 Relevant Links
Repository:
Python:
Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.
algorithms-keeper commands and options
algorithms-keeper actions can be triggered by commenting on this PR:
@algorithms-keeper reviewto trigger the checks for only added pull request files@algorithms-keeper review-allto trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will post all the messages in one comment.NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Christian Clauss <cclauss@me.com>
for more information, see https://pre-commit.ci
Again, not sure why build is failing. All tests pass locally for my algorithm |
It looks to be something in one of |
cclauss
commented
Jul 28, 2023
Please rename |
tianyizheng02
commented
Jul 28, 2023
@CaedenPH Let's see if the build succeeds now |
CaedenPH
commented
Jul 29, 2023
Works 👍 |
tianyizheng02
left a comment
There was a problem hiding this comment.
General feedback:
- Per PEP8,
x is True->x - Rather than iterating over the 4 possible directions and having multiple nested if-statements handling each direction, it's a lot simpler to just iterate over a list of the 4 neighboring squares and handle them in a more generic manner. For example, instead of checking if
row - 1 >= 0when the direction is North and ifrow + 1 < self.heightwhen the direction is South, just check whether the row to move to is in bounds:0 <= r < self.height. An extra comparison or two is worth the increased readability, IMO.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
ea3869f to
9f23c25CompareCo-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
6f61366 to
e659bd1CompareCo-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
c025f8a to
d277dbaCompareCo-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
Co-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
faafb49 to
7dc6788CompareCo-authored-by: Tianyi Zheng <tianyizheng02@gmail.com>
for more information, see https://pre-commit.ci
CaedenPH
commented
Aug 10, 2023
@tianyizheng02 Apologies for not responding earlier, I've been very busy with work. The suggestions regarding simplifying the logic for neighbouring cells you made are logical, however they don't account for the weighting order. Might be better to leave it as is |
Describe your change:
Implements the wa-tor algorithm (https://en.wikipedia.org/wiki/Wa-Tor)
The wa-tor algorithm is a cellular automata featuring predators and prey. All code is doctested and documented, linking to multiple sources.
Checklist: