Write a program called Life.java that simulates the Game of Life.

The user must be able to provide these 3 things, in this order, and as arguments when executing the program from Console:

  • The number of iterations (any integer)
  • the size of the square grid (any integer)
  • which pattern type to initialize the cells with:
    • Random (enter R)
    • Lightweight spaceship (enter L)
    • Pulsar (enter P)

Do not ask the user to enter the arguments after the program has begun execution, and do not ask for them in the graphical display. It's important that you learn how tow write programs that accept command line arguments - look at the Code and Demos to see how to do that.

Here are the layouts for the lightweight spaceship and pulsar patterns respectively: see image.

And here's how they should behave when the program runs: see image.

The program will use a graphical display to show the iterations. There should be sufficient delay between each iteration for the user to be able to see what's happening (not too fast, not too slow!), and the user should be able to see the individual cells (don't draw them too small).

The grid should wrap around.

Example run command in Console: java Life 500 100 R will run Life for 500 iterations with a grid size of 100 x 100, beginning with a random initial pattern of cells.

Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.