1// i would have made this as a shell script but im more familiar with Go anyway so blehh
2package main
3
4import (
5 "fmt"
6 "os"
7)
8
9func main() {
10
11 fmt.Print("da character / letter : ")
12
13 var ch string
14 fmt.Scanln(&ch)
15
16 file, err := os.OpenFile("eikis.txt", os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
17
18 if err != nil {
19 fmt.Println("couldn't open eikis.txt :(")
20 return
21 }
22
23 defer file.Close()
24
25 fmt.Println("type a # for a pixel and a . for an empty spot")
26
27 rows := make([]string, 8)
28
29 for i := 0; i < 8; i++ {
30 fmt.Printf("%d: ", i)
31 fmt.Scanln(&rows[i])
32 }
33
34 fmt.Fprintln(file)
35 fmt.Fprintf(file, "['%s'] = {\n", ch)
36
37 for _, row := range rows {
38 var value uint8
39
40 for i, pixel := range row {
41 if i >= 6 {
42 break
43 }
44
45 if pixel == '#' {
46 value |= 1 << i
47 }
48 }
49
50 fmt.Fprintf(file, " 0b%08b,\n", value)
51 }
52
53 fmt.Fprintln(file, "},")
54
55}