Friday, December 19, 2025

Horoscope

When I was looking for fun stuff to do with linux debian, The Gemini AI mentioned about cowsay + fortune.  It gave me idea, instead of random quote, how about making a fortune cookie?

It was basically the same thing.  Because unlike to what I believe,  fortune cookie gives wisdom advice not really a fortune telling. So no. I don't want it, I want it to tell me my horoscope, even if it is scripted.  The thing is, my horoscope sign would never change, so I got inspired by Alice in Borderland season 3.  How about it measures the luck to small, medium, and big luck?  
Like a horoscope, there are health, wealth and romance, so every component will have some score and the total decide the size of the luck.

So here is the script:
!/bin/bash

# --- HELPER FUNCTION: DRAW STARS ---
# This function takes a number (1-5) and prints a star bar
# Example: Input 3 -> Output "★ ★ ★ "
get_star_bar() {
    local count=$1
    local bar=""
    for ((i=1; i<=count; i++)); do
        bar+="★ "
    done
    echo "$bar"
}

# --- THE ROLL ---
# Generate numbers between 1 and 5 for each component
romance=$(( ( RANDOM % 5 ) + 1 ))
wealth=$(( ( RANDOM % 5 ) + 1 ))
health=$(( ( RANDOM % 5 ) + 1 ))

# Calculate the total score
total_score=$(( romance + wealth + health ))

# --- THE DISPLAY ---
clear
echo "🔮 GAZING INTO THE CRYSTAL BALL..."
sleep 1
echo ""

echo "   -------------------------------"
echo -e "   💖 ROMANCE : \033[1;35m$(get_star_bar $romance)\033[0m" # Purple
sleep 0.5
echo -e "   💰 WEALTH  : \033[1;33m$(get_star_bar $wealth)\033[0m"  # Yellow
sleep 0.5
echo -e "   🌿 HEALTH  : \033[1;32m$(get_star_bar $health)\033[0m"  # Green
echo "   -------------------------------"
echo ""
sleep 0.5

# --- THE VERDICT ---
echo -n "   CALCULATING DESTINY..."
sleep 1
echo -e "\r                          \r" # Clear line

# Logic based on total score (Min 3, Max 15)
if [ $total_score -eq 15 ]; then
    # GREAT LUCK (Total 15)
    title="🌟 YOU HAVE GREAT LUCK! 🌟"
    color="\033[1;33m" # Bold Yellow
    art=$(cat << "EOF"
   [ PLACEHOLDER: GREAT LUCK ART ]
         \o/  \o/  \o/
          |    |    |
         / \  / \  / \
EOF
)

elif [ $total_score -ge 11 ] && [ $total_score -le 14 ]; then
    # GOOD LUCK (Total 11-14)
    title="✨ GOOD LUCK ✨"
    color="\033[1;36m" # Cyan
    art=$(cat << "EOF"
   [ PLACEHOLDER: GOOD LUCK ART ]
           \o/
            |
           / \
EOF
)

elif [ $total_score -ge 6 ] && [ $total_score -le 10 ]; then
    # MEDIUM LUCK (Total 6-10)
    title="🌥️ MEDIUM LUCK 🌥️"
    color="\033[1;34m" # Blue
    art=$(cat << "EOF"
   [ PLACEHOLDER: MEDIUM LUCK ART ]
            o
           /|\
           / \
EOF
)

elif [ $total_score -ge 1 ] && [ $total_score -le 5 ]; then
    # SMALL LUCK (Total 1-5)
    title="🍃 SMALL LUCK 🍃"
    color="\033[0;37m" # Grey
    art=$(cat << "EOF"
   [ PLACEHOLDER: SMALL LUCK ART ]
           _
          ( )
           |
EOF
)

elif [ $total_score -eq 0 ]; then
    # BAD LUCK (Total 0 - Very rare/Impossible with standard 1-5 dice)
    title="⛈️ BAD LUCK ⛈️"
    color="\033[1;31m" # Red
    art=$(cat << "EOF"
   [ PLACEHOLDER: BAD LUCK ART ]
          /!\
         (>_<)
EOF
)
else
    # Fallback
    title="🔮 MYSTERIOUS FATE 🔮"
    color="\033[0m"
    art="   [ ? ]"
fi

# --- PRINT RESULT ---
echo -e "${color}"
echo "$art"
echo ""
echo "   $title"
echo -e "\033[0m" # Reset
echo ""


AI is very helpful in creating script like this but not so good in creating ASCII art, somehow the machine doesn't understand how to generate image from text using text again.  It's illogical for AI to translate series of character as limb, and the same character as part of the head. So I asked the AI to make placeholder for the ASCII art and making the ASCII art by myself.  The shell script from Gemini is using emoticon that doesn't work on this version of linux so you can delete and replaced it.

It would be cool if I know the kanji just like in Japanese' s fortune paper, but I don't, so I put pictures of my dog, Jembross.  It would make more sense with a picture of cat (Manekineko), but no, I like my dog.



No comments: