Problems with Counterbalancing using Pavlovia Shelf

I’ve made a new version of this code so it now works locally as well as online, and is designed to starts with an empty list on the shelf.

Allocate Group code | try it | discussion thread

An alternative to the counterbalance routine which stores a list on the shelf (with one more entry than the number of groups). The first entry is used to count the number of sessions started. Each participant is allocated randomly to a group with no more than 2 more than the current stored minimum number of allocations. Allocations are stored in End Experiment or End Routine of the final routine, depending on whether you want to include participants with incomplete results. This method is not suitable if most of your participants are likely to start the study at the same time. This code now works locally as well as online, and is designed to starts with an empty list on the shelf.
Morys-Carter, W. L. (2026, April 21). Allocate Group [Computer software]. Pavlovia. https://gitlab.pavlovia.org/vespr/allocate-group