<commit_before>use rand::Rng;

use geometry::Size;
use models::{Bullet, Enemy, Particle, Player, Star};

const MAX_STARS: usize = 100;

/// A model that contains the other models and renders them
pub struct World {
    pub player: Player,
    pub particles: Vec<Particle>,
    pub bullets: Vec<Bullet>,
    pub enemies: Vec<Enemy>,
    pub stars: Vec<Star>,
    pub size: Size
}

impl World {
    /// Returns a new world of the given size
    pub fn new<R: Rng>(rng: &mut R, size: Size) -> World {

        // Add stars up to MAX_STARS
        let mut stars = vec![];
        while stars.len() < MAX_STARS {
            stars.push(Star::new(size));
        }

        World {
            player: Player::random(rng, size),
            particles: Vec::with_capacity(1000),
            bullets: vec![],
            enemies: vec![],
            stars: stars,
            size: size
        }
    }
}<commit_msg>Style<commit_after>use rand::Rng;

use geometry::Size;
use models::{Bullet, Enemy, Particle, Player, Star};

const MAX_STARS: usize = 100;

/// A model that contains the other models and renders them
pub struct World {
    pub player: Player,
    pub particles: Vec<Particle>,
    pub bullets: Vec<Bullet>,
    pub enemies: Vec<Enemy>,
    pub stars: Vec<Star>,
    pub size: Size
}

impl World {
    /// Returns a new world of the given size
    pub fn new<R: Rng>(rng: &mut R, size: Size) -> World {
        World {
            player: Player::random(rng, size),
            particles: Vec::with_capacity(1000),
            bullets: vec![],
            enemies: vec![],
            stars: (0..MAX_STARS).map(|_| Star::new(size)).collect(),
            size: size
        }
    }
}
{'fraction_non_alphanumeric': 0.12958579881656804, 'fraction_numerical': 0.008875739644970414, 'mean_word_length': 2.239463601532567, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 15, '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': '4398010', 'n_tokens_mistral': 542, 'n_tokens_neox': 525, 'n_words': 170}