Game of Life discussion

Code structure: function code is divided into four main.py, life_game.py, game_timer.py, game_map.py, the program first initializes the main function map length, width, and a random number, call LifeGame game_map.py class file, map initialization, call again rESET, reset points of the map 100 in accordance with the random number, call prin_map () to print the map, call game_cycle acquired number of viable cells surrounding each point, and this point is reset, and finally call game_timer.py file GameTimer classes refresh time interval according to timer_interval time.

 

Pros: four file structure clear, logical and reasonable, rational variable naming, code readability strong, accurate annotation in place, each method has its beginning on the data that comes to check to see whether the method requires time, which is I think a very important point, can improve the robustness of the code.

Further improvements: get a point around the point in GameMap information is used to generate a list of locations, this list information by eight points around the traverse is calculated, I think this could be improved a bit, concrete improvement methods not want to come out.

Guess you like

Origin www.cnblogs.com/dbefb/p/12484323.html