Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The mechanism of the stopping criterion in PHP #9

Open
dream-tentacle opened this issue Aug 15, 2024 · 1 comment
Open

The mechanism of the stopping criterion in PHP #9

dream-tentacle opened this issue Aug 15, 2024 · 1 comment

Comments

@dream-tentacle
Copy link

in the code, there are two variables: answer_previous_number_array and answer_previous_number_array2. What's their purpose? It is said in the code that "answer_this_number_check: check answer is correct or not." and "answer_this_hint: used for answer hint", but the former is added into answer_previous_number_array.
So, how does the sentence

if len(list(set(answer_previous_number_array[-min(len(answer_previous_number_array),  
    args.hint_length):]))) == 1 and count_this>=args.hint_length:
    break

work?

@chuanyang-Zheng
Copy link
Owner

chuanyang-Zheng commented Sep 1, 2024

Thank you very much for your question. The following is the response.

So, how does the sentence

if len(list(set(answer_previous_number_array[-min(len(answer_previous_number_array),  
    args.hint_length):]))) == 1 and count_this>=args.hint_length:
    break

count_this>=args.hint_length: iteration at least args.hint_length times. Usually, the iteration number is 2.
-min(len(answer_previous_number_array), args.hint_length): choose the smaller value between len(answer_previous_number_array) and args.hint_length. Usually, the smallest value is 2.

set(answer_previous_number_array[-min(len(answer_previous_number_array), args.hint_length):]): select the unique value from the last args.hint_length(usually it is 2) elements.

len(list(set(answer_previous_number_array[-min(len(answer_previous_number_array), args.hint_length):]))) == 1: if the length is 1, this suggests that the last args.hint_length elements are the same so that we finish the question.

If there is any further question, please let us know.

Again, thank you very much for your attention to our work, and wish you a good day.

Best regards,
Chuanyang

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants