PC Sorting Algorithm in Terraria

Programmatic

Steampunker
So I got bored and decided to make a sorting machine in Terraria. The device uses a sorting algorithm called "bubble sort," in which each item in a list is compared with the one before it, swapping them if they are out of order. The algorithm compares every pair of items before performing the entire process again, repeating until the list is fully sorted. Overall, bubble sort is actually one of the least efficient sorting algorithms, but, being one of the simplest, it wasn't too difficult to create a compact version in Terraria.

Here's an example of me using the device to sort the numbers 31 through 0 into the correct order (lists in completely reverse order are the slowest to process with bubble sort, so the process can't take any longer than this):


Also, here's the world file in case you want to test it yourself:
 

Attachments

  • Sort.wld
    48.6 KB · Views: 95
I don't really understand the video. What is it sorting and what do the colors mean?

The device is sorting an array of 32 binary numbers from least to greatest. By colors, I assume you mean the rainbow torches. Those are there to indicate the value of each binary number.
 
Back
Top Bottom