ye um its called the game of life its like noughts and crosses but their all zeros in a grid and we have to make it so that some of them turn into ones, but they can only change into a one if there is a one above below or either side of it
i am sooo gratefull of all your help guys seriouslylet me know if theres anything i can help you out with x
This isn't a very accurate description of the rules. You have a large number of cells arranged in a grid. Each cell has a state of 1 or 0, and eight neighbors (horizontal, vertical, and diagonal). For each "step", all the cells update their state based on the state of their neighbors: 3 cells = 1 -> state changes to 1. 2 cells = 1 -> state does not change. Otherwise, state changes to 0.
yeah sorry this is what ive got so far,Code:import random board = [[0,0,0], [0,0,0], [0,0,0]] count=1 def board_printer (b): for count in range (0,3): print(b[count]) print() while count != 10: r=random.randint (0,2) c=random.randint (0,2) if board [r][c]==0: board[r][c] = 1 count=count+1 board_printer(board)
however i need to make it so that the noughts can only change to ones if there is a one, above, below or to the right or left of it
Have it check for one above it, below it, etc. in an update function then. And WingedPanther is right, life isn't really like naughts and crosses, it's a cellular automata
yeah im aware of that thanks its just i wasnt sure how to explain it also thats what our lecturer called it, thought you would recognise it more by saying it was similar to the game of life, well thats what ive been told that it is called.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks