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

Add Game of Life Demo #7

Merged
merged 3 commits into from
Apr 19, 2024
Merged

Add Game of Life Demo #7

merged 3 commits into from
Apr 19, 2024

Conversation

pauladam94
Copy link
Contributor

No description provided.

Copy link
Owner

@jonasgeiler jonasgeiler left a comment

Choose a reason for hiding this comment

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

Great work on the demo! 👏🏻
I have found a few minor problems which I hope you can address, otherwise I'd be happy to merge this.
Thank you!

demos/game_of_life.lua Outdated Show resolved Hide resolved
demos/game_of_life.lua Outdated Show resolved Hide resolved
demos/game_of_life.lua Show resolved Hide resolved
demos/game_of_life.lua Outdated Show resolved Hide resolved
demos/game_of_life.lua Outdated Show resolved Hide resolved
demos/game_of_life.lua Outdated Show resolved Hide resolved
@jonasgeiler jonasgeiler added the documentation Improvements or additions to documentation label Apr 15, 2024
- only use local variables
- no time management for simplier code
@pauladam94
Copy link
Contributor Author

  • I used only local variables.
  • to keep the code under 60 lines (which the main point of demos I think) I remove time management from the code. Your implementation is easy, but I think for such a demo the point is to be as concise as possible !

Copy link
Owner

@jonasgeiler jonasgeiler left a comment

Choose a reason for hiding this comment

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

Thank you for the changes! Looking great already!

There is one minor little change I would like you to do before I merge this.
I think I have caused a little bit of confusion with the "everything should be local" quote. In Lua, local variables work pretty much the same way that global ones do except that you can't use them when you require() a file. What I'm trying to say is that you don't have to pass the neighbours variable into the count_alive_neighbours function as an argument. Instead, you can just define the neighbours variable above the count_alive_neighbours function and then reference it in the function body and remove the neighbours argument from the function.

@pauladam94
Copy link
Contributor Author

So I removed the argument neighbourgs of the function count_alive_neighbours. I did it because of the habit of making code more generic but here it has no use for simple demos.

@jonasgeiler
Copy link
Owner

Perfect! Thank you for your work! 🔥

I will merge this and also release v1.0.0 soon, since I'm pretty happy about the state of the library and feel like it's pretty much ready.
Hope you'll have fun with it!

@jonasgeiler jonasgeiler merged commit b2cb47b into jonasgeiler:main Apr 19, 2024
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants