MADE ALL BY ME This is a sorting algorithm (KickSort) How It Works: The algorithm scans through the list. If a number is larger than the one after it, it gets saved as prevn, removed from its position, and added just after the smaller number — kicking it forward. This “forward kick” helps smaller numbers bubble their way toward the front. A swap counter keeps track of how many changes were made. Controls: Click the S key to start sorting and to start the timer. Click the A key to stop the timer Press Space to generate a new random list.
Free code: when (S) key pressed set ('timer') to (0) set ('i') to (1) set ('prevn') to (NAN) set ('comparisons') to (0) custom block: 'sort' define 'sort' start repeat (length of (list)) ~~If <item ((i))+(1)) of (list) < item (('i')) of (list)> set 'prevn' item (('i')) of (list) wait (0.1) delete (('i')) of list wait (0.1) add (('prevn')) to (list) change (('comparisons')) by (1) wait (0.1) change (('swaps')) by (1) ~~end if change ((i)) by (1) end repeat custom block: 'sort' List generator: when (space) key pressed stop (other scripts in sprite) set ('swaps') to (0) delete (all) of (list) start repeat (5) add (pick random (1) to (20)) to (list)