I am required to write a program based on Conway's Game of Life. Many of you probably know the rules but the ones that dont here are the rules:
1. Any live cell with fewer than two live neighbours dies, as if by loneliness.
2. Any live cell with more than three live neighbours dies, as if by overcrowding.
3. Any live cell with two or three live neighbours lives, unchanged, to the next generation.
4. Any dead cell with exactly three live neighbours comes to life.
I really dont have any problem writing the functions to do any of the 4 rules, my problem is much more basic than that.
I will be using a grid that is 25 by 25 to do this simulation. The program will ask the user for the number of randomly placed asterisks(*). The asterisks represent the live cells.
Here is the problem...I cannot for the love of me place them all randomly. I keep running into the problem where the same cell is being generated by the random number generator.
So my question is, what can I do so that if a user enters 70 for the number of cells, there will be exactly 70 on the grid.