sekkurocode / Cellular-Automata

Development of a python software, simulating "Cellular Automata".
MIT License
1 stars 0 forks source link

GUI: Connect Kivy window and game of life code. #20

Closed sekkurocode closed 5 months ago

sekkurocode commented 5 months ago

See how to connect our Cellular Automata with our Kivy GUI Window.

fabrice-eberle commented 5 months ago

I merged now and will work on the integration :-)

fabrice-eberle commented 5 months ago

First I went into the game of life.py and deleted the unused classes Player and Board. I migrated the game class to kivy.app by setting the rows and cols to grid size parameter (50) [Maybe we can create a slider or input to customize the size and make it adjustable]. Inside the class there is the function update_board wich sets the board to anew state by counting neighbors and depending on the ruleset, setting a new value for the next generation first on a temporary, then on the final board. The class Game instancinates within the GUI [Lets move it out of there?] in the init method. The update_board method of it is called within a new function inside the gui class, called "def update". While running it first updates the board and than calls the new function "update_grid", wich sets the colors of all cells depending on their new status (alive or dead) by calling the "update_color" function of the Cell class. They get their status by looking at itselfs updated board state [Might lead to slow runtimes further down the line?] New issues that will be created:

24: Improve the comments and translate them (sorry I didn´t find time to write proper ones)

25: Creating A Button or Slider or any form of User Interaction to set the rules within the Gui Window

26: Check if we can seperate the Gui and the rest into different files