Skip to content

Instantly share code, notes, and snippets.

@Sea-n
Created February 20, 2023 15:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sea-n/63d67f15ec240f4a829a5a4648effbaf to your computer and use it in GitHub Desktop.
Save Sea-n/63d67f15ec240f4a829a5a4648effbaf to your computer and use it in GitHub Desktop.
French number practice
#!/usr/bin/env bash
set -Eeuo pipefail
cd "$(dirname "$0")" || exit 1
main() {
while true; do
ans="$((16#$(openssl rand -hex 4) % 101))"
echo -n " > "
say -v Thomas "$ans"
say -v Amélie "$ans"
read -r guess
while [[ "$guess" != "$ans" ]]; do
echo -n "Try again > "
say -v Amélie "C'est $ans, pas $guess"
say -v Thomas "$((ans - 1)), $ans, $((ans + 1))"
read -r guess
done
done
}
main "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment