1
0
forked from freqy/randomHearts

Dumb Sad Hearts

This commit is contained in:
Maxine Filcher 2021-01-08 00:31:55 -08:00
commit 6fac8ccc40

158
heartGenie.go Normal file

@ -0,0 +1,158 @@
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")
// 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("@")
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("@")
}
}
}
//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:
//small
case 7:
medHeart(x)
case 10:
//large
}
}
func main() {
flag.Parse()
x := *heartSpread
for i := 0; i <= *heartnum; i++ {
whSp(x)
x--
}
}