<commit_before>package LS;

import javafx.scene.Group;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import java.util.ArrayList;
import java.util.Random;

public class FoodTree {
    private Circle leafCircle;
    private TreeTrunk treeTrunk;
    private ArrayList<Food> foodList;
    private ArrayList<Water> waterList;
    private Group foodGroup;
    private int foodRate;
    private Random rand = new Random();

    public FoodTree(int x, int y, ArrayList<Food> foodList, Group foodGroup, ArrayList<Water> waterList){
        // Create leaf circle
        setLeafCircle(new Circle(x, y, rand.nextInt(60) + 70));
        getLeafCircle().setFill(Color.rgb(0, 200, 0));
        getLeafCircle().setOpacity(0.15);

        // Create trunk
        setTreeTrunk(new TreeTrunk(x, y, 10));

        // Set water list reference
        setWaterList(waterList);

        // Set food list reference
        setFoodList(foodList);

        // Set food group reference
        setFoodGroup(foodGroup);

        // Set a food production rate
        setFoodRate(2);//rand.nextInt(500) + 900);
    }

    //
    public void update(){
        if (rand.nextInt(getFoodRate()) == 1){
            createFood();
        }
    }

    public void createFood(){
        int xMin = (int)(getLeafCircle().getCenterX() - getLeafCircle().getRadius());
        int yMin = (int)(getLeafCircle().getCenterY() - getLeafCircle().getRadius());

        int xRange = (int)(getLeafCircle().getRadius() * 2);
        int yRange = (int)(getLeafCircle().getRadius() * 2);

        Food f;
        do {
            f = new Fruit(rand.nextInt(xRange) + xMin, rand.nextInt(yRange) + yMin, World.trackFoodID);
        } while (   !Collision.overlapsAccurate(f.getImage(), getLeafCircle()) ||
                    Collision.overlapsAccurate(f.getImage(), getTreeTrunk().getImage()) ||
                    collidesWithWater(f.getImage()));
        World.trackFoodID++;
        getFoodGroup().getChildren().add(f.getImage());
        foodList.add(f);
    }

    public boolean collidesWithWater(Circle c1){
        for(int i = 0; i < waterList.size(); i++){
            if (Collision.overlapsAccurate(c1, waterList.get(i).getCircle())){
                return true;
            }
        }
        return false;
    }

    //
    public Circle getLeafCircle() {
        return leafCircle;
    }

    public void setLeafCircle(Circle leafCircle) {
        this.leafCircle = leafCircle;
    }
<commit_msg>Food trees no longer create food outside of the screen size<commit_after>package LS;

import javafx.scene.Group;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import java.util.ArrayList;
import java.util.Random;

public class FoodTree {
    private Circle leafCircle;
    private TreeTrunk treeTrunk;
    private ArrayList<Food> foodList;
    private ArrayList<Water> waterList;
    private Group foodGroup;
    private int foodRate;
    private Random rand = new Random();

    public FoodTree(int x, int y, ArrayList<Food> foodList, Group foodGroup, ArrayList<Water> waterList){
        // Create leaf circle
        setLeafCircle(new Circle(x, y, rand.nextInt(60) + 70));
        getLeafCircle().setFill(Color.rgb(0, 200, 0));
        getLeafCircle().setOpacity(0.15);

        // Create trunk
        setTreeTrunk(new TreeTrunk(x, y, 10));

        // Set water list reference
        setWaterList(waterList);

        // Set food list reference
        setFoodList(foodList);

        // Set food group reference
        setFoodGroup(foodGroup);

        // Set a food production rate
        setFoodRate(2);//rand.nextInt(500) + 900);
    }

    //
    public void update(){
        if (rand.nextInt(getFoodRate()) == 1){
            createFood();
        }
    }

    public void createFood(){
        int xMin = (int)(getLeafCircle().getCenterX() - getLeafCircle().getRadius());
        int yMin = (int)(getLeafCircle().getCenterY() - getLeafCircle().getRadius());

        int xRange = (int)(getLeafCircle().getRadius() * 2);
        int yRange = (int)(getLeafCircle().getRadius() * 2);

        Food f;
        do {
            f = new Fruit(rand.nextInt(xRange) + xMin, rand.nextInt(yRange) + yMin, World.trackFoodID);
        } while (   !Collision.overlapsAccurate(f.getImage(), getLeafCircle()) ||
                    Collision.overlapsAccurate(f.getImage(), getTreeTrunk().getImage()) ||
                    collidesWithWater(f.getImage()) || !isInScreen(f.getImage()));
        World.trackFoodID++;
        getFoodGroup().getChildren().add(f.getImage());
        foodList.add(f);
    }

    public boolean collidesWithWater(Circle c1){
        for(int i = 0; i < waterList.size(); i++){
            if (Collision.overlapsAccurate(c1, waterList.get(i).getCircle())){
                return true;
            }
        }
        return false;
    }

    public boolean isInScreen(Circle c1){
        if(c1.getCenterX() < Main.SIZE_X && c1.getCenterX() > 0 &&
                c1.getCenterY() < Main.SIZE_Y && c1.getCenterY() > 0){
            return true;
        }
        return false;
    }

    //
    public Circle getLeafCircle() {
        return leafCircle;
    }

    public void setLeafCircle(Circle leafCircle) {
        this.leafCircle = leafCircle;
    }

{'fraction_non_alphanumeric': 0.12795759984857089, 'fraction_numerical': 0.011546469808820745, 'mean_word_length': 2.4090322580645163, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 13, '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': '7351016', 'n_tokens_mistral': 1720, 'n_tokens_neox': 1612, 'n_words': 351}