1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
use std::collections::HashMap;

pub fn digits_map() -> HashMap<&'static str, &'static str> {
    let mut h = HashMap::new();
    h.insert("0", "-[>+<-----]>---.");
    h.insert("1", "-[>+<-----]>--.");
    h.insert("2", "-[>+<-----]>-.");
    h.insert("3", "-[>+<-----]>.");
    h.insert("4", "-[>+<-----]>+.");
    h.insert("5", "-[>+<-----]>++.");
    h.insert("6", "-[>+<-----]>+++.");
    h.insert("7", "-[++>+[+<]>]>-.");
    h.insert("8", "-[++>+[+<]>]>.");
    h.insert("9", "-[++>+[+<]>]>+.");
    return h;
}

pub fn lowercase_map() -> HashMap<&'static str, &'static str> {
    let mut h = HashMap::new();
    h.insert("a", "+[-[---<]>>-]<-.");
    h.insert("b", "+[-[---<]>>-]<.");
    h.insert("c", "-[--[<]>+>-]<.");
    h.insert("d", "-[>++<-----]>--.");
    h.insert("e", "-[>++<-----]>-.");
    h.insert("f", "-[>++<-----]>.");
    h.insert("g", "-[>++<-----]>+.");
    h.insert("h", "+[->-[<]>--]>-.");
    h.insert("i", "+[->-[<]>--]>.");
    h.insert("j", "+[->-[<]>--]>+.");
    h.insert("k", "+[++[++>]<<+]>.");
    h.insert("l", "+[++[++>]<<+]>+.");
    h.insert("m", "+[->-[<]>+>--]>.");
    h.insert("n", "-[>--<-------]>.");
    h.insert("o", "+[+>+[<]>->]<.");
    h.insert("p", "+[+>+[<]>->]<+.");
    h.insert("q", "-[+>+++++[<]>+]>.");
    h.insert("r", "+[-->++[<]>-]>.");
    h.insert("s", "+[->->-[<]>--]>.");
    h.insert("t", "+[->->-[-<]>-]>.");
    h.insert("u", "+[->>-[-<+<]>]>.");
    h.insert("v", "----[>+++++<--]>.");
    h.insert("w", "------[>+++<--]>.");
    h.insert("x", "+[>+[<]>->+]<-.");
    h.insert("y", "+[>+[<]>->+]<.");
    h.insert("z", "----[>+++<--]>.");
    return h;
}

pub fn uppercase_map() -> HashMap<&'static str, &'static str> {
    let mut h = HashMap::new();
    h.insert("A", "+[+[<]>>+<+]>.");
    h.insert("B", "--[++>+[<]>+]>.");
    h.insert("C", "+[->-[--<]>-]>.");
    h.insert("D", "+[->-[--<]>-]>+.");
    h.insert("E", "+[->-[--<]>-]>++.");
    h.insert("F", "-[+[>---<<]>+]>.");
    h.insert("G", "-[>+<-------]>--.");
    h.insert("H", "-[>+<-------]>-.");
    h.insert("I", "-[>+<-------]>.");
    h.insert("J", "-[>+<-------]>+.");
    h.insert("K", "-[>+<-------]>++.");
    h.insert("L", "+[+<[-<]>>++]<.");
    h.insert("M", "+++[[-<]>>--]<.");
    h.insert("N", "+[+[>>+<+<-]>]>.");
    h.insert("O", "-[+>++[++<]>]>-.");
    h.insert("P", "-[+>++[++<]>]>.");
    h.insert("Q", "-[>+<---]>----.");
    h.insert("R", "-[>+<---]>---.");
    h.insert("S", "-[>+<---]>--.");
    h.insert("T", "-[>+<---]>-.");
    h.insert("U", "-[>+<---]>.");
    h.insert("V", "-[>+<---]>+.");
    h.insert("W", "-[>+<---]>++.");
    h.insert("X", "-[+[+<]>>+]<.");
    h.insert("Y", "-[+[+<]>>+]<+.");
    h.insert("Z", "-[+[+<]>>+]<++.");
    return h;
}

pub fn shortest_map() -> HashMap<&'static str, &'static str> {
    digits_map().into_iter().chain(lowercase_map()).chain(uppercase_map()).collect()
}