Compare commits
2
Commits
8122eab5b4
...
c925f66e4d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c925f66e4d | ||
|
|
828c9190b1 |
@@ -25,13 +25,14 @@ declare -gr DOWN1=$'\e[1E'
|
|||||||
declare -gr INDENT=$'\e[1C'
|
declare -gr INDENT=$'\e[1C'
|
||||||
|
|
||||||
function main() {
|
function main() {
|
||||||
echo -en "${CLEAR_SCREEN}"
|
|
||||||
declare -g ANSWER
|
declare -g ANSWER
|
||||||
declare -g POOL='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
declare -g POOL='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
||||||
ANSWER=$(select_random_word)
|
ANSWER=$(select_random_word)
|
||||||
|
|
||||||
set_options "$@"
|
set_options "$@"
|
||||||
|
|
||||||
|
echo -en "${CLEAR_SCREEN}"
|
||||||
|
|
||||||
init_board
|
init_board
|
||||||
|
|
||||||
render_board
|
render_board
|
||||||
@@ -66,8 +67,9 @@ function set_options() {
|
|||||||
declare -g BORDER=1
|
declare -g BORDER=1
|
||||||
declare -g HARD_MODE=0
|
declare -g HARD_MODE=0
|
||||||
declare -g STRICT_HARD_MODE=0
|
declare -g STRICT_HARD_MODE=0
|
||||||
|
declare -g DELAY=0.5
|
||||||
|
|
||||||
while getopts "bw:HSh" OPT; do
|
while getopts "bw:HSdh" OPT; do
|
||||||
case "${OPT}" in
|
case "${OPT}" in
|
||||||
b)
|
b)
|
||||||
BORDER=0
|
BORDER=0
|
||||||
@@ -87,6 +89,9 @@ function set_options() {
|
|||||||
HARD_MODE=1
|
HARD_MODE=1
|
||||||
STRICT_HARD_MODE=1
|
STRICT_HARD_MODE=1
|
||||||
;;
|
;;
|
||||||
|
d)
|
||||||
|
DELAY=0
|
||||||
|
;;
|
||||||
h)
|
h)
|
||||||
echo -e "Usage: <program_name> [OPTIONS]
|
echo -e "Usage: <program_name> [OPTIONS]
|
||||||
Play a game for Wordle
|
Play a game for Wordle
|
||||||
@@ -250,7 +255,7 @@ function reveal_row() {
|
|||||||
echo -en "\e[${RNUM};${OFFSET}H"
|
echo -en "\e[${RNUM};${OFFSET}H"
|
||||||
for (( C=0; C<WIDTH; C++ )); do
|
for (( C=0; C<WIDTH; C++ )); do
|
||||||
echo -n "${BOARD[$1,$C]}"
|
echo -n "${BOARD[$1,$C]}"
|
||||||
read -r -s -t 0.5
|
read -r -s -t $DELAY
|
||||||
done
|
done
|
||||||
echo -en "${SHOW_CURSOR}"
|
echo -en "${SHOW_CURSOR}"
|
||||||
echo -en "${RESTORE}${UP1}"
|
echo -en "${RESTORE}${UP1}"
|
||||||
|
|||||||
Reference in new issue
Block a user