From 6b07093d68551d38cae5b5e4ca4976a756285cfc Mon Sep 17 00:00:00 2001 From: adam Date: Tue, 29 Sep 2026 17:32:28 +0000 Subject: [PATCH] write the same answer line to both board files On a loss the answer line was written to RESULT_FILE with the border indent and bold, but CUR_RESULT_FILE only got the letters. Move the answer line into render_answer and use it for the terminal and both files. Co-Authored-By: Claude Opus 5.5 --- wordle | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/wordle b/wordle index 1332835..7c353a5 100755 --- a/wordle +++ b/wordle @@ -83,12 +83,7 @@ function main() { fi done - [[ "${BORDER}" == 1 ]] && echo -en "${CLEAR_DOWN}${INDENT}${INDENT}" - echo -en "${CLEAR_LINE}${BOLD}" - for (( i=0; i curl \"${URL_BASE}/${RESULT_FILE}\"" @@ -243,6 +238,15 @@ function render_board() { [[ "${BORDER}" == 1 ]] && echo -e "└─────────────────┘" } +function render_answer() { + [[ "${BORDER}" == 1 ]] && echo -en "${CLEAR_DOWN}${INDENT}${INDENT}" + echo -en "${CLEAR_LINE}${BOLD}" + for (( i=0; i "${RESULT_FILE}" render_board > "${CUR_RESULT_FILE}" if [[ $WIN != 5 ]]; then - [[ "${BORDER}" == 1 ]] && echo -en "${CLEAR_DOWN}${INDENT}${INDENT}" >> "${RESULT_FILE}" - echo -en "${CLEAR_LINE}${BOLD}" >> "${RESULT_FILE}" - for (( i=0; i> "${RESULT_FILE}" - echo -en " ${ANSWER:$i:1} " >> "${CUR_RESULT_FILE}" - done - echo -en "${NEWLINE}${RESET}" >> "${RESULT_FILE}" - echo -en "${NEWLINE}${RESET}" >> "${CUR_RESULT_FILE}" + render_answer >> "${RESULT_FILE}" + render_answer >> "${CUR_RESULT_FILE}" fi fi echo 'PLAYED=1' > "${PROGRESS_FILE}"