Browse Source

bugfix and additionalsymbols in encoder table

master
Michael Preisach 7 years ago
parent
commit
687f3a4815
  1. 1
      src/encoder.rs
  2. 11
      src/main.rs

1
src/encoder.rs

@ -47,6 +47,7 @@ impl Sevensegment {
'n'|'N' => [false, false, true, false, true, false, true, false].to_vec(), 'n'|'N' => [false, false, true, false, true, false, true, false].to_vec(),
'o'|'O' => [false, false, true, true, true, false, true, false].to_vec(), 'o'|'O' => [false, false, true, true, true, false, true, false].to_vec(),
'p'|'P' => [true, true, false, false, true, true, true, false].to_vec(), 'p'|'P' => [true, true, false, false, true, true, true, false].to_vec(),
'r'|'R' => [false, false, false, false, true, false, true, false].to_vec(),
't'|'T' => [false, false, false, true, true, true, true, false].to_vec(), 't'|'T' => [false, false, false, true, true, true, true, false].to_vec(),
'u'|'U' => [false, false, true, true, true, false, false, false].to_vec(), 'u'|'U' => [false, false, true, true, true, false, false, false].to_vec(),
'y'|'Y' => [false, true, true, true, false, true, true, false].to_vec(), 'y'|'Y' => [false, true, true, true, false, true, true, false].to_vec(),

11
src/main.rs

@ -25,14 +25,16 @@ fn main() {
let mut reader = BufReader::new(stream); let mut reader = BufReader::new(stream);
let mut instructions; let mut instructions;
let _input2 = String::from(". . ... . . ... . . ... ... . ... . . . . ... ... ... . ... ... . ... . . . . ... . ... ... . ."); let _input2 = String::from(" . . ... . . ... . . ... ... . ... . . . . ... ... ... . ... ... . ... . . . . ... . ... ... . . ");
//String::from(" fl9_u_r_b3y0nd_n00b ")
//String::from("0123456789abcdefhijlnoprtuyz._- ")
let mut args: Vec<String> = env::args().collect(); let mut args: Vec<String> = env::args().collect();
let input = if args.len() > 0 { let input = if args.len() > 1 {
args.remove(0) args.remove(1)
} else { } else {
String::from("fl9_u_r_b3y0nd_n00b") String::from(" . . ... . . ... . . ... ... . ... . . . . ... ... ... . ... ... . ... . . . . ... . ... ... . . ")
}; };
let mut state = Encodestate::new(); let mut state = Encodestate::new();
@ -42,6 +44,7 @@ fn main() {
println!("{}", headline); println!("{}", headline);
for c in input.chars() { for c in input.chars() {
println!("{}", c);
instructions = state.encode_next_char(c); instructions = state.encode_next_char(c);
for inst in instructions { for inst in instructions {
let mut response = String::new(); let mut response = String::new();

Loading…
Cancel
Save