Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Testing {
- public static void main(String[] args) {
- Cell[][] world = new Cell[20][20];
- loadInitialPopulation();
- printGeneration();
- }
- private static void loadInitialPopulation(Cell[][] world) {
- File file = new File(pathname: "Life100.txt");
- // set up array
- for (int r = 0; r < world.length; r++)
- for (int c = 0; c < world[r].length; c++)
- world[r][c] = new Cell();
- // load file
- try {
- Scanner scan = new Scanner(file);
- while (scan.hasNextLine()) {
- int row = scan.nextInt();
- int col = scan.nextInt();
- world[row - 1][col - 1].birth();
- }
- scan.close();
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- }
- }
- // go through the array and where there's an alive cell you print a star
- private static void printGeneration() {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement