Created
August 22, 2023 01:52
-
-
Save rpearce/9f5d364d47209081ce2b6521e2e91183 to your computer and use it in GitHub Desktop.
Gift for my friend, Len
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -o errexit | |
set -o errtrace | |
set -o nounset | |
set -eou pipefail | |
# ============================================================================== | |
function clearscreen { | |
printf '\033c' | |
} | |
# ============================================================================== | |
function print_welcome { | |
cat <<EOF | |
┌─────────────────────────┐ | |
│ │ | |
│ Welcome to │ | |
│ │ | |
│ Len's │ | |
│ │ | |
│ Silly Challenge! │ | |
│ │ | |
└─────────────────────────┘ | |
EOF | |
} | |
function print_overview { | |
cat <<EOF | |
┌───────────────────────────┐ | |
│ │ | |
│ You will be given │ | |
│ │ | |
│ THREE │ | |
│ │ | |
│ (obscure) │ | |
│ │ | |
│ questions about │ | |
│ │ | |
│ ¡GOLF! │ | |
│ │ | |
│ that you must answer │ | |
│ │ | |
│ to unlock... │ | |
│ │ | |
└───────────────────────────┘ | |
EOF | |
} | |
function print_gift_preview { | |
echo " ___ ___ ___ ___ "; | |
echo " ___ /__/\ / /\ / /\ ___ / /\ ___ "; | |
echo " / /\ \ \:\ / /:/_ / /:/_ / /\ / /:/_ / /\ "; | |
echo " / /:/ \__\:\ / /:/ /\ / /:/ /\ / /:/ / /:/ /\ / /:/ "; | |
echo " / /:/ ___ / /::\ / /:/ /:/_ / /:/_/::\ /__/::\ / /:/ /:/ / /:/ "; | |
echo " / /::\ /__/\ /:/\:\ /__/:/ /:/ /\ /__/:/__\/\:\ \__\/\:\__ /__/:/ /:/ / /::\ "; | |
echo " /__/:/\:\ \ \:\/:/__\/ \ \:\/:/ /:/ \ \:\ /~~/:/ \ \:\/\ \ \:\/:/ /__/:/\:\ "; | |
echo " \__\/ \:\ \ \::/ \ \::/ /:/ \ \:\ /:/ \__\::/ \ \::/ \__\/ \:\ "; | |
echo " \ \:\ \ \:\ \ \:\/:/ \ \:\/:/ /__/:/ \ \:\ \ \:\\"; | |
echo " \__\/ \ \:\ \ \::/ \ \::/ \__\/ \ \:\ \__\/"; | |
echo " \__\/ \__\/ \__\/ \__\/ "; | |
} | |
# ============================================================================== | |
function run_q1 { | |
local msg="${1-}" | |
clearscreen | |
print_q1 | |
if [ -n "$msg" ]; then | |
echo "$msg" | |
fi | |
read -erp "> " answer | |
if [ "$answer" = "Condor" ] || [ "$answer" = "condor" ]; then | |
echo "" | |
print_q1_success | |
else | |
run_q1 "(Please try again)" | |
fi | |
} | |
function print_q1 { | |
cat <<EOF | |
┌──────────────────────────────────────┐ | |
│ │ | |
│ Q1: What do you call a hole in 1 │ | |
│ on a par 5? (One word) │ | |
│ │ | |
└──────────────────────────────────────┘ | |
EOF | |
} | |
function print_q1_success { | |
cat <<EOF | |
┌────────────────┐ | |
│ │ | |
│ Great Job! │ | |
│ │ | |
└────────────────┘ | |
EOF | |
read -erp "(Press return to continue)" _ | |
} | |
# ============================================================================== | |
function run_q2 { | |
local msg="${1-}" | |
clearscreen | |
print_q2 | |
if [ -n "$msg" ]; then | |
echo "$msg" | |
fi | |
read -erp "> " answer | |
if [ "$answer" = "1457" ]; then | |
echo "" | |
print_q2_success | |
else | |
run_q2 "(Please try again)" | |
fi | |
} | |
function print_q2 { | |
cat <<EOF | |
┌───────────────────────────────────────────────────┐ | |
│ │ | |
│ Q2: When was golf first mentioned in history? │ | |
│ │ | |
└───────────────────────────────────────────────────┘ | |
EOF | |
} | |
function print_q2_success { | |
cat <<EOF | |
┌────────────────────┐ | |
│ │ | |
│ Wow! You rock! │ | |
│ │ | |
└────────────────────┘ | |
EOF | |
read -erp "(Press return to continue)" _ | |
} | |
# ============================================================================== | |
function run_q3 { | |
local msg="${1-}" | |
clearscreen | |
print_q3 | |
if [ -n "$msg" ]; then | |
echo "$msg" | |
fi | |
read -erp "> " answer | |
if [ "$answer" = "Feathers" ] || [ "$answer" = "feathers" ]; then | |
echo "" | |
print_q3_success | |
else | |
run_q3 "(Please try again)" | |
fi | |
} | |
function print_q3 { | |
cat <<EOF | |
┌────────────────────────────────────────────┐ | |
│ │ | |
│ Q3: Golf balls were originally made of │ | |
│ leather and what other substance? │ | |
│ │ | |
└────────────────────────────────────────────┘ | |
EOF | |
} | |
function print_q3_success { | |
cat <<EOF | |
┌──────────────────────┐ | |
│ │ | |
│ Amazing! How did │ | |
│ │ | |
│ you know that?!? │ | |
│ │ | |
└──────────────────────┘ | |
EOF | |
read -erp "(Press return to continue)" _ | |
} | |
# ============================================================================== | |
function print_gift { | |
cat <<EOF | |
┌────────────────────────────────────────────────────────┐ | |
│ │ | |
│ You have earned \$75 to spend how you like, but I │ | |
│ │ | |
│ recommend ordering your favorite food and relaxing │ | |
│ │ | |
│ with your girls. │ | |
│ │ | |
│ │ | |
│ │ | |
│ Message me "I made par" to let me know to Venmo! │ | |
│ │ | |
│ │ | |
│ │ | |
│ Hope you're having a great day, │ | |
│ │ | |
│ ██████╗ ██████╗ ██████╗ ███████╗██████╗ ████████╗ │ | |
│ ██╔══██╗██╔═══██╗██╔══██╗██╔════╝██╔══██╗╚══██╔══╝ │ | |
│ ██████╔╝██║ ██║██████╔╝█████╗ ██████╔╝ ██║ │ | |
│ ██╔══██╗██║ ██║██╔══██╗██╔══╝ ██╔══██╗ ██║ │ | |
│ ██║ ██║╚██████╔╝██████╔╝███████╗██║ ██║ ██║ │ | |
│ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝ ╚═╝ │ | |
│ │ | |
│ │ | |
└────────────────────────────────────────────────────────┘ | |
EOF | |
} | |
# ============================================================================== | |
function main { | |
clearscreen | |
print_welcome | |
read -erp "(Press return to continue)" _ | |
clearscreen | |
print_overview | |
read -erp "(Press return to continue)" _ | |
print_gift_preview | |
read -erp "(Press return to be tested)" _ | |
run_q1 | |
run_q2 | |
run_q3 | |
clearscreen | |
print_gift | |
read -erp "(Press return to go to a Ted Lasso GIF)" _ | |
open https://gifdb.com/images/high/ted-lasso-high-five-01z3yguvu4vlrthk.gif | |
} | |
main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's how to run this!
Terminal.app
application on your Mac and make it full screen (holdcommand
&option
and click the green button in the top left)