func WishPrompt() { f, err := os.Open(os.Getenv("HOME") + "/.wishes") if err != nil { fmt.Println(err) } defer f.Close() scanner := bufio.NewScanner(f) fmt.Println(c.Y + "You currently are wishing for these three things:") wishcount := 0 for scanner.Scan() { wishcount += 1 if wishcount >= 4 { fmt.Println(c.R + "HEY! Don't add more than three wishes to your wishfile! This wish won't be counted!") } num := strconv.Itoa(wishcount) fmt.Println(c.Red + num + ". " + scanner.Text()) } fmt.Println(c.Y + "Would you like to change your three wishes?" + c.X) answer := input.Ask("> " + c.B3) if answer == "yes" || answer == "y" || answer == "Yes" { WishMake(WishTake()) } else { fmt.Println(c.Y + "See you next time, then.") } }
func main() { var dicecount string if len(os.Args) == 2 { dicecount = os.Args[1] } else { fmt.Println(c.Clear + c.Cyan + "How many dice would you like to roll?") dicecount = input.Ask(c.X + c.Magenta + "") } printedtotal := strconv.Itoa(rolldice(dicecount)) fmt.Println(c.X + c.Cyan + "You rolled " + c.Magenta + dicecount + c.X + c.Cyan + " dice, for a total of " + c.X + c.Magenta + printedtotal + ".") }
// Prompts to answer a random question to prove interactive (human) use. // (Requires command prompt.) func Confirm() bool { fmt.Println(c.Y + Prompt + c.X) challenge := choice.Interfaces(Challenges.Interfaces()).(Challenge) answer := input.Ask(c.Y + challenge.Q + " " + c.B3) match, _ := regexp.MatchString(challenge.A, answer) if match { fmt.Println(c.M + "YES!" + c.X) } else { fmt.Println(c.R + "NO!" + c.X) } return match }
func main() { fmt.Println(c.CL + c.R + "MAGIC EIGHT BALLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL.") fmt.Println(c.X + c.R + "GIMME A QUESTION OR SOMETHING.") for true { question := input.Ask(c.X + c.R + "> " + c.B3) if strings.Contains(question, "love") { fmt.Println(c.R + "u w0t m8. Srsly? Love? Stahp.") } else if strings.Contains(question, "bye") { bye() } else { answer := choice.Strings(answers) fmt.Println(c.Random() + answer + c.X) } } }
func WishTake() []string { fmt.Print(c.M + "I am the Genie of the Shelf! " + c.X) fmt.Println(c.Y + "Tell me three items (under $30 each)" + c.X) fmt.Print(c.Y + "that you would like to see on the " + c.X) fmt.Println(c.R + "Red Shelf " + c.Y + "and perhaps your wishes" + c.X) fmt.Println(c.Y + "will be granted:" + c.X) a := make([]string, 3) for i, _ := range a { wish := input.Ask(c.R + strconv.Itoa(i+1) + ". " + c.B3) a[i] = wish } fmt.Println(c.Y + "Your wishes have been saved." + c.X) fmt.Println(c.Y + "Type the word " + c.Cyan + "wishes" + c.Y + " to see or change your wishes.") return a }
func main() { fmt.Println(c.CL + c.Y + "Welcome to the magic eight ball.") fmt.Println("Enter your yes or no questions below:" + c.X) for { question := input.Ask("--> " + c.B3) if strings.Contains(question, "die") || strings.Contains(question, "death") { fmt.Println(c.Random() + "I don't deal in death." + c.X) } else if strings.Contains(question, "love") { fmt.Println(c.Random() + "I always get love wrong." + c.X) } else if strings.Contains(question, "kiss ma booty cheeks") { fmt.Println(c.Random() + "as a quote from mr.rob cut that crap off!" + c.X) } else { answer := choice.Strings(answers) fmt.Println(c.Random() + answer + c.X) } } }