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

Make `world_tick` faster by not checking all cells as neighbor candidates #1

Merged
merged 1 commit into from Sep 18, 2018

Conversation

Projects
None yet
1 participant
@vorce
Owner

vorce commented Sep 18, 2018

When coding golux (https://github.com/vorce/golux) I noticed
that updating the golex world was very slow (1+ second for a 80x60 world).
Calculating the new cell state was very naive; O(n^2) on the number of cells.
This should improve it to O(n) by storing the cells in a map instead of a list.

Also changed cell positions and world dimensions to tuples instead of lists

@vorce vorce changed the title from Make `world_tick` faster by storing the cells in a map instead of list to Make `world_tick` faster by not checking all cells as neighbor candidates Sep 18, 2018

@vorce vorce merged commit 2aa67be into master Sep 18, 2018

@vorce vorce deleted the optimize_world_tick branch Sep 18, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment