10/19/2023 0 Comments Conways game of life self assemblyObviously various implementations will have different effects on the lifecycle of the cells in the grid.Ī helper function to create the actual grid.Įxport const nextSlide = ( board = Another possible implementation would be to have every cell at the end of the grid to be in the ‘dead’ state. I chose to design it such that that the cells that are off the edge of the grid wrap around to the far side. Nothing too complicated here, just decisions to be made on what components would be reused and what slices of state need to be managed globally.Īnother important consideration was what behavior I wanted from the cells when they got to the end of the grid. Since this implementation was created using React and Redux, what followed was architecting the Component and state structures. Obviously, there are a plethora of options when it comes to possible data structures, each with their pros and cons, but I chose to opt for arrays and objects because of how relatively easy they are to manipulate, and also the size of data I was working with. These values will be either 0 or 1 representing the two possible cell states, alive and dead. That is, 40 arrays each containing 40 values in an object. Here I chose to go with arrays in an object. The next and probably the most important decision was what data structure to use in designing the grid. I chose to build mine with a 40 by 40 grid for no reason other than the fact that 1600 sounds to me like a very respectable number. The specs for the minimum viable product given to us by Lambda School stated that the 2d grid could be any size above 25 by 25. One would assume that if a thing is governed by rules as clear and simple as this, there would be a way of predicting future outcomes, but it turns out there isn’t. Following the progress gives you no clue, regardless of whether you track the cells for a hundred or a billion moves. If there is a configuration on the grid and you follow it for a thousand moves and it doesn’t die off, it could die-off on the thousand and first move, or the billionth. There is no algorithmic way of telling if the configuration will last forever or fade away completely. Else, it remains dead.Īny number of different possible configurations can be used as the initial input, but one thing to note is that after a time, there might be nothing left on the grid, or as in some cases, the configuration lives forever. Else it dies.Įlse, if the cell is dead and has exactly 3 neighbors, then it comes to life. If the cell is alive and has 2 or 3 neighbors, then it remains alive. That is, the eight surrounding cells (up, down, left, right, and diagonals), and then acts on that result. For each cell, it counts the active neighbors. These patterns are formed by the individual cells responding to the rules of the game. These cells form various patterns as the grid evolves. It became very popular when it was mentioned in an article published by Scientific American in 1970.Īlso, the algorithm which the game is based on is Turing complete, which means that it is a system able to recognize or decide other data manipulation sets.įundamentally, Conway’s game of life is a grid featuring a collection of cells which can live, die or multiply, depending on the initial input configurations. The game was invented by Cambridge mathematician, John Horton Conway. However, we were required to work solo this time due to the scope of the project.Ĭonway’s game of life is a zero player game which means its evolution is determined by its initial input and no further interaction is required. Usually, build weeks in Lambda school would be in teams of about five to six students from different cohorts forming some sort of Voltron to constitute a product team. All there is to do is apply all the knowledge garnered in the previous three weeks learning algorithms and Data Structures to build an implementation of Conway’s game of life. What it is, in a nutshell, is a week without lectures, coding challenges, or instructions. We just completed Build Week at Lambda school.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |