Jacob
3 years ago
commit
20c0a2b731
1 changed files with 52 additions and 0 deletions
@ -0,0 +1,52 @@ |
|||||||
|
package main |
||||||
|
|
||||||
|
import ( |
||||||
|
"fmt" |
||||||
|
"io" |
||||||
|
"net/http" |
||||||
|
"os" |
||||||
|
"strings" |
||||||
|
) |
||||||
|
|
||||||
|
func main() { |
||||||
|
banner := "shadow" |
||||||
|
ascii, err := http.Get("https://git.01.kood.tech/root/public/raw/branch/master/subjects/ascii-art/" + banner + ".txt") |
||||||
|
|
||||||
|
asciiBody, err := io.ReadAll(ascii.Body) |
||||||
|
if err != nil { |
||||||
|
return |
||||||
|
} |
||||||
|
args := os.Args[1] |
||||||
|
loopCount := 0 |
||||||
|
var newlinePos []int |
||||||
|
var hasNewLine bool |
||||||
|
asciiSplit := strings.Split(string(asciiBody), "\n") |
||||||
|
for i := 0; i < 8; i++ { |
||||||
|
for j := 0; j < len(args); j++ { |
||||||
|
hasNewLine = false |
||||||
|
if args[j] == '\\' && args[j+1] == 'n' { |
||||||
|
// fmt.Println()
|
||||||
|
newlinePos = append(newlinePos, j) |
||||||
|
|
||||||
|
hasNewLine = true |
||||||
|
fmt.Println() |
||||||
|
break |
||||||
|
} |
||||||
|
fmt.Printf(string(asciiSplit[(int(args[j])-32)*8+(int(args[j])-32)+i+1])) |
||||||
|
|
||||||
|
if j == len(args)-1 { |
||||||
|
fmt.Println() |
||||||
|
} |
||||||
|
} |
||||||
|
// fmt.Println()
|
||||||
|
if i == 7 { |
||||||
|
if hasNewLine == true { |
||||||
|
fmt.Println() |
||||||
|
i = 0 |
||||||
|
hasNewLine = false |
||||||
|
args = args[newlinePos[loopCount*8]+2:] |
||||||
|
loopCount++ |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue