[Include] Top Players
#11

Quote:
Originally Posted by Y_Less
Посмотреть сообщение
I do like the concept of this - too few people use sorting instead of naive searching to get the top whatever. In fact that's what I assumed would have been done when I saw the topic simply because that's what most people do, I was pleasantly surprised!

Having said that, there are a few bugs:

Most notably, this relies too much on global state. Say you start calling "t_FeedInfo", then before calling "t_GetPlayer", you call one of my functions for some reason (to get more data on something). Then I use your include to sort some data and return the result, now when you call "t_GetPlayer" all the data is wrong and corrupted.

Not a bug, but you might want to consider sorting the data and setting a flag. When "t_FeedInfo" is called set the flag to false. When "t_GetPlayer" is called check the flag - if it's true the data is already sorted and you can use it. If it is false then sort the data, set the flag to true, and return your result.

Also, you might want to look in to Slice's sort include, which uses a very efficient implementation of QuickSort for exactly this sort of task.
It should how so ever not happen for the reason that the data is copied into temporary variables (from backup of it) before getting sorted.

I tested it out again with script : http://pastebin.com/4t4EVnaW

you may see that I commented out all the (IsPlayerConnected) as I tested it through the main with no players actually connected.

In future upgrades, if I get free to do after exams I am thinking to modify include a lot and sort it only once instead of sorting again and again and shall be using quick sort.
Reply


Messages In This Thread
Top Players - by [MM]RoXoR[FS] - 21.07.2012, 14:26
Re: Top Players - by Spookie98 - 21.07.2012, 14:51
Re: Top Players - by [MM]RoXoR[FS] - 21.07.2012, 15:31
Re: Top Players - by Finn - 21.07.2012, 15:39
Re: Top Players - by Ronaldo_raul™ - 21.07.2012, 16:02
Re: Top Players - by Gangs_Rocks - 21.09.2012, 08:30
Re: Top Players - by DeadLy™ - 21.09.2012, 10:00
Re: Top Players - by Q_Lite - 21.09.2012, 11:05
Re: Top Players - by [MM]RoXoR[FS] - 25.09.2012, 10:15
Re: Top Players - by Slice - 25.09.2012, 11:59
Re: Top Players - by [MM]RoXoR[FS] - 26.09.2012, 14:59
Re: Top Players - by [MM]RoXoR[FS] - 29.09.2012, 13:27
Re: Top Players - by Guest4390857394857 - 17.02.2014, 11:41
Re: Top Players - by fiki574 - 17.02.2014, 19:20
Re: Top Players - by CODRWW - 17.02.2014, 19:27
Re: Top Players - by Guest4390857394857 - 18.02.2014, 11:34

Forum Jump:


Users browsing this thread: 2 Guest(s)