Post Reply 
Conway's game of life with random initial cells
09-16-2023, 04:25 PM (This post was last modified: 09-16-2023 06:06 PM by komame.)
Post: #2
RE: Conway's game of life with random initial cells
Hi max1138,

Nice job Smile
If you don't mind, I'd like to suggest a few improvements.

1. It would be better to draw in a buffer, and when you finish drawing, immediately display the finished buffer image. This way, there won't be any intermediate effects of drawing individual elements, which can be quite noticeable, especially for smaller cell sizes, e.g., for 5. After such a change, it will look much better, even on slower hardware like G1.
2. It's not worth creating variables just to use them once later in the program. Yes, sometimes it's helpful during debugging, but in algorithms where performance matters, it has a negative impact on program speed. So instead of creating several variables just to substitute them once, it's better to immediately substitute a ready-made expression (this comment mainly concerns the "count" function, which can be eliminated after such a change).
3. It's better to display numerical values in a specific format so that their presentation is independent of the settings in Home => Settings => Number Format. Currently, when someone changes the format to "Fixed," the counters become less readable because decimal places appear. Therefore, it's a good idea to use a conversion instruction to STRING with formatting.
4. For the default cell size (currently 12), there's something wrong with the position of the counters; they are partially cut off at the bottom. I haven't fixed that. However, wouldn't it be better to always show them in the lower corners in the same place regardless of the cell size?

I've attached the version with my minor fixes.

Best regards,
Piotr


Attached File(s)
.txt  game_of_life_random_init_slighty_optimized.txt (Size: 1.97 KB / Downloads: 23)

Piotr Kowalewski
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Conway's game of life with random initial cells - komame - 09-16-2023 04:25 PM



User(s) browsing this thread: 1 Guest(s)