We are about to switch to a new forum software. Until then we have removed the registration on this forum.
While Using the game of life program of the series " nature of code " by daniel shiffman, I want to fill the board with input values given by me in run time of the program instead of using a random function as it has been done in the GOL program. when I tried getting input for board using normal java method I'm not able to fill the board in run time, so please suggest a solution for my problem.
Answers
you could load a table with the initial configuration of the grid.
this is not really runtime... but still...
you could also let the user edit the grid as he wants, and then he clicks a button start, the state of the program changes and GOL starts...
You can use JOptionPane's showInputDialog() in setup():
http://docs.Oracle.com/javase/8/docs/api/javax/swing/JOptionPane.html
And if you wanna deploy it to the web, you can use the wrapper class I did for JS' prompt():
http://forum.Processing.org/two/discussion/12532/windowjs-cross-mode-alert-confirm-prompt-other-js-api-for-java
https://developer.Mozilla.org/en-US/docs/Web/API/Window/prompt