<commit_before>package com.garbagecollector.screens.game;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.utils.TimeUtils;
import com.badlogic.gdx.utils.viewport.ScreenViewport;
import com.garbagecollector.EcoGarbageCollector;
import com.garbagecollector.GarbageCollector;
import com.garbagecollector.garbage.GarbageActor;
import com.garbagecollector.garbage.GarbageType;

import java.util.ArrayList;
import java.util.List;

/**
 * @author <NAME>
 */
public class GameScreen implements Screen {

    public static final int SPAWN_RATE = 3000;
    final EcoGarbageCollector game;

    private BackgroundActor backgroundActor;

    private Stage stage;
    private GarbageCollector collector;
    private long lastDropTime;

    public GameScreen(final EcoGarbageCollector game) {
        this.game = game;

        stage = new Stage(new ScreenViewport());
        Gdx.input.setInputProcessor(stage);
        initBackground();

        initBucket();
    }


    private void initBackground() {
        //adding background
        backgroundActor = new BackgroundActor();
        stage.addActor(backgroundActor);
    }

    private void initBucket() {
        //bucket
        collector = new GarbageCollector(GarbageType.PAPER);
        float density = Gdx.graphics.getDensity();
        collector.setSize(50f * density, 50f * density);
        collector.setX(Gdx.graphics.getWidth() / 2 - collector.getWidth() / 2);

        stage.addActor(collector);
    }

    @Override
    public void render(float delta) {
        Gdx.gl.glClearColor(1, 1, 1, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        if(TimeUtils.millis() - lastDropTime > SPAWN_RATE) {
            GarbageActor actor = new GarbageActor();
            stage.addActor(actor);
            actor.setPosition(MathUtils.random(0, stage.getWidth() - actor.getWidth()), stage.getHeight());
            lastDropTime = TimeUtils.millis();
        }
<commit_msg>Moved bucket to front of stage<commit_after>package com.garbagecollector.screens.game;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Screen;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.math.MathUtils;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.utils.TimeUtils;
import com.badlogic.gdx.utils.viewport.ScreenViewport;
import com.garbagecollector.EcoGarbageCollector;
import com.garbagecollector.GarbageCollector;
import com.garbagecollector.garbage.GarbageActor;
import com.garbagecollector.garbage.GarbageType;

import java.util.ArrayList;
import java.util.List;

/**
 * @author <NAME>
 */
public class GameScreen implements Screen {

    public static final int SPAWN_RATE = 3000;
    final EcoGarbageCollector game;

    private BackgroundActor backgroundActor;

    private Stage stage;
    private GarbageCollector collector;
    private long lastDropTime;

    public GameScreen(final EcoGarbageCollector game) {
        this.game = game;

        stage = new Stage(new ScreenViewport());
        Gdx.input.setInputProcessor(stage);
        initBackground();

        initBucket();
    }


    private void initBackground() {
        //adding background
        backgroundActor = new BackgroundActor();
        stage.addActor(backgroundActor);
    }

    private void initBucket() {
        //bucket
        collector = new GarbageCollector(GarbageType.PAPER);
        float density = Gdx.graphics.getDensity();
        collector.setSize(50f * density, 50f * density);
        collector.setX(Gdx.graphics.getWidth() / 2 - collector.getWidth() / 2);

        stage.addActor(collector);
    }

    @Override
    public void render(float delta) {
        Gdx.gl.glClearColor(1, 1, 1, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        if(TimeUtils.millis() - lastDropTime > SPAWN_RATE) {
            GarbageActor actor = new GarbageActor();
            stage.addActor(actor);
            actor.setPosition(MathUtils.random(0, stage.getWidth() - actor.getWidth()), stage.getHeight());
            lastDropTime = TimeUtils.millis();
            //moving collector to front
            stage.getRoot().swapActor(actor, collector);
        }

{'fraction_non_alphanumeric': 0.10381750465549348, 'fraction_numerical': 0.00931098696461825, 'mean_word_length': 3.155705996131528, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '3433015', 'n_tokens_mistral': 1371, 'n_tokens_neox': 1279, 'n_words': 253}