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 <noreply@anthropic.com>
This commit is contained in:
1 parent
a3f9ae6a17
commit
6b07093d68
1 file changed
+12
-14
@@ -83,12 +83,7 @@ function main() {
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
[[ "${BORDER}" == 1 ]] && echo -en "${CLEAR_DOWN}${INDENT}${INDENT}"
|
render_answer
|
||||||
echo -en "${CLEAR_LINE}${BOLD}"
|
|
||||||
for (( i=0; i<WIDTH; i++ )); do
|
|
||||||
echo -en " ${ANSWER:$i:1} "
|
|
||||||
done
|
|
||||||
echo -en "${NEWLINE}${RESET}"
|
|
||||||
|
|
||||||
if [[ "${ONLINE}" == 1 && "${DAILY_DONE}" != 1 ]]; then
|
if [[ "${ONLINE}" == 1 && "${DAILY_DONE}" != 1 ]]; then
|
||||||
echo "Share/view your game with -> curl \"${URL_BASE}/${RESULT_FILE}\""
|
echo "Share/view your game with -> curl \"${URL_BASE}/${RESULT_FILE}\""
|
||||||
@@ -243,6 +238,15 @@ function render_board() {
|
|||||||
[[ "${BORDER}" == 1 ]] && echo -e "└─────────────────┘"
|
[[ "${BORDER}" == 1 ]] && echo -e "└─────────────────┘"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function render_answer() {
|
||||||
|
[[ "${BORDER}" == 1 ]] && echo -en "${CLEAR_DOWN}${INDENT}${INDENT}"
|
||||||
|
echo -en "${CLEAR_LINE}${BOLD}"
|
||||||
|
for (( i=0; i<WIDTH; i++ )); do
|
||||||
|
echo -en " ${ANSWER:$i:1} "
|
||||||
|
done
|
||||||
|
echo -en "${NEWLINE}${RESET}"
|
||||||
|
}
|
||||||
|
|
||||||
# Exits non-zero at end of input (Ctrl-D) so the caller can quit
|
# Exits non-zero at end of input (Ctrl-D) so the caller can quit
|
||||||
function retrieve_guess() {
|
function retrieve_guess() {
|
||||||
if [[ -n $1 ]]; then
|
if [[ -n $1 ]]; then
|
||||||
@@ -443,14 +447,8 @@ function save_result() {
|
|||||||
render_board > "${RESULT_FILE}"
|
render_board > "${RESULT_FILE}"
|
||||||
render_board > "${CUR_RESULT_FILE}"
|
render_board > "${CUR_RESULT_FILE}"
|
||||||
if [[ $WIN != 5 ]]; then
|
if [[ $WIN != 5 ]]; then
|
||||||
[[ "${BORDER}" == 1 ]] && echo -en "${CLEAR_DOWN}${INDENT}${INDENT}" >> "${RESULT_FILE}"
|
render_answer >> "${RESULT_FILE}"
|
||||||
echo -en "${CLEAR_LINE}${BOLD}" >> "${RESULT_FILE}"
|
render_answer >> "${CUR_RESULT_FILE}"
|
||||||
for (( i=0; i<WIDTH; i++ )); do
|
|
||||||
echo -en " ${ANSWER:$i:1} " >> "${RESULT_FILE}"
|
|
||||||
echo -en " ${ANSWER:$i:1} " >> "${CUR_RESULT_FILE}"
|
|
||||||
done
|
|
||||||
echo -en "${NEWLINE}${RESET}" >> "${RESULT_FILE}"
|
|
||||||
echo -en "${NEWLINE}${RESET}" >> "${CUR_RESULT_FILE}"
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
echo 'PLAYED=1' > "${PROGRESS_FILE}"
|
echo 'PLAYED=1' > "${PROGRESS_FILE}"
|
||||||
|
|||||||
Reference in new issue
Block a user