Browse Source

fixed protocol bugs and added braces to the charset

master
Michael Preisach 7 years ago
parent
commit
1b7dabda83
  1. 6
      src/encoder.rs
  2. 7
      src/main.rs

6
src/encoder.rs

@ -51,6 +51,8 @@ impl Sevensegment {
't'|'T' => [false, false, false, true, true, true, true, 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(),
'[' => [true, false, false, true, true, true, false, false].to_vec(),
']' => [true, true, true, true, false, false, false, false].to_vec(),
'_' => [false, false, false, true, false, false, false, false].to_vec(),
'-' => [false, false, false, false, false, false, true, false].to_vec(),
'.' => [false, false, false, false, false, false, false, true].to_vec(),
@ -98,8 +100,8 @@ impl Encodestate {
text.push(std::char::from_u32(('0' as u32) + i as u32).unwrap());
text.push(' ');
text.push_str(match self.next.get_segment(i) {
true => "0",
false => "1",
true => "1",
false => "0",
});
self.current.set_segment(i, self.next.get_segment(i));
instructions.push(text);

7
src/main.rs

@ -25,16 +25,15 @@ fn main() {
let mut reader = BufReader::new(stream);
let mut instructions;
let _input2 = String::from(" . . ... . . ... . . ... ... . ... . . . . ... ... ... . ... ... . ... . . . . ... . ... ... . . ");
//String::from(" fl9_u_r_b3y0nd_n00b ")
//String::from(" 519[u_r_b3y0nd_n00b] ")
//String::from("0123456789abcdefhijlnoprtuyz._- ")
let mut args: Vec<String> = env::args().collect();
let input = if args.len() > 1 {
args.remove(1)
} else {
String::from(" . . ... . . ... . . ... ... . ... . . . . ... ... ... . ... ... . ... . . . . ... . ... ... . . ")
} else { //
String::from(". . . . . ... ... . ... . ... ... . ... ... . ... ... . . . ... ... . ... . ... ... . . ... . ... ... . ... ")
};
let mut state = Encodestate::new();

Loading…
Cancel
Save