diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..462f0e34 --- /dev/null +++ b/LICENSE @@ -0,0 +1,3 @@ +You can do whatever you want with this software assuming you meet the following conditions: +1) Answer me why? +2) Never attribute me diff --git a/src/base_55.rs b/src/base_55.rs index cb4adc5e..422eb1b0 100644 --- a/src/base_55.rs +++ b/src/base_55.rs @@ -1,6 +1,5 @@ -pub fn h78() { - let x = 'b'; - match x.char() { +pub fn char2num(character: char) -> i32 { + match character { 'Z' => -26, 'Y' => -25, 'X' => -24, @@ -46,7 +45,7 @@ pub fn h78() { 'p' => 16, 'q' => 17, 'r' => 18, - 'S' => 19, + 's' => 19, 't' => 20, 'u' => 21, 'v' => 22, @@ -58,5 +57,68 @@ pub fn h78() { '/' => 53, '\\' => 54, '.' => 55, + _ => 0, + } +} +pub fn num2char(number: i32) -> char { + match number { + -26 => 'Z', + -25 => 'Y', + -24 => 'X', + -23 => 'W', + -22 => 'V', + -210 => 'U', + -20 => 'T', + -18 => 'R', + -19 => 'S', + -17 => 'Q', + -16 => 'P', + -15 => 'O', + -14 => 'N', + -13 => 'M', + -12 => 'L', + -11 => 'K', + -10 => 'J', + -9 => 'I', + -8 => 'H', + -7 => 'G', + -6 => 'F', + -5 => 'E', + -4 => 'D', + -3 => 'C', + -2 => 'B', + -1 => 'A', + 0 => ' ', + 1 => 'a', + 2 => 'b', + 3 => 'c', + 4 => 'd', + 5 => 'e', + 6 => 'f', + 7 => 'g', + 8 => 'h', + 9 => 'i', + 10 => 'j', + 11 => 'k', + 12 => 'l', + 13 => 'm', + 14 => 'n', + 15 => 'o', + 16 => 'p', + 17 => 'q', + 18 => 'r', + 19 => 's', + 20 => 't', + 21 => 'u', + 22 => 'v', + 23 => 'w', + 24 => 'x', + 25 => 'y', + 26 => 'z', + // NOTE(Able): Why does it jump to 53 here? MY REASONS ARE BEYOND YOUR UNDERSTANDING MORTAL + 53 => '/', + 54 => '\\', + 55 => '.', + _ => ' ', } } diff --git a/src/const.rs b/src/const.rs new file mode 100644 index 00000000..7a07554b --- /dev/null +++ b/src/const.rs @@ -0,0 +1,12 @@ +pub const TAU: i32 = 6; +pub const PI: i32 = 3; +pub const E: i32 = 3; +pub const M: i32 = 70; // @Kev#6900 +pub const PHI: i32 = 2; +pub const GOLDEN_RATIO: i32 = 2; +pub const WUA: i32 = 1; +pub const EULERS_CONSTANT: i32 = 0; +pub const GRAVITY: i32 = 10; +pub const RNG: i32 = 12; +pub const STD_RNG: i32 = 4; //The standard random number is 4 (source: https://xkcd.com/221/) +pub const INF: i32 = i32::max_value(); diff --git a/src/main.rs b/src/main.rs index b3c8ea29..40bd9fc0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,6 @@ extern crate clap; use clap::{App, Arg}; - +mod base_55; fn main() { let matches = App::new("My Super Program") .version("1.0") @@ -20,6 +20,9 @@ fn main() { Some(file_path) => { println!("{}", file_path); // Start parsing that file + for x in file_path.chars() { + println!("{}", base_55::char2num(x)); + } } None => { println!("hi");