Coways Game of life is a very famous cellula automaton, created by John Conway.
In this video, I implement it in C++ and SFML.
Silver Star – Traffic
Doom Original – Level 3
Support me on Patreon:
Follow me on Twitter:
Follow me on Twich:
Subscribe to the subreddit:
hello and welcome to a video in this video on our interior which is probably the most famous cellular automaton of all time Conway's Game of Life it's a simulation of the set rules and these rules are as follows so the weld is made out of a grid of cells each cell the simulation is leave her alive represented by a black cell or dead represented by an empty cell in each step of the simulation each of the leading cells and chest hits surrounding neighbors depending on how many living cells are surrounding it bumping one happened to the cell that was checking the neighbors if there is less than two living cells then the cell will die due to under population if there is either T or free surrounding living cells then the server will live on to the next generation and lastly if there is free or more living cells surrounding it then the cell will die due to overpopulation so that is what the living cells do however the dead cells will also count their neighbors and there is only one rule for this if there's exactly free living mavis surrounding the dead cell than the dead cell will turn into a living cell due to a reproduction and that's pretty much it so let's get into creating this now so like collimated the predator and prey simulation the first thing but I want to do here is to get some kind of representation of the cells drawn onto the window when I made the predator and prey simulation I made it a one pixel equal to one cell however this has some problems because sometimes it was a bit hard to see what was going on so if it Conway's Game of Life I've decided to make it so that one cord equals one cell which means a lower resolution which would make it a lot easier to see what was going on for testing I've made it so that each cell just have a random shade of gray for now and this is what it looks like as you can see each of the cells is a lot larger which is going to make it a lot easier to see what is going on and now that I have a drawable representation of the cells it was no time to implement the rules the four rules can actually be implemented I needed to have some kind of representation of whether these cells were alive or dead and for this I simply just went with an enum class which has two types alive all dead the obvious option would have been to go with boolean values but I decided not do that that would have decreased the readability in the code for now for testing purposes I'm just going to make every cell either randomly alive or dead which is going to make from either black or white and this is what it looks like and so now that I did draw a representation of the cells as well as a representation of the you know the cells themselves over there dead or alive it was no time to actually implement the rules for real this time this is simply being done by using a fee for loops through our loop through all the cells and count the alive neighbors surrounding them and then using a few different switch statements I apply the rules that I describe the style of the video to the cell currently being checked and here is the result and as you can see it's pretty terrible something must be going on because all of the cells are basically dying out instantly so I decided that rather than going to the random start point I would instead go for a manual start point this simply means that the class sort of chooses walks cells were alive and desert star unimpressive space far to actually begin simulation you can see me here turning the dead cells into a live cells and one attempting to do is to create something known as a Costigan a ghost of the gun is simply an aberration of cells so as you tell these things colliders where gliders are a group of living cells with just move intimately in n direction and this can be seen in action right here where you can see the gliders moving from the gospel gun down to the bottom right of the simulation now while creating this input thing I've realized I actually as a major logic error in the code and when I realized this Eamonn I could go back to the random arrangement at the start and as you can see it just works absolutely perfectly you can see lots of gliders and other things just moving around the window infinitely so yeah that's pretty much sure that it's Conway's Game of Life I would now like to take a moment to thank my super patreon supporters so yeah Thank You Stanley Morris synthetic Timothy Gibbons and alchemy ik so anyways once again thank you for watching enjoy the rest of the simulation and goodbye