The problem with not being rewarded for the last try comes from the flow of the code:
Code:
begin_loop
read_guess
if_guesses_gt_max_exit
check_guess
if_correct_exit
end_loop
so on the last loop you're reading in the guess, then deciding that actually, they're not entitled to another guess. Check entitlement first:
Code:
begin_loop
if_guesses_gt_max_exit
read_guess
check_guess
if_correct_exit
end_loop
or:
Code:
loop_for_10_guesses
read_guess
check_guess
if_correct_exit_0
end_loop
tell_gamer_that_they've_lost
exit_1