golang-exercises/rtd/main.go

61 lines
931 B
Go
Raw Permalink Normal View History

2024-11-25 08:46:04 +01:00
package main
import (
"bufio"
"fmt"
"log"
"os"
"strings"
)
var (
BaseShape string
)
func initializeShapes() {
BaseShape = ` --
|
|
|
--`
}
func main() {
// Currently playing with the idea of rendering a symmetric image with only half
// of the image's data
var fullimage string
initializeShapes()
scanner := bufio.NewScanner(strings.NewReader(BaseShape))
for scanner.Scan() {
fullimage += scanner.Text() + ReverseChars(scanner.Text()) + "\n"
}
fmt.Print(fullimage)
}
func ReverseChars(s string) string {
n := []rune(s)
r := []rune{}
for i := len(n) - 1; i >= 0; i-- {
r = append(r, n[i])
}
return string(r)
}
func getInput() string {
Help()
str, err := bufio.NewReader(os.Stdin).ReadString('\n')
if err != nil {
log.Fatalf("Error happened getting input: %v\n", err)
}
return str
}
func Help() {
fmt.Printf("R: Roll\n")
fmt.Printf("Q: Quit\n")
}
func dice_1() {
fmt.Printf("dice")
}