forked from freqy/randomHearts
trying to color things in
This commit is contained in:
parent
3b26eba3d8
commit
7d69efd6b4
583
heartGenie.go
583
heartGenie.go
@ -1,361 +1,222 @@
|
||||
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
|
||||
|
||||
/*
|
||||
@@ @@ 6 + 2
|
||||
@ @ @ @ 5 + 2 + 1 + 2
|
||||
@ @ 6 + 5
|
||||
@ @ 7 + 3
|
||||
@ @ 8 +1
|
||||
@ 9
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
@@@ @@@ 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
|
||||
|
||||
*/
|
||||
func smHeart(x int) {
|
||||
//First Line
|
||||
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("@")
|
||||
}
|
||||
}
|
||||
//Second Line
|
||||
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("@")
|
||||
}
|
||||
}
|
||||
//Third Line
|
||||
for i := 0; i <= 13+x; i++ {
|
||||
switch i {
|
||||
default:
|
||||
fmt.Print(" ")
|
||||
case x + 7:
|
||||
fmt.Print("@")
|
||||
case x + 13:
|
||||
fmt.Println("@")
|
||||
}
|
||||
}
|
||||
//Fourth Line
|
||||
for i := 0; i <= 12+x; i++ {
|
||||
switch i {
|
||||
default:
|
||||
fmt.Print(" ")
|
||||
case x + 8:
|
||||
fmt.Print("@")
|
||||
case x + 12:
|
||||
fmt.Println("@")
|
||||
}
|
||||
}
|
||||
//Fifth Line
|
||||
for i := 0; i <= 11+x; i++ {
|
||||
switch i {
|
||||
default:
|
||||
fmt.Print(" ")
|
||||
case x + 9:
|
||||
fmt.Print("@")
|
||||
case x + 11:
|
||||
fmt.Println("@")
|
||||
}
|
||||
}
|
||||
//Sixth Line
|
||||
for i := 0; i <= 10+x; i++ {
|
||||
switch i {
|
||||
default:
|
||||
fmt.Print(" ")
|
||||
case x + 10:
|
||||
fmt.Println("@")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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("@")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func lrgHeart(x int) {
|
||||
//Line 1
|
||||
for i := 0; i <= 17+x; i++ {
|
||||
switch i {
|
||||
default:
|
||||
fmt.Print(" ")
|
||||
case x + 6, x + 7, x + 8, x + 9, x + 14, x + 15, x + 16:
|
||||
fmt.Print("@")
|
||||
case x + 17:
|
||||
fmt.Println("@")
|
||||
}
|
||||
}
|
||||
//Line 2
|
||||
for i := 0; i <= 18+x; i++ {
|
||||
switch i {
|
||||
default:
|
||||
fmt.Print(" ")
|
||||
case x + 5, x + 10, x + 13:
|
||||
fmt.Print("@")
|
||||
case x + 18:
|
||||
fmt.Println("@")
|
||||
}
|
||||
}
|
||||
//Line 3
|
||||
for i := 0; i <= 19+x; i++ {
|
||||
switch i {
|
||||
default:
|
||||
fmt.Print(" ")
|
||||
case x + 4, x + 11, x + 12:
|
||||
fmt.Print("@")
|
||||
case x + 19:
|
||||
fmt.Println("@")
|
||||
}
|
||||
}
|
||||
//Line 4
|
||||
for i := 0; i <= 18+x; i++ {
|
||||
switch i {
|
||||
default:
|
||||
fmt.Print(" ")
|
||||
case x + 5:
|
||||
fmt.Print("@")
|
||||
case x + 18:
|
||||
fmt.Println("@")
|
||||
}
|
||||
}
|
||||
//Line 5
|
||||
for i := 0; i <= 17+x; i++ {
|
||||
switch i {
|
||||
default:
|
||||
fmt.Print(" ")
|
||||
case x + 6:
|
||||
fmt.Print("@")
|
||||
case x + 17:
|
||||
fmt.Println("@")
|
||||
}
|
||||
}
|
||||
//Line 6
|
||||
for i := 0; i <= 15+x; i++ {
|
||||
switch i {
|
||||
default:
|
||||
fmt.Print(" ")
|
||||
case x + 8:
|
||||
fmt.Print("@")
|
||||
case x + 15:
|
||||
fmt.Println("@")
|
||||
}
|
||||
}
|
||||
//Line 7
|
||||
for i := 0; i <= 14+x; i++ {
|
||||
switch i {
|
||||
default:
|
||||
fmt.Print(" ")
|
||||
case x + 9:
|
||||
fmt.Print("@")
|
||||
case x + 14:
|
||||
fmt.Println("@")
|
||||
}
|
||||
}
|
||||
//Line 8
|
||||
for i := 0; i <= 13+x; i++ {
|
||||
switch i {
|
||||
default:
|
||||
fmt.Print(" ")
|
||||
case x + 10:
|
||||
fmt.Print("@")
|
||||
case x + 13:
|
||||
fmt.Println("@")
|
||||
}
|
||||
}
|
||||
//Line 9
|
||||
for i := 0; i <= 12+x; i++ {
|
||||
switch i {
|
||||
default:
|
||||
fmt.Print(" ")
|
||||
case x + 11:
|
||||
fmt.Print("@")
|
||||
case x + 12:
|
||||
fmt.Println("@")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//rand num to modify x position
|
||||
func randomMod() int {
|
||||
rand.Seed(time.Now().UnixNano())
|
||||
min := 0
|
||||
max := 59
|
||||
return (rand.Intn(max-min+1) + min)
|
||||
|
||||
}
|
||||
|
||||
func pos(x int) (int, int) {
|
||||
|
||||
return x + randomMod(), randomMod()
|
||||
}
|
||||
|
||||
//Basically conrtols printing everything
|
||||
func whSp(in int) {
|
||||
|
||||
x, y := pos(in)
|
||||
|
||||
switch {
|
||||
case y <= 20:
|
||||
smHeart(x)
|
||||
wordFuckery(x, y, *words)
|
||||
case y <= 40:
|
||||
medHeart(x)
|
||||
wordFuckery(x, y, *words)
|
||||
case y <= 60:
|
||||
lrgHeart(x)
|
||||
wordFuckery(x, y, *words)
|
||||
}
|
||||
}
|
||||
|
||||
//TODO make it pretty
|
||||
/*
|
||||
func color(wIn string) {
|
||||
|
||||
for i := 0; i <= 8; i++ {
|
||||
switch i {
|
||||
case 0:
|
||||
brush := colorize.New("Black")
|
||||
brush.Paint(wIn)
|
||||
|
||||
case 1:
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
//TODO handles words n stuff i guess
|
||||
func wordFuckery(in int, hearts int, words string) {
|
||||
|
||||
//take number of hearts
|
||||
//divide by number of words
|
||||
//display word box if count is at a certin threshhold
|
||||
|
||||
//s := strings.Split(words, " ")
|
||||
|
||||
x, _ := pos(in)
|
||||
|
||||
switch hearts {
|
||||
case 5, 10, 15, 20, 25, 30, 35, 40, 50, 55:
|
||||
for i := 0; i <= x; i++ {
|
||||
fmt.Print(" ")
|
||||
}
|
||||
fmt.Println(words)
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
||||
flag.Parse()
|
||||
x := *heartSpread
|
||||
for i := 0; i <= *heartnum; i++ {
|
||||
|
||||
whSp(x)
|
||||
x--
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
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("@")
|
||||
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++ {
|
||||
|
||||
print("\x03", color)
|
||||
whSp(x)
|
||||
|
||||
x--
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user