Question: For the following question I made this code in python but it is not displaying the way it needs to be displayed: Can you please

For the following question I made this code in python but it is not displaying the way it needs to be displayed:

Can you please fix any problems in the code thank you.

row1 = [0]*20 row2 = [0]*20 row3 = [0]*20 row4 = [0]*20 row5 = [0]*20 row6 = [0]*20 row7 = [0]*20 row8 = [0]*20 row9 = [0]*20 row10 = [0]*20 row11 = [0]*20 row12 = [0]*20 row13 = [0]*20 row14 = [0]*20 row15 = [0]*20 row16 = [0]*20 row17 = [0]*20 row18 = [0]*20 row19 = [0]*20 row20 = [0]*20 board = [row1, row2, row3, row4, row5, row6, row7, row8, row9, row10, row11, row12, row13, row14, row15, row16, row17, row18, row19, row20] coordinates = input("Enter the initial live cell's coordinates (X Y), grid starts at (1,1): ").split() x, y = int(coordinates[0]) - 1, int(coordinates[1]) - 1 board[y][x] = "X" board[y][x+1] = "X" board[y][x-1] = "X" def printBoard(new_board): flag = True while flag == True: count2 = 0 for i in new_board: for j in range(20): print(i[j], end = " ") if j == 19: print(" ") for i in range(20): if "X" not in new_board[i]: count2 += 1 for j in range(20): i_var = i j_var = j if new_board[i_var][j_var] == "X": count = 0 if i_var > 0 and j_var > 0 and new_board[i_var-1][j_var-1] == "X": count += 1 if i_var > 0 and new_board[i_var-1][j_var] == "X": count += 1 if i_var  0 and new_board[i_var][j_var-1] == "X": count += 1 if j_var  0 and new_board[i_var+1][j_var-1] == "X": count += 1 if i_var  0 and j_var > 0 and new_board[i_var-1][j_var-1] == "X": count += 1 if i_var > 0 and new_board[i_var-1][j_var] == "X": count += 1 if i_var  0 and new_board[i_var][j_var-1] == "X": count += 1 if j_var  0 and new_board[i_var+1][j_var-1] == "X": count += 1 if i_var  

For the following question I made this code in python but it

The Game of Life was devised by mathematician John Conway in 1970. It models a very simple world. The Life world is a two-dimensional plane of cells. Each cell may be empty or contain a single creature. Each day, creatures are born or die in each cell according to the number of neighboring creatures on the previous day. A neighbor is a cell that adjoins the cell either horizontally, vertically, or diagonally. The rules in pseudocode style are: if (the cell is alive on the previous day) \{ if (the number of neighbors was 2 or 3 ) \{ the cell remains alive \} else \{ the cell dies \} } else if (the cell is not alive on the previous day) \{ if (the number of neighbors was exactly 3 ) \{ the cell becomes alive t else \{ the cell remains dead For example, the world displayed as: 0000000000 0000000000 000XXX0000 0000000000 0000000000 0000000000 where X's indicate living cells, becomes: 000000000000000000000000000000000000000000000000000000000 Create a Life application that has a 2020 grid. To initialize the grid, the application should prompt the user for the coordinates of live cells on the first day. The application should then generate each day's world as long as the user wishes to continue or until there are no more live cells

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!