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

Refactor of examples/game_of_life #3598

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jesper-olsen
Copy link
Contributor

@jesper-olsen jesper-olsen commented Feb 4, 2024

Description

Refactor of examples/game_of_life as follows:

  1. Moved conway grid logic from main.rs to cell.rs - to better separate model & yew code.
  2. Renamed cell.rs to conway.rs
  3. Simplified and removed some codeblocks - e.g. directly count neighbours, instead of retuning them so that they can be counted...

Functionality is unchanged, LOC is reduced from 282 to 210 (~25%).

Fixes #0000

Checklist

  • I have reviewed my own code
  • I have added tests

Copy link

github-actions bot commented Feb 4, 2024

Size Comparison

examples master (KB) pull request (KB) diff (KB) diff (%)
async_clock 102.006 102.006 0 0.000%
boids 175.728 175.728 0 0.000%
communication_child_to_parent 94.526 94.526 0 0.000%
communication_grandchild_with_grandparent 107.470 107.470 0 0.000%
communication_grandparent_to_grandchild 102.744 102.744 0 0.000%
communication_parent_to_child 90.881 90.881 0 0.000%
contexts 107.571 107.571 0 0.000%
counter 87.850 87.850 0 0.000%
counter_functional 88.238 88.238 0 0.000%
dyn_create_destroy_apps 90.744 90.744 0 0.000%
file_upload 101.674 101.674 0 0.000%
function_memory_game 174.516 174.516 0 0.000%
function_router 351.228 351.228 0 0.000%
function_todomvc 163.154 163.154 0 0.000%
futures 231.769 231.769 0 0.000%
game_of_life 112.119 111.677 -0.442 -0.395%
immutable 189.780 189.780 0 0.000%
inner_html 81.536 81.536 0 0.000%
js_callback 111.297 111.297 0 0.000%
keyed_list 201.004 201.004 0 0.000%
mount_point 84.424 84.424 0 0.000%
nested_list 115.850 115.850 0 0.000%
node_refs 92.000 92.000 0 0.000%
password_strength 1753.896 1753.896 0 0.000%
portals 95.202 95.202 0 0.000%
router 320.293 320.293 0 0.000%
simple_ssr 142.319 142.319 0 0.000%
ssr_router 389.602 389.602 0 0.000%
suspense 117.522 117.522 0 0.000%
timer 90.345 90.345 0 0.000%
timer_functional 99.719 99.719 0 0.000%
todomvc 143.458 143.458 0 0.000%
two_apps 87.535 87.535 0 0.000%
web_worker_fib 136.750 136.750 0 0.000%
web_worker_prime 187.137 187.137 0 0.000%
webgl 84.146 84.146 0 0.000%

✅ None of the examples has changed their size significantly.

@jesper-olsen jesper-olsen changed the title grid logic 2 conway.rs Refactor of examples/game_of_life Feb 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant