Guest User

Untitled

a guest
May 23rd, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. package antfarm;
  2. import java.awt.Dimension;
  3. import javax.swing.JFrame;
  4. import java.lang.Thread;
  5. import java.util.logging.Level;
  6. import java.util.logging.Logger;
  7.  
  8. /*
  9. * To change this template, choose Tools | Templates
  10. * and open the template in the editor.
  11. */
  12.  
  13. /**
  14. *
  15. * @author Few
  16. */
  17. public class Simulation {
  18.  
  19. /**
  20. * @param args the command line arguments
  21. */
  22. JFrame window = new JFrame("AntFarm");
  23. AntFarm antfarm;
  24.  
  25.  
  26. public Simulation(){
  27.  
  28. this.window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  29. this.window.setMinimumSize(new Dimension(320,240));
  30.  
  31. this.antfarm = new AntFarm();
  32. this.window.getContentPane().add(this.antfarm);
  33.  
  34. this.window.pack();
  35. this.window.setVisible(true);
  36.  
  37.  
  38.  
  39. }
  40. public void run(){
  41.  
  42. while(true){
  43. this.antfarm.evolve();
  44. try {
  45. Thread.sleep(100);
  46. } catch (InterruptedException ex) {
  47. Logger.getLogger(Simulation.class.getName()).log(Level.SEVERE, null, ex);
  48. }
  49. }
  50. }
  51.  
  52. public static void main(String[] args) {
  53. // TODO code application logic here
  54. Simulation AntFarm = new Simulation();
  55. AntFarm.run();
  56.  
  57. }
  58.  
  59.  
  60.  
  61. }
Add Comment
Please, Sign In to add comment