<commit_before>package com.beariksonstudios.existence;

import javafx.application.Platform;
import javafx.event.Event;
import javafx.event.EventHandler;
import javafx.event.EventType;
import javafx.scene.Scene;
import javafx.scene.canvas.Canvas;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.StackPane;

import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.stage.Stage;

import java.util.Timer;
import java.util.TimerTask;

/**
 * Created by Neal on 7/3/2015.
 */
public class Game extends Scene {
    public static long fps = 30; // 30fps
    private Canvas canvas;
    private Label population;
    private Label resource;
    private double popNumber;
    private double startTime = System.currentTimeMillis();
    private double time;


    public Game(StackPane root) {
        super(root);
        double initialPopulation = 1000;
        double rate = 1;
        time = System.currentTimeMillis() - startTime;
        popNumber = Math.pow(initialPopulation * Math.E, rate * time);
        Stage stage = Existence.fetch().getStage();

        canvas = new Canvas(stage.getWidth(),stage.getHeight());
        root.getChildren().add(canvas);
        root.getChildren().add(createUI());

        startRenderTimer();
    }

    public BorderPane createUI() {
        BorderPane pane = new BorderPane();
        pane.setBottom(createBottomPane());

        return pane;
    }

    private VBox createBottomPane() {
        VBox labelVBox = new VBox();
        labelVBox.setStyle("-fx-background-color: gainsboro;");

        population = new Label("Population: " + popNumber);
        resource = new Label("Resource: Crocodiles");

        labelVBox.getChildren().addAll(population, resource);

        return labelVBox;
    }

    private void startRenderTimer() {
        final Timer renderTimer = new Timer("RenderTimer");
        renderTimer.scheduleAtFixedRate(new TimerTask() {
            @Override
            public void run() {
                Platform.runLater(new Runnable() {
                    @Override
                    public void run() {
                        render(canvas.getGraphicsContext2D());
                    }
                });
            }
        }, 0l, 1000l / fps);
    }

    public void render(GraphicsContext gc){
        gc.setFill(Color.GREEN);
        gc.fillRect(0, 0, canvas.getWidth(), canvas.getHeight());
        time = System.currentTimeMillis() - startTime;
        this.updateUI();
    }
    public void updateUI(){
        population.setText("Population: " + Double.toString(popNumber));
    }
}<commit_msg>fixed math on pop update<commit_after>package com.beariksonstudios.existence;

import javafx.application.Platform;
import javafx.event.Event;
import javafx.event.EventHandler;
import javafx.event.EventType;
import javafx.scene.Scene;
import javafx.scene.canvas.Canvas;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.StackPane;

import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.stage.Stage;

import java.util.Timer;
import java.util.TimerTask;

/**
 * Created by Neal on 7/3/2015.
 */
public class Game extends Scene {
    public static long fps = 30; // 30fps
    private Canvas canvas;
    private Label population;
    private Label resource;
    private double popNumber;
    private double startTime = System.currentTimeMillis();
    private double time;
    private double initialPopulation;
    private double rate;


    public Game(StackPane root) {
        super(root);
        initialPopulation = 1000;
        rate = .015;
        time = (System.currentTimeMillis() - startTime)/1000;
        popNumber = Math.pow((initialPopulation * Math.E), (rate * time));
        Stage stage = Existence.fetch().getStage();

        canvas = new Canvas(stage.getWidth(),stage.getHeight());
        root.getChildren().add(canvas);
        root.getChildren().add(createUI());

        startRenderTimer();
    }

    public BorderPane createUI() {
        BorderPane pane = new BorderPane();
        pane.setBottom(createBottomPane());

        return pane;
    }

    private VBox createBottomPane() {
        VBox labelVBox = new VBox();
        labelVBox.setStyle("-fx-background-color: gainsboro;");

        population = new Label("Population: " + popNumber);
        resource = new Label("Resource: Crocodiles");

        labelVBox.getChildren().addAll(population, resource);

        return labelVBox;
    }

    private void startRenderTimer() {
        final Timer renderTimer = new Timer("RenderTimer");
        renderTimer.scheduleAtFixedRate(new TimerTask() {
            @Override
            public void run() {
                Platform.runLater(new Runnable() {
                    @Override
                    public void run() {
                        render(canvas.getGraphicsContext2D());
                    }
                });
            }
        }, 0l, 1000l / fps);
    }

    public void render(GraphicsContext gc){
        gc.setFill(Color.GREEN);
        gc.fillRect(0, 0, canvas.getWidth(), canvas.getHeight());
        time = (System.currentTimeMillis() - startTime)/1000;
        popNumber = (initialPopulation + Math.pow((initialPopulation * Math.E), (rate * time)));
        this.updateUI();
    }
    public void updateUI(){
        popNumber = Math.round(popNumber);
        population.setText("Population: " + popNumber);
    }
}
{'fraction_non_alphanumeric': 0.11178932682246251, 'fraction_numerical': 0.009766306243460064, 'mean_word_length': 2.627450980392157, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2969809', 'n_tokens_mistral': 1675, 'n_tokens_neox': 1559, 'n_words': 358}