public void draw() { background(0); environment.run(); environment.update(false); pheromones.fade(0.99f); pheromones.render(2, 50, 1, this); // canvas.drawTrails(environment.pop, 1, 255); }
public void addParticles() { for (int i = 0; i < 100; i++) { environment.addAgent( new VoxParticle( new Vec3D(random(numX * 2), random(numY * 2), random(numZ * 2)), false, pheromones)); } }
private Properties getProperties() throws IOException { Properties p; File f; if ((f = Environment.getPropertiesFile(FManager.class)).exists()) { try (InputStream is = new FileInputStream(f)) { p = new Properties(); p.load(is); is.close(); } } else { throw new IOException("Cannot load properties."); } return p; }
public void saveSettings(Map<String, String> keyValMap, boolean autoLoad) throws IOException { Properties p; File f; if ((f = Environment.getPropertiesFile(FManager.class)).exists()) { this.activeFingerprintFileMap.clear(); try (InputStream is = new FileInputStream(f)) { p = new Properties(); // p.load(is); keyValMap .entrySet() .stream() .forEach( pair -> { p.setProperty(pair.getKey(), pair.getValue()); this.activeFingerprintFileMap.put( new File(pair.getKey()), Boolean.valueOf(pair.getValue())); }); p.setProperty(AUTOLOAD, autoLoad + ""); // is.close(); FileOutputStream fos = new FileOutputStream(f); p.store( fos, "Updated " + DateFormatUtils.format( System.currentTimeMillis(), ISO_EXTENDED_FORMAT_PATTERN, Locale.ENGLISH)); try { fos.close(); } catch (Exception ex) { } } } else { throw new IOException("Cannot store properties."); } }
public static void saveSetting(String key, String val) throws IOException { Properties p; File f; if ((f = Environment.getPropertiesFile(FManager.class)).exists()) { try (InputStream is = new FileInputStream(f)) { p = new Properties(); p.load(is); p.setProperty(key, val); is.close(); FileOutputStream fos = new FileOutputStream(f); p.store( fos, "Updated " + DateFormatUtils.format( System.currentTimeMillis(), ISO_EXTENDED_FORMAT_PATTERN, Locale.ENGLISH)); try { fos.close(); } catch (Exception ex) { } } } else { throw new IOException("Cannot store properties."); } }