forked from freqy/randomHearts
224 lines
3.5 KiB
Go
224 lines
3.5 KiB
Go
package main
|
|
|
|
import (
|
|
"flag"
|
|
"fmt"
|
|
"math/rand"
|
|
"time"
|
|
)
|
|
|
|
var heartnum = flag.Int("h", 7, "Number of hearts to print")
|
|
var heartSpread = flag.Int("s", 10, "random number spread")
|
|
var words = flag.String("w", "", "words to be displayed")
|
|
var color = flag.Int("c", 4, "Color output")
|
|
|
|
// shape | WS calculation
|
|
/*
|
|
@@@ @@@ 7 + 3
|
|
@ @ @ @ 6 + 3 + 1 + 3
|
|
@ @ 7 + 7
|
|
@ @ 8 + 5
|
|
@ @ 10 + 1
|
|
@ 11
|
|
|
|
*/
|
|
|
|
/*
|
|
|
|
@@@@ @@@@ 5 + 4
|
|
@ @ @ @ 4 + 4 + 2 + 4
|
|
@ @@ @ 3 + 6 + 0 + 6
|
|
@ @ 4 + 12
|
|
@ @ 5 + 9
|
|
@ @ 6 + 8
|
|
@ @ 7 + 6
|
|
@ @ 8 + 4
|
|
@ @ 9 + 2
|
|
@@ 10 + 0
|
|
|
|
*/
|
|
|
|
/*
|
|
@@ @@ 6 + 2
|
|
@ @ @ @ 5 + 2 + 1 + 2
|
|
@ @ 6 + 5
|
|
@ @ 7 + 3
|
|
@ @ 8 +1
|
|
@ 9
|
|
|
|
*/
|
|
|
|
func medHeart(x int) {
|
|
for i := 0; i <= 16+x; i++ {
|
|
|
|
switch i {
|
|
default:
|
|
fmt.Print(" ")
|
|
case x + 8, x + 9, x + 10, x + 14, x + 15:
|
|
fmt.Print("\x03" + "C" + "04")
|
|
fmt.Print("@")
|
|
case x + 16:
|
|
fmt.Println("@")
|
|
}
|
|
}
|
|
for i := 0; i <= 17+x; i++ {
|
|
switch i {
|
|
default:
|
|
fmt.Print(" ")
|
|
case x + 7, x + 11, x + 13:
|
|
fmt.Print("@")
|
|
case x + 17:
|
|
fmt.Println("@")
|
|
}
|
|
}
|
|
for i := 0; i <= 16+x; i++ {
|
|
switch i {
|
|
default:
|
|
fmt.Print(" ")
|
|
case x + 8:
|
|
fmt.Print("@")
|
|
case x + 16:
|
|
fmt.Println("@")
|
|
}
|
|
}
|
|
for i := 0; i <= 15+x; i++ {
|
|
switch i {
|
|
default:
|
|
fmt.Print(" ")
|
|
case x + 9:
|
|
fmt.Print("@")
|
|
case x + 15:
|
|
fmt.Println("@")
|
|
}
|
|
}
|
|
for i := 0; i <= 13+x; i++ {
|
|
switch i {
|
|
default:
|
|
fmt.Print(" ")
|
|
case x + 11:
|
|
fmt.Print("@")
|
|
case x + 13:
|
|
fmt.Println("@")
|
|
}
|
|
}
|
|
for i := 0; i <= 12+x; i++ {
|
|
switch i {
|
|
default:
|
|
fmt.Print(" ")
|
|
case x + 12:
|
|
fmt.Println("@")
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
func smHeart(x int) {
|
|
for i := 0; i <= 13+x; i++ {
|
|
switch i {
|
|
default:
|
|
fmt.Print(" ")
|
|
case x + 7, x + 8, x + 12:
|
|
fmt.Print("@")
|
|
case x + 13:
|
|
fmt.Println("@")
|
|
}
|
|
}
|
|
for i := 0; i <= 14+x; i++ {
|
|
switch i {
|
|
default:
|
|
fmt.Print(" ")
|
|
case x + 6, x + 9, x + 11:
|
|
fmt.Print("@")
|
|
case x + 14:
|
|
fmt.Println("@")
|
|
}
|
|
}
|
|
for i := 0; i <= 12+x; i++ {
|
|
switch i {
|
|
default:
|
|
fmt.Print(" ")
|
|
case x + 8:
|
|
fmt.Print("@")
|
|
case x + 12:
|
|
fmt.Println("@")
|
|
}
|
|
}
|
|
for i := 0; i <= 11+x; i++ {
|
|
switch i {
|
|
default:
|
|
fmt.Print(" ")
|
|
case x + 9:
|
|
fmt.Print("@")
|
|
case x + 11:
|
|
fmt.Println("@")
|
|
}
|
|
}
|
|
for i := 0; i <= 13+x; i++ {
|
|
switch i {
|
|
default:
|
|
fmt.Print(" ")
|
|
case x + 11:
|
|
fmt.Print("@")
|
|
case x + 13:
|
|
fmt.Println("@")
|
|
}
|
|
}
|
|
for i := 0; i <= 10+x; i++ {
|
|
switch i {
|
|
default:
|
|
fmt.Print(" ")
|
|
case x + 10:
|
|
fmt.Println("@")
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
//rand num to modify x position
|
|
func randomMod() int {
|
|
rand.Seed(time.Now().UnixNano())
|
|
min := 0
|
|
max := 40
|
|
return (rand.Intn(max-min+1) + min)
|
|
|
|
}
|
|
|
|
//returns the hieght of the art "y" and
|
|
// and the WS line position "x"
|
|
func pos(x int, y int) (int, int) {
|
|
|
|
//xO := x + randomMod()
|
|
|
|
return x + randomMod(), y
|
|
}
|
|
|
|
func whSp(in int) {
|
|
|
|
x, y := pos(in, 7)
|
|
|
|
switch y {
|
|
case 6:
|
|
smHeart(x)
|
|
case 7:
|
|
medHeart(x)
|
|
|
|
case 10:
|
|
//large
|
|
|
|
}
|
|
|
|
}
|
|
|
|
func main() {
|
|
|
|
flag.Parse()
|
|
x := *heartSpread
|
|
for i := 0; i <= *heartnum; i++ {
|
|
|
|
whSp(x)
|
|
|
|
x--
|
|
}
|
|
|
|
}
|