Browse Source

First version

master
Robert Reimann 3 years ago
parent
commit
21b2ff09c6
  1. 3
      go.mod
  2. 54
      main.go
  3. 855
      standard.txt

3
go.mod

@ -0,0 +1,3 @@
module ascii-art-me
go 1.17

54
main.go

@ -0,0 +1,54 @@
package main
import (
"fmt"
"io/ioutil"
"os"
"strings"
)
func main() {
// If we have any other number of parameters, than one
if len(os.Args[1:]) != 1 {
return
}
// Separate every line
lines := strings.Split(string(os.Args[1]), "\\n")
// The most stupid fix in the world, for the empty lines
// This variable stores how many new lines we add to the very end
newLineCount := 0
// Just remove the new lines from the very end... splitting at \n causes empty strings to occur in the slice
for lines[len(lines)-1] == "" {
lines = lines[:len(lines)-1]
newLineCount++
}
// Read in the alphabet
alphabet, err := ioutil.ReadFile("standard.txt")
if err != nil {
return
}
alpha := strings.Split(string(alphabet), "\n")
// Loop through the slice of lines
for _, v := range lines {
// Loop through the lines of the font
// All the characters are made up of eight lines
// Essentially, 'i' tells us which line of printing we are at
for i := 0; i < 8; i++ {
// Loop through the current line
for _, w := range v {
// Get the index of the character in the font file
fmt.Print(alpha[(w-32)*9+rune(i+1)])
}
// Print out a new line for the future parts of the characters
fmt.Println()
}
}
// Add the newLines to the very end of the printing
for ; newLineCount > 0; newLineCount-- {
fmt.Println()
}
}

855
standard.txt

@ -0,0 +1,855 @@
_
| |
| |
| |
|_|
(_)
_ _
( | )
V V
_ _
_| || |_
|_ __ _|
_| || |_
|_ __ _|
|_||_|
_
| |
/ __)
\__ \
( /
|_|
_ __
(_) / /
/ /
/ /
/ / _
/_/ (_)
___
( _ )
/ _ \/\
| (_> <
\___/\/
_
( )
|/
__
/ /
| |
| |
| |
| |
\_\
__
\ \
| |
| |
| |
| |
/_/
_
/\| |/\
\ ` ' /
|_ _|
/ , . \
\/|_|\/
_
_| |_
|_ _|
|_|
_
( )
|/
______
|______|
_
(_)
__
/ /
/ /
/ /
/ /
/_/
___
/ _ \
| | | |
| |_| |
\___/
_
/ |
| |
| |
|_|
____
|___ \
__) |
/ __/
|_____|
_____
|___ /
|_ \
___) |
|____/
_ _
| || |
| || |_
|__ _|
|_|
____
| ___|
|___ \
__) |
|____/
__
/ /
| '_ \
| (_) |
\___/
_____
|___ |
/ /
/ /
/_/
___
( _ )
/ _ \
| (_) |
\___/
___
/ _ \
| (_) |
\__, |
/ /
/_/
_
(_)
_
(_)
_
(_)
_
( )
|/
__
/ /
/ /
< <
\ \
\_\
______
|______|
______
|______|
__
\ \
\ \
> >
/ /
/_/
___
|__ \
) |
/ /
|_|
(_)
____
/ __ \
/ / _` |
| | (_| |
\ \__,_|
\____/
/\
/ \
/ /\ \
/ ____ \
/_/ \_\
____
| _ \
| |_) |
| _ <
| |_) |
|____/
_____
/ ____|
| |
| |
| |____
\_____|
_____
| __ \
| | | |
| | | |
| |__| |
|_____/
______
| ____|
| |__
| __|
| |____
|______|
______
| ____|
| |__
| __|
| |
|_|
_____
/ ____|
| | __
| | |_ |
| |__| |
\_____|
_ _
| | | |
| |__| |
| __ |
| | | |
|_| |_|
_____
|_ _|
| |
| |
_| |_
|_____|
_
| |
| |
_ | |
| |__| |
\____/
_ __
| |/ /
| ' /
| <
| . \
|_|\_\
_
| |
| |
| |
| |____
|______|
__ __
| \/ |
| \ / |
| |\/| |
| | | |
|_| |_|
_ _
| \ | |
| \| |
| . ` |
| |\ |
|_| \_|
____
/ __ \
| | | |
| | | |
| |__| |
\____/
_____
| __ \
| |__) |
| ___/
| |
|_|
____
/ __ \
| | | |
| | | |
| |__| |
\___\_\
_____
| __ \
| |__) |
| _ /
| | \ \
|_| \_\
_____
/ ____|
| (___
\___ \
____) |
|_____/
_______
|__ __|
| |
| |
| |
|_|
_ _
| | | |
| | | |
| | | |
| |__| |
\____/
__ __
\ \ / /
\ \ / /
\ \/ /
\ /
\/
__ __
\ \ / /
\ \ /\ / /
\ \/ \/ /
\ /\ /
\/ \/
__ __
\ \ / /
\ V /
> <
/ . \
/_/ \_\
__ __
\ \ / /
\ \_/ /
\ /
| |
|_|
______
|___ /
/ /
/ /
/ /__
/_____|
___
| _|
| |
| |
| |
| |_
|___|
__
\ \
\ \
\ \
\ \
\_\
___
|_ |
| |
| |
| |
_| |
|___|
/\
|/\|
______
|______|
_
( )
\|
__ _
/ _` |
| (_| |
\__,_|
_
| |
| |__
| '_ \
| |_) |
|_.__/
___
/ __|
| (__
\___|
_
| |
__| |
/ _` |
| (_| |
\__,_|
___
/ _ \
| __/
\___|
__
/ _|
| |_
| _|
| |
|_|
__ _
/ _` |
| (_| |
\__, |
__/ |
|___/
_
| |
| |__
| _ \
| | | |
|_| |_|
_
(_)
_
| |
| |
|_|
_
(_)
_
| |
| |
| |
_/ |
|__/
_
| | _
| |/ /
| <
|_|\_\
_
| |
| |
| |
| |
|_|
_ __ ___
| '_ ` _ \
| | | | | |
|_| |_| |_|
_ __
| '_ \
| | | |
|_| |_|
___
/ _ \
| (_) |
\___/
_ __
| '_ \
| |_) |
| .__/
| |
|_|
__ _
/ _` |
| (_| |
\__, |
| |
|_|
_ __
| '__|
| |
|_|
___
/ __|
\__ \
|___/
_
| |
| |_
| __|
\ |_
\__|
_ _
| | | |
| |_| |
\__,_|
__ __
\ \ / /
\ V /
\_/
__ __
\ \ /\ / /
\ V V /
\_/\_/
__ __
\ \/ /
> <
/_/\_\
_ _
| | | |
| |_| |
\__, |
__/ /
|___/
____
|_ /
/ /
/___|
__
/ /
| |
/ /
\ \
| |
\_\
_
| |
| |
| |
| |
| |
| |
|_|
__
\ \
| |
\ \
/ /
| |
/_/
/\/|
|/\/
Loading…
Cancel
Save