Optimize game of life implementation to bitwise operations to achieve 450-500 fps for a glider gun, use int instead of math.ceil for positions and fix generation fps reset after file manager

This commit is contained in:
csd4ni3l
2025-06-23 18:56:44 +02:00
parent 6532d18c91
commit c44dde3297
4 changed files with 101 additions and 52 deletions

View File

@@ -7,7 +7,7 @@ COLS = 80
ROWS = 60
CELL_SIZE = 10
SPACING = 2
NEIGHBORS = [(-1, 0), (-1, 1), (-1, -1),(0, 0), (0, 1), (0, -1), (1, 0), (1, 1), (1, -1)]
NEIGHBORS = [(-1, 0), (-1, 1), (-1, -1), (0, 1), (0, -1), (1, 0), (1, 1), (1, -1)]
discord_presence_id = 1363780625928028200
log_dir = 'logs'

View File

@@ -1,4 +1,5 @@
import arcade.gui, arcade
from game.game_of_life import precompute_neighbor_masks
button_texture = arcade.gui.NinePatchTexture(64 // 4, 64 // 4, 64 // 4, 64 // 4, arcade.load_texture("assets/graphics/button.png"))
button_hovered_texture = arcade.gui.NinePatchTexture(64 // 4, 64 // 4, 64 // 4, 64 // 4, arcade.load_texture("assets/graphics/button_hovered.png"))
@@ -6,3 +7,5 @@ button_hovered_texture = arcade.gui.NinePatchTexture(64 // 4, 64 // 4, 64 // 4,
create_sound = arcade.Sound("assets/sound/create.mp3")
destroy_sound = arcade.Sound("assets/sound/destroy.mp3")
theme_sound = arcade.Sound("assets/sound/music.mp3")
NEIGHBOUR_MASKS = precompute_neighbor_masks()