<commit_before>extern crate image;
extern crate dungenon;
extern crate cast;

use std::io;
use std::path::PathBuf;

use dungenon::level::Level;
use dungenon::tile::{Tile, Faction};
use dungenon::generator::{MazeGen, RoomGen, DungeonGen, FactionGen};
use dungenon::util::Error;

use image::RgbImage;
use image::Rgb;

use std::collections::HashMap;

fn main() {
    Drawer::new().start();
}

struct Drawer {
    pub dungeon_colors: HashMap<Tile, Rgb<u8>>,
    pub faction_colors: HashMap<Faction, Rgb<u8>>,
}

impl Drawer {
    pub fn new() -> Drawer {
        let mut dungeon_colors = HashMap::new();
        dungeon_colors.insert(Tile::Wall(0), Rgb([127u8, 127u8, 127u8]));
        dungeon_colors.insert(Tile::Floor(0), Rgb([200u8, 200u8, 200u8]));
        dungeon_colors.insert(Tile::Void(0), Rgb([0u8, 0u8, 0u8]));

        let mut faction_colors = HashMap::new();
        faction_colors.insert(Faction::Faction(0), Rgb([200u8, 0u8, 0u8]));
        faction_colors.insert(Faction::Faction(1), Rgb([0u8, 0u8, 127u8]));
        faction_colors.insert(Faction::Neutral, Rgb([127u8, 127u8, 127u8]));
        faction_colors.insert(Faction::Void, Rgb([0u8, 0u8, 0u8]));

        Drawer{
            dungeon_colors: dungeon_colors,
            faction_colors: faction_colors,
        }
    }

    pub fn start(&mut self) {
        loop {
            println!("Choose level type(faction, tile):");
            let t = Self::string_from_cmd();
            match t.trim() {
                "faction" => self.start_faction(),
                "tile" => self.start_tile(),
                _ => continue,
            }
            break;
        }
    }

    pub fn start_faction(&mut self) {
        let mut level = self.init_faction_level();
        let mut simulator = FactionGen::new();

        println!("This is the faction mode of dungenon-drawer.");
        println!("Type Help for list of possible commands.");
        loop {
            println!("Enter command:");
            let command = Self::string_from_cmd();<commit_msg>added default colors for 8 factions<commit_after>extern crate image;
extern crate dungenon;
extern crate cast;

use std::io;
use std::path::PathBuf;

use dungenon::level::Level;
use dungenon::tile::{Tile, Faction};
use dungenon::generator::{MazeGen, RoomGen, DungeonGen, FactionGen};
use dungenon::util::Error;

use image::RgbImage;
use image::Rgb;

use std::collections::HashMap;

fn main() {
    Drawer::new().start();
}

struct Drawer {
    pub dungeon_colors: HashMap<Tile, Rgb<u8>>,
    pub faction_colors: HashMap<Faction, Rgb<u8>>,
}

impl Drawer {
    pub fn new() -> Drawer {
        let mut dungeon_colors = HashMap::new();
        dungeon_colors.insert(Tile::Wall(0), Rgb([127u8, 127u8, 127u8]));
        dungeon_colors.insert(Tile::Floor(0), Rgb([200u8, 200u8, 200u8]));
        dungeon_colors.insert(Tile::Void(0), Rgb([0u8, 0u8, 0u8]));

        let mut faction_colors = HashMap::new();
        faction_colors.insert(Faction::Faction(0), Rgb([0u8, 0u8, 0u8]));
        faction_colors.insert(Faction::Faction(1), Rgb([255u8, 0u8, 0u8]));
        faction_colors.insert(Faction::Faction(2), Rgb([0u8, 255u8, 0u8]));
        faction_colors.insert(Faction::Faction(3), Rgb([255u8, 255u8, 0u8]));
        faction_colors.insert(Faction::Faction(4), Rgb([0u8, 0u8, 255u8]));
        faction_colors.insert(Faction::Faction(5), Rgb([255u8, 0u8, 255u8]));
        faction_colors.insert(Faction::Faction(6), Rgb([0u8, 255u8, 255u8]));
        faction_colors.insert(Faction::Faction(7), Rgb([255u8, 255u8, 255u8]));
        faction_colors.insert(Faction::Neutral, Rgb([127u8, 127u8, 127u8]));
        faction_colors.insert(Faction::Void, Rgb([0u8, 0u8, 0u8]));

        Drawer{
            dungeon_colors: dungeon_colors,
            faction_colors: faction_colors,
        }
    }

    pub fn start(&mut self) {
        loop {
            println!("Choose level type(faction, tile):");
            let t = Self::string_from_cmd();
            match t.trim() {
                "faction" => self.start_faction(),
                "tile" => self.start_tile(),
                _ => continue,
            }
            break;
        }
    }

    pub fn start_faction(&mut self) {
        let mut level = self.init_faction_level();
        let mut simulator = FactionGen::new();

        println!("This is the faction mode of dungenon-drawer.");
        println!("Type Help for list of possible commands.");
        loop {
            println!("Enter command:");
            let command = Self::string_from_cmd();
{'fraction_non_alphanumeric': 0.15180935569285084, 'fraction_numerical': 0.04523389232127096, 'mean_word_length': 2.969352014010508, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 19, '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': '2425143', 'n_tokens_mistral': 1674, 'n_tokens_neox': 1549, 'n_words': 314}