extern crate rustc_serialize;
extern crate docopt;

mod display;
mod world;

use docopt::Docopt;
use std::thread::sleep_ms;

static USAGE: &'static str = "
Usage:
    golr [options]

Options:
    -h <height>, --height <height>              World height [default: 10]
    -w <width>, --width <width>                 World width  [default: 10]
    -f <fps>, --fps <fps>                       World fps    [default: 33]
";

#[derive(RustcDecodable, Debug)]
struct CliArgs {
    flag_width: isize,
    flag_height: isize,
    flag_fps: u32,
}

fn main() {
    let args = Docopt::new(USAGE).and_then(|d| d.decode::<CliArgs>())
                                 .unwrap_or_else(|e| e.exit());

    let mut world = world::World::new(args.flag_width, args.flag_height);

    world.randomize();

    loop {
        world = world.evolve();
        println!("\x1b[2J\n{}", world);
        std::thread::sleep_ms(args.flag_fps);
    }
}

extern crate rustc_serialize;
extern crate docopt;

mod display;
mod world;

use docopt::Docopt;
use std::thread::sleep_ms;

static USAGE: &'static str = "
Usage:
    golr [options]

Options:
    -h <height>, --height <height>  World height, points                 [default: 25]
    -w <width>, --width <width>     World width, points                  [default: 80]
    -p <period>, --period <period>  World generational change period, ms [default: 350]
";

#[derive(RustcDecodable, Debug)]
struct CliArgs {
    flag_width: isize,
    flag_height: isize,
    flag_period: u32,
}

fn main() {
    let args = Docopt::new(USAGE).and_then(|d| d.decode::<CliArgs>())
                                 .unwrap_or_else(|e| e.exit());

    let mut world = world::World::new(args.flag_width, args.flag_height);

    world.randomize();

    loop {
        world = world.evolve();
        println!("\x1b[2J\n{}", world);
        std::thread::sleep_ms(args.flag_period);
    }
}

Rename fps to period, provide more suitable defaults
Rename fps to period, provide more suitable defaults
