![]() ![]() # load_design("hertz-oscillator.in", create_blank_grid()) ![]() This is homework and it is due very, very soon, so any help would be appreciated Armaan! Thanks! I really appreciate it! I hope to keep in touch and finish this ASAP, as I will be available 24/7 this week, and it is due on and I can make the grid update once, but after that, it doesn’t change (just prints the 2nd gen over and over again, and it doesn’t go on to 3rd gen). The problem with this is that it just runs, but it doesn’t advance the whole grid one generation, it just keeps the same grid. If grid = dead_cell and num_living_neighbors(row, col, grid) = 3:Īdv_grid_one_gen(load_design("f-pentomino.in", create_blank_grid())) If grid = living_cell and num_living_neighbors(row, col, grid) 3: If (((col + 1) = 0) and grid = living_cell: # square just has coordinates in it like "12 35" on each lineĭef num_living_neighbors(row, col, grid): # load_design("square.in", create_blank_grid()) So far, this is my function 4 (all others are done): living_cell = "O" ![]() I have been working on this project for some time now, and I am on function 4, the one that iterates a whole grid one generation forward. Question: I have absolutely no idea on where to start with function 4, (by the way, functions 5 and 6 are helpers to function 4.) is there any starting point you could give me with this along with a little code to begin the 4th function? I guess really, what I am asking is help to start 5 and 6 since they are parts of function 4. If you can just attempt to answer it, I would appreciate it very much. Please bear this because I know I am probably violating some rules. I showed you this code because I have a question right now. # load_design("square.in", create_blank_grid()) # this file has this: Here is most of my own code: living_cell = "O" I already have the following code and questions: If anyone could implement this for me I would be very, very grateful. Return: the number of living neighbors of the cell Return: whether the cell is alive or not (True or False)įunction 6: determine the number of living neighbors of a cell Return: a new grid advanced by one generationįunction 5: advance a cell one generation Here are the rules: Wikipedia Linkįirst, I have separated the game into six (6) functions to organize my code and make it easier for me to implement.įunction 4: advance a grid one generation Can anyone help me implement Conway’s Game of Life in Python? Just to clarify, this is homework, although I believe I am not violating the rules because I am not asking for answers, just help on certain sections. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |