Skip to content
TheChatArchiveThe Chat Archive
gpt-4.1-2025-04-14· OpenAIHugging Face LMArena Human Preference 140K

Create a progress indicator using ANSI characters for use in a CLI Go application. Be…

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Claudeclaude-3-5-haiku-20241022’s answer.
  1. User

    Create a progress indicator using ANSI characters for use in a CLI Go application. Be creative.

  2. Assistant

    Absolutely! Here’s a creative progress indicator for your Go CLI app: a rocket launch that "flies" across the terminal as progress increases, leaving a colorful trail behind.


    package main
    
    import (
    	"fmt"
    	"strings"
    	"time"
    )
    
    const (
    	reset      = "\x1b[0m"
    	red        = "\x1b[31m"
    	yellow     = "\x1b[33m"
    	blue       = "\x1b[34m"
    	white      = "\x1b[97m"
    	hideCursor = "\x1b[?25l"
    	showCursor = "\x1b[?25h"
    )
    
    func rocketProgress(current, total, width int) {
    	if total == 0 {
    		return
    	}
    	percent := float64(current) / float64(total)
    	pos := int(percent * float64(width-2)) // -2 for rocket and finish flag
    
    	// Rocket emoji and finish flag
    	rocket := red + "🚀" + reset
    	flag := yellow + "🏁" + reset
    
    	// Trail: alternate between blue and white for a "flame" effect
    	trail := ""
    	for i := 0; i < pos; i++ {
    		if i%2 == 0 {
    			trail += blue + "~" + reset
    		} else {
    			trail += white + "~" + reset
    		}
    	}
    
    	// Pad the rest with spaces
    	empty := strings.Repeat(" ", width-pos-2)
    
    	bar := fmt.Sprintf("[%s%s%s%s%s] %3.0f%%",
    		trail, rocket, empty, flag, reset, percent*100)
    
    	fmt.Printf("\r%s", bar)
    }
    
    func main() {
    	fmt.Print(hideCursor)
    	defer fmt.Print(showCursor)
    
    	width := 40
    	total := 100
    
    	fmt.Println("Rocket Launch Progress:")
    	for i := 0; i <= total; i++ {
    		rocketProgress(i, total, width)
    		time.Sleep(40 * time.Millisecond)
    	}
    	fmt.Println("\nLiftoff complete!")
    }
    

    How it works:

    • The rocket 🚀 "flies" from left to right, leaving a wavy, colored trail.
    • The finish line 🏁 appears at the end.
    • The bar is animated and colorful, using ANSI codes for color and cursor control.

    To run:
    Save as rocket.go and run with go run rocket.go in your terminal.


    Let me know if you want another creative style! 🚀

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.