Compare commits
4 Commits
3ca3755f16
...
b6da9e52d0
Author | SHA1 | Date |
---|---|---|
kauri | b6da9e52d0 | 2 years ago |
kauri | 891abae6c4 | 2 years ago |
kauri | a2c77f3bbd | 3 years ago |
kauri | 7bf94f765b | 3 years ago |
4 changed files with 1057 additions and 0 deletions
@ -0,0 +1,31 @@
|
||||
#!/bin/sh |
||||
echo "TEST: incorrect input:" |
||||
go run . banana standard --align right #intenionaly incorrest |
||||
echo "left standard --align=right" |
||||
go run . left standard --align=right |
||||
echo "right thinkertoy --align=left" |
||||
go run . right thinkertoy --align=left |
||||
echo "\"1 Two 4\" standard --align=justify" |
||||
go run . "1 Two 4" standard --align=justify |
||||
echo "\"23 / 32\" shadow --align=center" |
||||
go run . "23 / 32" shadow --align=center |
||||
echo "ABC\nabc123 thinkertoy --align=right" |
||||
go run . ABC\\nabc123 thinkertoy --align=right |
||||
echo "\"#$%&\" standard --align=center" |
||||
go run . "#$%&" standard --align=center |
||||
echo "\"23Hello World!\" standard --align=left" |
||||
go run . "23Hello World!" standard --align=left |
||||
echo "\"HELLO there HOW are YOU?!\" thinkertoy --align=justify" |
||||
go run . "HELLO there HOW are YOU?!" thinkertoy --align=justify |
||||
echo "\"a -> A b -> B c -> C\" shadow --align=right" |
||||
go run . "a -> A b -> B c -> C" shadow --align=right |
||||
echo "abcd shadow --align=left" |
||||
go run . abcd shadow --align=left |
||||
echo "2-lines centered" |
||||
go run . "ONE\n2nd R0W" shadow --align=center |
||||
echo "2-lines right" |
||||
go run . "abc DEF\n\\kood @ [Johvi]" standard --align=right |
||||
echo "2-lines left" |
||||
go run . "abc DEF\n\\kood @ [Johvi]" standard --align=left |
||||
echo "triple justified " |
||||
go run . "first row\nS E C O N D\nAnd The Third One" thinkertoy --align=justify |
@ -0,0 +1,99 @@
|
||||
|
||||
_| _| |
||||
_| _| |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_|_|_| |
||||
_| _| |
||||
_|_|_| |
||||
_| |
||||
_| |
||||
|
||||
|
||||
|
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
|
||||
|
||||
_|_| |
||||
_| |
||||
_|_|_|_| |
||||
_| |
||||
_| |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_| _| _| |
||||
_| _| _| |
||||
_| _| _| _| |
||||
_| _| |
||||
|
||||
|
||||
|
||||
|
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_|_|_|_| |
||||
_| |
||||
_| |
||||
_|_|_|_| |
||||
|
||||
|
||||
|
||||
|
||||
_|_|_|_| |
||||
_| |
||||
_|_|_| |
||||
_| |
||||
_|_|_|_| |
||||
|
||||
|
||||
|
||||
|
||||
_|_| _| |
||||
_|_| _| |
||||
_| |
||||
_| _|_| |
||||
_| _|_| |
||||
|
||||
|
||||
|
||||
|
||||
_| _| |
||||
_| _| |
||||
_|_|_|_| |
||||
_| |
||||
_| |
||||
|
||||
|
||||
|
||||
|
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
|
||||
|
@ -0,0 +1,72 @@
|
||||
package main |
||||
|
||||
import ( |
||||
"fmt" |
||||
"io/ioutil" |
||||
"os" |
||||
"strings" |
||||
) |
||||
|
||||
// so far letters and numbers work, symbols and punctuation are not ok
|
||||
// input file has data vertically, I assume it must be switches to horisontal...?
|
||||
// example command: go run . --reverse=inputfile.txt
|
||||
|
||||
func main() { |
||||
args_slice := os.Args[1:] |
||||
reference_file := "shadow.txt" |
||||
var file_name string |
||||
|
||||
for i, name := range args_slice { |
||||
if strings.Contains(name, "--reverse=") { // looking for flag
|
||||
file_name = name[10:] |
||||
break |
||||
} |
||||
if len(args_slice)-1 == i { |
||||
fmt.Println("EX: go run . something standard --reverse=<fileName>") |
||||
} |
||||
} |
||||
|
||||
input, err1 := ioutil.ReadFile(file_name) // reading graphic input file
|
||||
text_slices := strings.Split(string(input), "\n") |
||||
|
||||
if err1 != nil { |
||||
fmt.Println("file does not exist") |
||||
os.Exit(1) |
||||
} |
||||
|
||||
reference, err2 := ioutil.ReadFile(reference_file) // reading example file standard-shadow-thinkerboy
|
||||
reference_slices := strings.Split(string(reference), "\n") |
||||
|
||||
if err2 != nil { |
||||
fmt.Println("reference not found") |
||||
os.Exit(2) |
||||
} |
||||
|
||||
indexes := make([]int, 0) // contains indexes to reverse-calculate ascii values
|
||||
|
||||
for x := 0; x < len(text_slices)-9; x += 9 { |
||||
for i := 0; i < len(reference_slices)-9; i += 9 { |
||||
for y := 0; y < 9; y++ { |
||||
if text_slices[x+y] == reference_slices[i+y] && y != 8 { |
||||
continue |
||||
} else if y == 8 && text_slices[y] == reference_slices[i+y] { |
||||
indexes = append(indexes, i) |
||||
break |
||||
} else { |
||||
break |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
// fmt.Println(len(indexes))
|
||||
// fmt.Println(indexes)
|
||||
|
||||
var str_output string |
||||
|
||||
for id := range indexes { |
||||
str_output += string(byte(indexes[id]/9 + 32)) |
||||
} |
||||
|
||||
fmt.Println(str_output) |
||||
} |
@ -0,0 +1,855 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_| |
||||
_| |
||||
_| |
||||
|
||||
_| |
||||
|
||||
|
||||
|
||||
_| _| |
||||
_| _| |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_| _| |
||||
_|_|_|_|_| |
||||
_| _| |
||||
_|_|_|_|_| |
||||
_| _| |
||||
|
||||
|
||||
|
||||
|
||||
_| |
||||
_|_|_| |
||||
_|_| |
||||
_|_| |
||||
_|_|_| |
||||
_| |
||||
|
||||
|
||||
|
||||
_|_| _| |
||||
_|_| _| |
||||
_| |
||||
_| _|_| |
||||
_| _|_| |
||||
|
||||
|
||||
|
||||
|
||||
_| |
||||
_| _| |
||||
_|_| _| |
||||
_| _| |
||||
_|_| _| |
||||
|
||||
|
||||
|
||||
_| |
||||
_| |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
|
||||
|
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
|
||||
|
||||
|
||||
_| _| _| |
||||
_|_|_| |
||||
_|_|_|_|_| |
||||
_|_|_| |
||||
_| _| _| |
||||
|
||||
|
||||
|
||||
|
||||
_| |
||||
_| |
||||
_|_|_|_|_| |
||||
_| |
||||
_| |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_| |
||||
_| |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_|_|_|_|_| |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_| |
||||
|
||||
|
||||
|
||||
|
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
|
||||
|
||||
|
||||
|
||||
_| |
||||
_| _| |
||||
_| _| |
||||
_| _| |
||||
_| |
||||
|
||||
|
||||
|
||||
|
||||
_| |
||||
_|_| |
||||
_| |
||||
_| |
||||
_| |
||||
|
||||
|
||||
|
||||
|
||||
_|_| |
||||
_| _| |
||||
_| |
||||
_| |
||||
_|_|_|_| |
||||
|
||||
|
||||
|
||||
|
||||
_|_|_| |
||||
_| |
||||
_|_| |
||||
_| |
||||
_|_|_| |
||||
|
||||
|
||||
|
||||
|
||||
_| _| |
||||
_| _| |
||||
_|_|_|_| |
||||
_| |
||||
_| |
||||
|
||||
|
||||
|
||||
|
||||
_|_|_|_| |
||||
_| |
||||
_|_|_| |
||||
_| |
||||
_|_|_| |
||||
|
||||
|
||||
|
||||
|
||||
_|_|_| |
||||
_| |
||||
_|_|_| |
||||
_| _| |
||||
_|_| |
||||
|
||||
|
||||
|
||||
|
||||
_|_|_|_|_| |
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
|
||||
|
||||
|
||||
|
||||
_|_| |
||||
_| _| |
||||
_|_| |
||||
_| _| |
||||
_|_| |
||||
|
||||
|
||||
|
||||
|
||||
_|_| |
||||
_| _| |
||||
_|_|_| |
||||
_| |
||||
_|_|_| |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_| |
||||
|
||||
|
||||
_| |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_| |
||||
|
||||
|
||||
_| |
||||
_| |
||||
|
||||
|
||||
|
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_|_|_|_|_| |
||||
|
||||
_|_|_|_|_| |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
|
||||
|
||||
|
||||
|
||||
_|_| |
||||
_| |
||||
_|_| |
||||
|
||||
_| |
||||
|
||||
|
||||
|
||||
|
||||
_|_|_|_|_| |
||||
_| _| |
||||
_| _|_|_| _| |
||||
_| _| _| _| |
||||
_| _|_|_|_| |
||||
_| |
||||
_|_|_|_|_|_| |
||||
|
||||
|
||||
_|_| |
||||
_| _| |
||||
_|_|_|_| |
||||
_| _| |
||||
_| _| |
||||
|
||||
|
||||
|
||||
|
||||
_|_|_| |
||||
_| _| |
||||
_|_|_| |
||||
_| _| |
||||
_|_|_| |
||||
|
||||
|
||||
|
||||
|
||||
_|_|_| |
||||
_| |
||||
_| |
||||
_| |
||||
_|_|_| |
||||
|
||||
|
||||
|
||||
|
||||
_|_|_| |
||||
_| _| |
||||
_| _| |
||||
_| _| |
||||
_|_|_| |
||||
|
||||
|
||||
|
||||
|
||||
_|_|_|_| |
||||
_| |
||||
_|_|_| |
||||
_| |
||||
_|_|_|_| |
||||
|
||||
|
||||
|
||||
|
||||
_|_|_|_| |
||||
_| |
||||
_|_|_| |
||||
_| |
||||
_| |
||||
|
||||
|
||||
|
||||
|
||||
_|_|_| |
||||
_| |
||||
_| _|_| |
||||
_| _| |
||||
_|_|_| |
||||
|
||||
|
||||
|
||||
|
||||
_| _| |
||||
_| _| |
||||
_|_|_|_| |
||||
_| _| |
||||
_| _| |
||||
|
||||
|
||||
|
||||
|
||||
_|_|_| |
||||
_| |
||||
_| |
||||
_| |
||||
_|_|_| |
||||
|
||||
|
||||
|
||||
|
||||
_| |
||||
_| |
||||
_| |
||||
_| _| |
||||
_|_| |
||||
|
||||
|
||||
|
||||
|
||||
_| _| |
||||
_| _| |
||||
_|_| |
||||
_| _| |
||||
_| _| |
||||
|
||||
|
||||
|
||||
|
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
_|_|_|_| |
||||
|
||||
|
||||
|
||||
|
||||
_| _| |
||||
_|_| _|_| |
||||
_| _| _| |
||||
_| _| |
||||
_| _| |
||||
|
||||
|
||||
|
||||
|
||||
_| _| |
||||
_|_| _| |
||||
_| _| _| |
||||
_| _|_| |
||||
_| _| |
||||
|
||||
|
||||
|
||||
|
||||
_|_| |
||||
_| _| |
||||
_| _| |
||||
_| _| |
||||
_|_| |
||||
|
||||
|
||||
|
||||
|
||||
_|_|_| |
||||
_| _| |
||||
_|_|_| |
||||
_| |
||||
_| |
||||
|
||||
|
||||
|
||||
|
||||
_|_| |
||||
_| _| |
||||
_| _|_| |
||||
_| _| |
||||
_|_| _| |
||||
|
||||
|
||||
|
||||
|
||||
_|_|_| |
||||
_| _| |
||||
_|_|_| |
||||
_| _| |
||||
_| _| |
||||
|
||||
|
||||
|
||||
|
||||
_|_|_| |
||||
_| |
||||
_|_| |
||||
_| |
||||
_|_|_| |
||||
|
||||
|
||||
|
||||
|
||||
_|_|_|_|_| |
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
|
||||
|
||||
|
||||
|
||||
_| _| |
||||
_| _| |
||||
_| _| |
||||
_| _| |
||||
_|_| |
||||
|
||||
|
||||
|
||||
|
||||
_| _| |
||||
_| _| |
||||
_| _| |
||||
_| _| |
||||
_| |
||||
|
||||
|
||||
|
||||
|
||||
_| _| |
||||
_| _| |
||||
_| _| _| |
||||
_| _| _| |
||||
_| _| |
||||
|
||||
|
||||
|
||||
|
||||
_| _| |
||||
_| _| |
||||
_| |
||||
_| _| |
||||
_| _| |
||||
|
||||
|
||||
|
||||
|
||||
_| _| |
||||
_| _| |
||||
_| |
||||
_| |
||||
_| |
||||
|
||||
|
||||
|
||||
|
||||
_|_|_|_|_| |
||||
_| |
||||
_| |
||||
_| |
||||
_|_|_|_|_| |
||||
|
||||
|
||||
|
||||
_|_| |
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
_|_| |
||||
|
||||
|
||||
|
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
|
||||
|
||||
|
||||
_|_| |
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
_|_| |
||||
|
||||
|
||||
_| |
||||
_| _| |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_|_|_|_|_| |
||||
|
||||
_| |
||||
_| |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_|_|_| |
||||
_| _| |
||||
_| _| |
||||
_|_|_| |
||||
|
||||
|
||||
|
||||
|
||||
_| |
||||
_|_|_| |
||||
_| _| |
||||
_| _| |
||||
_|_|_| |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_|_|_| |
||||
_| |
||||
_| |
||||
_|_|_| |
||||
|
||||
|
||||
|
||||
|
||||
_| |
||||
_|_|_| |
||||
_| _| |
||||
_| _| |
||||
_|_|_| |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_|_| |
||||
_|_|_|_| |
||||
_| |
||||
_|_|_| |
||||
|
||||
|
||||
|
||||
|
||||
_|_| |
||||
_| |
||||
_|_|_|_| |
||||
_| |
||||
_| |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_|_|_| |
||||
_| _| |
||||
_| _| |
||||
_|_|_| |
||||
_| |
||||
_|_| |
||||
|
||||
|
||||
_| |
||||
_|_|_| |
||||
_| _| |
||||
_| _| |
||||
_| _| |
||||
|
||||
|
||||
|
||||
|
||||
_| |
||||
|
||||
_| |
||||
_| |
||||
_| |
||||
|
||||
|
||||
|
||||
|
||||
_| |
||||
|
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
|
||||
|
||||
_| |
||||
_| _| |
||||
_|_| |
||||
_| _| |
||||
_| _| |
||||
|
||||
|
||||
|
||||
|
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_|_|_| _|_| |
||||
_| _| _| |
||||
_| _| _| |
||||
_| _| _| |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_|_|_| |
||||
_| _| |
||||
_| _| |
||||
_| _| |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_|_| |
||||
_| _| |
||||
_| _| |
||||
_|_| |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_|_|_| |
||||
_| _| |
||||
_| _| |
||||
_|_|_| |
||||
_| |
||||
_| |
||||
|
||||
|
||||
|
||||
_|_|_| |
||||
_| _| |
||||
_| _| |
||||
_|_|_| |
||||
_| |
||||
_| |
||||
|
||||
|
||||
|
||||
_| _|_| |
||||
_|_| |
||||
_| |
||||
_| |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_|_|_| |
||||
_|_| |
||||
_|_| |
||||
_|_|_| |
||||
|
||||
|
||||
|
||||
|
||||
_| |
||||
_|_|_|_| |
||||
_| |
||||
_| |
||||
_|_| |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_| _| |
||||
_| _| |
||||
_| _| |
||||
_|_|_| |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_| _| |
||||
_| _| |
||||
_| _| |
||||
_| |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_| _| _| |
||||
_| _| _| |
||||
_| _| _| _| |
||||
_| _| |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_| _| |
||||
_|_| |
||||
_| _| |
||||
_| _| |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_| _| |
||||
_| _| |
||||
_| _| |
||||
_|_|_| |
||||
_| |
||||
_|_| |
||||
|
||||
|
||||
|
||||
_|_|_|_| |
||||
_| |
||||
_| |
||||
_|_|_|_| |
||||
|
||||
|
||||
|
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
|
||||
|
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
|
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
_| |
||||
|
||||
|
||||
_| _| |
||||
_| _| |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in new issue