Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

"Evaluate on first cycle" - simple explanation needed.

Hi

I am building a course about Open Sesame for Graduate students without background in programming or building experiments.

I realized that I can't simplify the idea of "Evaluate on first cycle".

I read the explanation in the documentation area. Stil, I cannot find a simple enough example to explain "evaluate on first cycle" when explaining about loops for the first time.

For example, what exactly does it evaluate?

Thanks for reading,

Tali

Comments

  • Hi Tali,

    It is about the run_if statement. The evaluate on first cycle option determines whether the run if field is evaluated on the first iteration, or only on later ones. The reason for that is that it allows to use variables in the run if field that are only created in the loop. If you would tick that box, and use a variable that doesnt exist at the outset of the loop, the experiment would crash. If you use a variable that does exist, (and its value should in theory escape the loop), it will not break the loop on the first iteration.

    I hope this makes sense?

    Eduard

    Buy Me A Coffee

  • Hi @labovich,

    My understanding is that the "Evaluate on the first cycle" option determines when the 'break-if' statement (a condition that can stop the loop prematurely) is evaluated during a loop sequence If this option is selected, the 'break-if' statement is evaluated before the first cycle begins. This means that if the 'break-if' condition is met, no cycles of the loop may be executed at all. If the option is not selected, the 'break-if' statement is evaluated only before the second cycle begins, which guarantees that at least one cycle of the loop is always executed, even if the 'break-if' condition is met during that first cycle. Best thing is that you try it out to check this is indeed the case.

    Best,

    Fabrice.

    Buy Me A Coffee

  • Thanks Eduard and Fabrice! I think I'm still looking for a simple example that I can show - one that, as Fabrice mentioned, checking or unchecking the box will cause the experiment to crush, but with a very simple design (this is a very basic course)

  • FabFab
    edited June 2023

    Hi @labovich,

    In attach two examples.

    In the first, particiants can press S ahead of a loop to determine whether trials in the loop will be run or not.

    If you leave "Evaluate on first cycle" unchecked, then even if you press S before the loop beging, the first trial will be presented and the break if condition will only work on the second cycle (and so the loop will stop). If you check "Evaluate on first cycle", then it will evaluate the break if condition before the first trial of the loop runs and so if the subject pressed S, the loop will be interrupted before the first trial is presented. So in this example, nothing crashes, but the outcome varies.

    In the second example, digits come up and the subject should pres the corresponding digit or S to stop and exit the loop.

    In this case, the loop will break if [response] is S. The problem is that no response is actually gathered in this task until the first trial in the sequence has been executed. Hence, if you evaluate the "break if" condition on th first cycle, the task will seek to determine whether something that does not exist yet is equal to "S", and so the task will crash.

    If you untick the "Evaluate on first cycle" in this case, the task will ruin the first trial and if the subject pressed S in that trial, then the loop will stop.

    Hope this helps!

    Fabrice.

    Buy Me A Coffee

  • Thank you so much!!!!!!!

Sign In or Register to comment.