vaendryl / Sunrider

source code of the visual novel 'Sunrider'
http://sunrider-vn.com/
41 stars 21 forks source link

Timsort BM.ships. #34

Closed renpytom closed 10 years ago

renpytom commented 10 years ago

This replaces the bubble sort used by sort_ship_list with Python's built-in sort, Timsort. Bubble sort is O(n^2) worst case, while timsort is O(n lg n) worst case.

Also, since list.sort() is implemented in C, it should be faster than the pure-python version of sort_ship_list.

EnderShadow commented 10 years ago

I think Nne is supposed to be None

renpytom commented 10 years ago

That's true. I didn't get a chance to test this code. (The basic outline should be right, however.)

EnderShadow commented 10 years ago

If you make a new commit with the change it should update this pull request automatically

vaendryl commented 10 years ago

that sure looks a lot simpler than researching bubblesort algorithms >.<