<commit_before>package game_engine.stateManaging;

import game_engine.computers.Computer;
import game_engine.computers.boundsComputers.CollisionComputer;
import game_engine.computers.boundsComputers.VisionComputer;
import game_engine.gameRepresentation.DrawableGameElement;
import game_engine.gameRepresentation.GameElement;
import game_engine.gameRepresentation.Level;
import game_engine.gameRepresentation.SelectableGameElement;
import java.util.ArrayList;
import java.util.List;
import javafx.animation.KeyFrame;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.util.Duration;


public class GameLoop {

    private Level myCurrentLevel;
    private List<SelectableGameElement> myActiveElements = new ArrayList<SelectableGameElement>();
    private List<Computer> myComputerList = new ArrayList<Computer>();

    public GameLoop (Level level) {
        myCurrentLevel = level;
        // myAllElements.addAll(myCurrentLevel.getUnits());
        // myAllElements.addAll(myCurrentLevel.getGoal());
        // myAllElements.addAll(myCurrentLevel.getTerrain());
        myComputerList.add(new CollisionComputer());
        myComputerList.add(new VisionComputer());
    }

    private EventHandler<ActionEvent> oneFrame = new EventHandler<ActionEvent>() {
        @Override
        public void handle (ActionEvent evt) {
            update();
        }
    };

    private void filterObjects () {

    }

    public void init () {

    }

    /**
     * Create the game's frame
     */
    public KeyFrame start (Double frameRate) {
        return new KeyFrame(Duration.millis(1000 / 60), oneFrame);
    }

    public void update () {
        List<DrawableGameElement> allElements = new ArrayList<DrawableGameElement>();
        allElements.addAll(myCurrentLevel.getUnits());
        allElements.addAll(myCurrentLevel.getTerrain());
        for (SelectableGameElement selectableElement : myActiveElements) {
            for (Computer<SelectableGameElement, DrawableGameElement> c : myComputerList) {
                c.compute(selectableElement, allElements);
            }
        }
    }
}<commit_msg>added more shit<commit_after>package game_engine.stateManaging;

import game_engine.computers.Computer;
import game_engine.computers.boundsComputers.CollisionComputer;
import game_engine.computers.boundsComputers.VisionComputer;
import game_engine.gameRepresentation.DrawableGameElement;
import game_engine.gameRepresentation.GameElement;
import game_engine.gameRepresentation.Level;
import game_engine.gameRepresentation.SelectableGameElement;
import java.util.ArrayList;
import java.util.List;
import javafx.animation.KeyFrame;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.util.Duration;


public class GameLoop {

    private Level myCurrentLevel;
    private List<SelectableGameElement> myActiveElements = new ArrayList<SelectableGameElement>();
    private List<Computer> myComputerList = new ArrayList<Computer>();

    public GameLoop (Level level) {
        myCurrentLevel = level;
        myComputerList.add(new CollisionComputer());
        myComputerList.add(new VisionComputer());
    }

    private EventHandler<ActionEvent> oneFrame = new EventHandler<ActionEvent>() {
        @Override
        public void handle (ActionEvent evt) {
            update();
        }
    };

    private void filterObjects () {

    }

    public void init () {

    }

    /**
     * Create the game's frame
     */
    public KeyFrame start (Double frameRate) {
        return new KeyFrame(Duration.millis(1000 / 60), oneFrame);
    }

    public void update () {
        List<DrawableGameElement> allElements = new ArrayList<DrawableGameElement>();
        allElements.addAll(myCurrentLevel.getUnits());
        allElements.addAll(myCurrentLevel.getTerrain());
        for (SelectableGameElement selectableElement : myActiveElements) {
            for (Computer<SelectableGameElement, DrawableGameElement> c : myComputerList) {
                c.compute(selectableElement, allElements);
            }
        }
        
        for (SelectableGameElement selectableElement : myActiveElements) { 
            selectableElement.update();
        }
    }
}
{'fraction_non_alphanumeric': 0.09004739336492891, 'fraction_numerical': 0.002843601895734597, 'mean_word_length': 3.5980392156862746, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, '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': '2263016', 'n_tokens_mistral': 1156, 'n_tokens_neox': 1105, 'n_words': 222}