How to Shuffle a List: различия между версиями

Материал из Поле цифровой дидактики
м (1 версия импортирована)
 
Строка 1: Строка 1:
{{stub|date=March 2022}}
 
{{Wiki Standards|Not explicitly written what the script does and needs a lot more explanation|date=March 2022}}<!--it is not clear what the code does -->
This tutorial explains how to shuffle some items in a [[list]].
This tutorial explains how to shuffle some items in a [[list]].


Строка 65: Строка 64:
set [shuffle is v] to (item (1) of [shuffle between v])
set [shuffle is v] to (item (1) of [shuffle between v])
</scratchblocks>
</scratchblocks>
[[Category:Scripting Tutorials]]
[[Category:Scripting Tutorials]]

Текущая версия на 11:24, 9 августа 2022

This tutorial explains how to shuffle some items in a list.

Variables

itemthathaditspositionshuffled#ofitemthatisbeingshuffledshuffleisrepeatitemsthatalreadyhadtheirpositionsshuffledshufflebetween


Full Code

whenclickedsetshuffledistodeleteallofitemsthatalreadyhadtheirpositionsshuffleddeleteallofshufflebetweenaskHowmanyitemsdoyouwanttobeshuffled?andwaitsetrepeattoanswerrepeatrepeataskInputanitemtobeshuffled:andwaitaddanswertoshufflebetweenendrepeatlengthofshufflebetweenset#ofitemthatisbeingshuffledtopickrandom1tolengthofshufflebetweenrepeatuntilnotitemsthatalreadyhadtheirpositionsshuffledcontainsitem#ofitemthatisbeingshuffledofshufflebetweenset#ofitemthatisbeingshuffledtopickrandom1tolengthofshufflebetweenendsetitemthathaditspositionshuffledtoitem#ofitemthatisbeingshuffledofshufflebetweendeleteitem#ofitemthathaditspositionshuffledinshufflebetweenofshufflebetweeninsertitemthathaditspositionshuffledatpickrandom1tolengthofshufflebetween+1ofshufflebetweenadditemthathaditspositionshuffledtoitemsthatalreadyhadtheirpositionsshuffledendsetshuffleistoitem1ofshufflebetween