Compare commits

...
4 Commits
Author SHA1 Message Date
adam 005a129919 change help message format
Deploy game to server / deploy (push) Successful in 6s
2025-02-22 20:00:30 +00:00
adam bdb3d4e4d1 Move signal trap initialization after game mode questions - Prevent progress files after incorrect username 2025-02-22 19:41:46 +00:00
adam 6bbcc5229b save progress at start of a game 2025-02-22 19:38:06 +00:00
adam 4029c00edc remove $ where not needed 2025-02-22 19:22:45 +00:00
+10 -6
View File
@@ -50,6 +50,8 @@ function main() {
init_board
fi
[[ "${ONLINE}" == 1 ]] && save_game "NO_EXIT"
render_board
for (( ROW; ROW<HEIGHT; ROW++ )); do
@@ -137,7 +139,7 @@ function set_options() {
USER="${USER,,}"
declare -g DAY
DAY=$(( $EPOCHSECONDS / 86400 ))
DAY=$(( EPOCHSECONDS / 86400 ))
declare -gr PROGRESS_FILE=".${USER}-${DAY}.progress"
@@ -147,8 +149,6 @@ function set_options() {
declare -gr STATS_FILE="${USER}.stats"
trap save_game SIGINT
if [[ -f "${PROGRESS_FILE}" ]] && [[ -s "${PROGRESS_FILE}" ]]; then
load_game
RESUME=1
@@ -168,13 +168,17 @@ function set_options() {
[[ "${HM}" =~ ^[Yy]$ ]] && STRICT_HARD_MODE=1
fi
fi
trap save_game SIGINT
;;
d)
DELAY=0
;;
h)
echo -e "Usage: <program_name> [OPTIONS]
echo -e \
"Usage: <program_name> [OPTIONS]
Play a game for Wordle
Options:
-b Toggle borderless mode
-w Set target word
@@ -385,7 +389,7 @@ function save_game() {
} >> "${PROGRESS_FILE}"
echo -en "${RESET}"
exit 0
[[ -z $1 ]] && exit 0
}
function save_result() {
@@ -420,7 +424,7 @@ function update_stats() {
[[ $WIN == 5 ]] && SCORE="${GAME_HIST[$ROW]}"
[[ $WIN == 5 ]] && SCORE=$(( SCORE+1 ))
[[ $WIN == 5 ]] && GAME_HIST[$ROW]="${SCORE}"
[[ $WIN == 5 ]] && GAME_HIST[ROW]="${SCORE}"
[[ $WIN == 5 ]] && STREAK=$(( STREAK+1 ))
[[ $WIN != 5 ]] && STREAK=0