Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package antfarm;
- import java.awt.Dimension;
- import javax.swing.JFrame;
- import java.lang.Thread;
- import java.util.logging.Level;
- import java.util.logging.Logger;
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- /**
- *
- * @author Few
- */
- public class Simulation {
- /**
- * @param args the command line arguments
- */
- JFrame window = new JFrame("AntFarm");
- AntFarm antfarm;
- public Simulation(){
- this.window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- this.window.setMinimumSize(new Dimension(320,240));
- this.antfarm = new AntFarm();
- this.window.getContentPane().add(this.antfarm);
- this.window.pack();
- this.window.setVisible(true);
- }
- public void run(){
- while(true){
- this.antfarm.evolve();
- try {
- Thread.sleep(100);
- } catch (InterruptedException ex) {
- Logger.getLogger(Simulation.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
- }
- public static void main(String[] args) {
- // TODO code application logic here
- Simulation AntFarm = new Simulation();
- AntFarm.run();
- }
- }
Add Comment
Please, Sign In to add comment