<commit_before>package org.egordorichev.lasttry.util;

import com.badlogic.gdx.Gdx;
import org.egordorichev.lasttry.LastTry;
import org.egordorichev.lasttry.graphics.Assets;
import org.egordorichev.lasttry.world.spawn.SpawnSystem;

import java.lang.reflect.Array;
import java.util.*;

public class Debug {
    private boolean enabled;
    private int uniqueCounter;
    //LinkedHashMap guarantees insertion order of elements, is kept.
    private Map<Integer, GenericContainer.UniqueTypePair> messagesToBePrinted = new LinkedHashMap<>();
    public Debug() {
        this.enabled = false;
    }

    public void render() {
        if (!this.enabled) {
            return;
        }

	    Assets.f22.draw(LastTry.batch, String.valueOf(Gdx.graphics.getFramesPerSecond()), 10, 30);
	    Assets.f22.draw(LastTry.batch, "X: " + String.format("%d", LastTry.player.physics.getGridX())
            + " Y: " + String.format("%d", LastTry.player.physics.getGridY()), 40, 30);
	    Assets.f22.draw(LastTry.batch, "Spawn weight of active enemies: "+LastTry.spawnSystem.getSpawnWeightOfCurrentlyActiveEnemies(), 10, 50);
	    Assets.f22.draw(LastTry.batch, "Remaining spawn weight of biome: "+LastTry.spawnSystem.getRemainingSpawnWeightOfBiome(), 10, 70);
	    Assets.f22.draw(LastTry.batch, "Enemies in active area: "+LastTry.spawnSystem.getEnemiesInActiveAreaCount(), 10, 90);
	    //TODO Heavy call, should be rethought and removed
	    Assets.f22.draw(LastTry.batch, "Total amount of enemies: "+LastTry.entityManager.retrieveEnemyEntities().size(), 10, 110);


	    if(messagesToBePrinted.keySet().size()==0){
	        return;
        }

        //Iterators are positions before the first element.
        //A linked hash map is used, therefore we can guarantee the insertion order data is kept
        int currentMessageKey = messagesToBePrinted.keySet().iterator().next();

	    //Pair containing the String message and the amount of ticks the message should be displayed for.
        GenericContainer.UniqueTypePair<String, Integer> currentMessagePair = messagesToBePrinted.get(currentMessageKey);

        String message = currentMessagePair.getValue1();
        int gameTicksCounter = currentMessagePair.getValue2();

        //If game ticks counter equals 0, means no more ticks should be allocated to rendering the message
        if(gameTicksCounter==0){
            messagesToBePrinted.remove(currentMessageKey);
            return;
        }

        Assets.f22.draw(LastTry.batch, message, 10, 130);

        //Decrement counter as it has been displayed for 1 tick
        gameTicksCounter--;

        //Update the pair with the new game ticks counter.
        currentMessagePair.setValue2(gameTicksCounter);

    }

    public void enable() {
        this.enabled = true;
    }

    public void disable() {<commit_msg>Added time, max spawns & current biome to debug menu<commit_after>package org.egordorichev.lasttry.util;

import com.badlogic.gdx.Gdx;
import org.egordorichev.lasttry.LastTry;
import org.egordorichev.lasttry.graphics.Assets;
import org.egordorichev.lasttry.world.spawn.SpawnSystem;

import java.lang.reflect.Array;
import java.util.*;

public class Debug {
    private boolean enabled;
    private int uniqueCounter;
    //LinkedHashMap guarantees insertion order of elements, is kept.
    private Map<Integer, GenericContainer.UniqueTypePair> messagesToBePrinted = new LinkedHashMap<>();
    public Debug() {
        this.enabled = false;
    }

    public void render() {
        if (!this.enabled) {
            return;
        }

	    Assets.f22.draw(LastTry.batch, String.valueOf(Gdx.graphics.getFramesPerSecond()), 10, 30);
	    Assets.f22.draw(LastTry.batch, "X: " + String.format("%d", LastTry.player.physics.getGridX())
            + " Y: " + String.format("%d", LastTry.player.physics.getGridY()), 40, 30);
	    Assets.f22.draw(LastTry.batch, "Spawn weight of active enemies: "+LastTry.spawnSystem.getSpawnWeightOfCurrentlyActiveEnemies(), 10, 50);
	    Assets.f22.draw(LastTry.batch, "Remaining spawn weight of biome: "+LastTry.spawnSystem.getRemainingSpawnWeightOfBiome(), 10, 70);
	    Assets.f22.draw(LastTry.batch, "Enemies in active area: "+LastTry.spawnSystem.getEnemiesInActiveAreaCount(), 10, 90);
	    //TODO Heavy call, should be rethought and removed
	    Assets.f22.draw(LastTry.batch, "Total amount of enemies: "+LastTry.entityManager.retrieveEnemyEntities().size(), 10, 110);
	    Assets.f22.draw(LastTry.batch, "Current Biome: "+LastTry.environment.currentBiome.getName(), 10, 130);
	    Assets.f22.draw(LastTry.batch, "Max spawns of current biome: "+LastTry.environment.currentBiome.get().getSpawnMax(), 10, 150);
	    Assets.f22.draw(LastTry.batch, "Current in world time: "+LastTry.environment.time.toString(true), 10, 170);


	    if(messagesToBePrinted.keySet().size()==0){
	        return;
        }

        //Iterators are positions before the first element.
        //A linked hash map is used, therefore we can guarantee the insertion order data is kept
        int currentMessageKey = messagesToBePrinted.keySet().iterator().next();

	    //Pair containing the String message and the amount of ticks the message should be displayed for.
        GenericContainer.UniqueTypePair<String, Integer> currentMessagePair = messagesToBePrinted.get(currentMessageKey);

        String message = currentMessagePair.getValue1();
        int gameTicksCounter = currentMessagePair.getValue2();

        //If game ticks counter equals 0, means no more ticks should be allocated to rendering the message
        if(gameTicksCounter==0){
            messagesToBePrinted.remove(currentMessageKey);
            return;
        }

        Assets.f22.draw(LastTry.batch, message, 10, 190);

        //Decrement counter as it has been displayed for 1 tick
        gameTicksCounter--;

        //Update the pair with the new game ticks counter.
        currentMessagePair.setValue2(gameTicksCounter);

    }

    public void enable() {
        this.enabled = true;
    }

    public void disable() {
{'fraction_non_alphanumeric': 0.10855154126615843, 'fraction_numerical': 0.020384487901889296, 'mean_word_length': 3.421245421245421, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '5706800', 'n_tokens_mistral': 1902, 'n_tokens_neox': 1743, 'n_words': 449}