Explore BrainMass

Explore BrainMass

    Object Oriented Program in JAVA to play Game of Life

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    Consider a rectangular matrix of cells, each of which may contain an organism. If the matrix is viewed as extending indefinitely in both directions, then each cell has eight neighbors, the eight cells surrounding it. In each generations births and deaths occur according to following rules:
    1. An organism is born in any empty cell having exactly 3 neighbors ( cells with organisms in them).
    2. An organism dies from isolation if it has fewer than two neighbors.
    3 An organism dies from overcrowding if it has more than 3 neighbors.
    4. All other organisms survive.

    Write an object oriented program in Java to play the Game of Life and investigate the patterns produced by various initial configurations. Some configurations die off rather rapidly; others repeat after a certain number of generations; others change shape and size and may move across the matrix; and still others may produce "gliders" that detach themselves from the society and sail off into space.

    Please provide an algorithm as well as source code.

    © BrainMass Inc. brainmass.com October 10, 2019, 2:54 am ad1c9bdddf

    Solution Preview

    Attached are the following three redundant attachments (redundant just in case you need it in a certain way for build and run purposes in your environment).

    1. gameoflifesimulation.zip
    Note: Includes "package gameoflifesimulation;" declaration at the top of the three classes.

    2. gameoflifesimulation_without_package_declaration.zip
    Same thing as above with the package declarations removed. Some students prefer it this way ...

    Solution Summary

    Objects oriented programs in JAVA to play the Game of Life is determined.