This project is about "sorting", that is reordering a list of values. Reordering is done by animating some metal balls and two magnets. Click on the "basic" button. This will show several metal balls and two magnets below them. Then press SPACE. The magnets will start moving under the metal balls, as described in the script of the "sorter" sprite. This will (slowly) reorder the balls so that the smallest one will be at the left-hand side and the largest one at the right-hand side. Reordering of values (called "sorting") is a very common task in computer science Instructions: 1- click green flag to start 2- select the algorithm by clicking the corresponding button (only BASIC SORT for now) 3- put stepping and comments to 0/1 to disable/enable step-by-step execution and to show speech bubbles that comment each step 4- change the speed to speed up the animation (best below 70) 5- when the two balls on the magnets are green this means that they are in the correct (that is smaller-to-bigger) order. On the contrary, if they are red, they are in the wrong order. 6- look at the final number of comparisons and swaps By using the available BROADCAST shown in the "documentation" sprite you can create new sorting algorithms, for example "insertion sorting" or "bubble sorting". You can the compare the different algorithms by looking at the final number of comparisons and swaps.
version 1.0.2 several glitches fixed version 1.0.1 With this project you can look at how different sorting algorithms work and develop your own. Features: - selection of the sorting algorithm (only basic sort implemented for now) - run without interruption or single stepping - hide/show comments - keep track of the total number of needed comparisons and swaps The projects is designed as a library of scripts of the Sorter, Magnets and Balls sprites. You can experiment with different strategies for sorting by getting and putting back metal balls by using two magnets. You have: - scripts to move magnets and get/put back balls - scripts and global variables to show instructions and comments - scripts and global variables to check for balls on magnets and positions of magnets - scripts to select random balls (manual setting of ball's size coming soon) and show balls on the stage To create a new algorithm just add the new algorithm to the Sorter sprite and duplicate the "basic" sprite to create a new button (or use the dummy buttons already present). Documentation available in the Documentation sprite.