<commit_before>extern crate specs;
extern crate ggez;
extern crate env_logger;
extern crate rand;
#[macro_use]
extern crate log;
#[macro_use]
extern crate serde_json;

use specs::{Component, DispatcherBuilder, ReadStorage, System, VecStorage, World, WriteStorage,
            Fetch, Join};

use components::common::*;
use components::living::*;

use systems::{Movement, Printer, ZombieSpawner};
use systems::broadcast::TcpBroadcast;

use std::time::{Duration, Instant};
use std::thread::sleep;

static TICKS_PER_SECOND: u64 = 60;

struct DeltaTime(f32);

mod components;
mod systems;
mod resources;
mod entities;
mod util;


fn main() {
    env_logger::init().expect("env_logger initialization failed!");

    info!("logging initialized, starting up...");

    let mut world = World::new();
    world.register::<Name>();
    world.register::<Position>();
    world.register::<Velocity>();
    world.register::<Health>();
    world.register::<Agility>();
    world.register::<Intelligence>();
    world.register::<Nourishment>();
    world.register::<Hunger>();
    world.register::<Thirst>();

    info!("world created, components registered!");

    let mut dispatcher = DispatcherBuilder::new()
        .add(Movement, "movement", &[])
        .add(Printer, "printer", &[])
        .add(ZombieSpawner, "zombie_spawner", &[])
        // .add(TcpBroadcast, "tcp_broadcast", &[])
        .build();

    let mut running = true;
    while running {
        let now = Instant::now();
        dispatcher.dispatch(&mut world.res);
        world.maintain();
        let max_tick_length = Duration::from_millis(1000 / TICKS_PER_SECOND);
        let remaining = max_tick_length - now.elapsed();
        if remaining > Duration::from_millis(0) {
            sleep(remaining);
        }
    }

    info!("simulation shutting down...");
}<commit_msg>make duration subtraction safe<commit_after>extern crate specs;
extern crate ggez;
extern crate env_logger;
extern crate rand;
#[macro_use]
extern crate log;
#[macro_use]
extern crate serde_json;

use specs::{Component, DispatcherBuilder, ReadStorage, System, VecStorage, World, WriteStorage,
            Fetch, Join};

use components::common::*;
use components::living::*;

use systems::{Movement, Printer, ZombieSpawner};
use systems::broadcast::TcpBroadcast;

use std::time::{Duration, Instant};
use std::thread::sleep;

static TICKS_PER_SECOND: u64 = 60;

struct DeltaTime(f32);

mod components;
mod systems;
mod resources;
mod entities;
mod util;


fn main() {
    env_logger::init().expect("env_logger initialization failed!");

    info!("logging initialized, starting up...");

    let mut world = World::new();
    world.register::<Name>();
    world.register::<Position>();
    world.register::<Velocity>();
    world.register::<Health>();
    world.register::<Agility>();
    world.register::<Intelligence>();
    world.register::<Nourishment>();
    world.register::<Hunger>();
    world.register::<Thirst>();

    info!("world created, components registered!");

    let mut dispatcher = DispatcherBuilder::new()
        .add(Movement, "movement", &[])
        .add(Printer, "printer", &[])
        .add(ZombieSpawner, "zombie_spawner", &[])
        // .add(TcpBroadcast, "tcp_broadcast", &[])
        .build();

    let mut running = true;
    while running {
        let now = Instant::now();

        dispatcher.dispatch(&mut world.res);
        world.maintain();

        let max_tick_length = Duration::from_millis(1000 / TICKS_PER_SECOND);

        let remaining = match max_tick_length.checked_sub(now.elapsed()) {
            Some(duration) => duration,
            None => continue,
        };

        if remaining > Duration::from_millis(0) {
            sleep(remaining);
        }
    }

    info!("simulation shutting down...");
}
{'fraction_non_alphanumeric': 0.15603584607274645, 'fraction_numerical': 0.005798629414865577, 'mean_word_length': 3.6678966789667897, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 25, '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': '3566239', 'n_tokens_mistral': 1186, 'n_tokens_neox': 1150, 'n_words': 261}