-
Notifications
You must be signed in to change notification settings - Fork 30
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
Add rps automata #42
base: master
Are you sure you want to change the base?
Add rps automata #42
Conversation
Addresses ljvmiranda921#26. The current implemenation maintains separate 2D board matrices for each state to allow the use of existing lifeforms.
This board allows for the use of multistate automata.
Codecov Report
@@ Coverage Diff @@
## master #42 +/- ##
===========================================
- Coverage 97.76% 86.73% -11.03%
===========================================
Files 12 12
Lines 268 309 +41
===========================================
+ Hits 262 268 +6
- Misses 6 41 +35
Continue to review full report at Codecov.
|
Hi @whonut , thanks for this! Let me check your code this weekend! Hope you had fun working on it! |
No worries!
This is actually a better solution that what I was thinking. I realized that it might be difficult to reuse the Lifeforms if I create a board that uses different integers instead of the binary one. Would you mind elaborating on a high-level how you're implementing the logic? I assume that (forgive, I haven't looked at the code yet):
Let me look at the code in a few minutes and add my thoughts! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good! I think the bulk of the remaining tasks would be documentation and testing. I'd suggest adding:
- A notebook in our docs: https://github.com/ljvmiranda921/seagull/tree/master/docs/notebooks that outlines how the rock-paper-scissors automata can be used
- A nice-looking example and GIF that we can put on the README!
- Unit tests so that the coverage report passes properly!
class MultiStateBoard: | ||
""" | ||
Represents a multistate environment where the lifeforms can grow and | ||
evolve |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once we've settled on the setup, I'd highly recommend elaborating further in the docstring how the MultiStateBoard
"works"! 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course :)
Renames MultiStateBoard.states to state for consistency with Board.
The fix ensures that, when adding lifeforms, each cell is in exactly one state at a time i.e. only one of the entries in the state tensor corresponding to that cell is set to True at any one time.
board.py now conforms with black style guide.
Fixed a bug with rps_life_rule with neighbour counting caused by the array holding neighbour counts inheriting the dtype bool from the state array.
So I've squashed some bugs so it actually works now! 😳 The major thing that needs doing now is some sort of modification of |
Let's treat this as another Issue or PR! I'm fine keeping them separate for now. Perhaps you can create a base class, Either way, I'm fine even with having a Sorry won't be able to check this until Sunday (or the next weekend, not this week)! Will be on vacation leave for a bit to recharge! Will find a timeto read through this and add my comments! |
Fair enough, I'm pretty new at this!
I look forward to it! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! The only thing remaining are the tests so that the code coverage checks will pass 👍 let me know if you need some guidance in doing them, @whonut !
Hi @whonut , any updates on this? 😄 |
Addresses #26.
Apologies if I should've asked before cracking on with this. There are basically two main additions at present:
A new rule implementing the rock-paper-scissors automota. The implementation relies on storing a copy of the board for each state in a 3D binary/boolean array. The reason I did it this way rather than using a single integer array with different numbers for each state is that it seemed the obvious way to allow use of existing Lifeforms. It occurs to me as I write this that it would be fairly easily to do this using a single 2D integer array too. I look forward to your thoughts on this.
A
MultiStateBoard
which keeps track of automata with multiple states and allows existing lifeforms to be added in a given state.I haven't gotten animation working at present but I thought I'd open a PR before I start hacking at existing code! I think my additions are in a good enough state to have a discussion at this point.