Re: bgt, sorting number array from least to gratest
Re: bgt, sorting number array from least to gratest Agreed with @12. Radix sort is a non-comparison algorithm, which is perfect for what you're trying to do. It's able to sort in O(N) time, where N is the number of characters in your string. You're dealing with small numbers, so this isn't particularly inefficient. You can't get any better than O(N * Log of N) for any sorting algorithm, so this is second-best.Sorting algs can be fun to analyze. For your purposes, I'd take the Radix sort approach. URL: https://forum.audiogames.net/post/470378/#p470378 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: bgt, sorting number array from least to gratest
Re: bgt, sorting number array from least to gratest Yeah. I'm more confused as to you the array is a set of strings. I don't know BGT myself (and I don't plan on learning it due to its discontinuation), but what you could do (if BGT supports this), is to first create that array using ints instead of Strings. This way, you could loop through the array, and sort via that. Then, if you needed to change it back to strings, you could maybe create a toString method. URL: https://forum.audiogames.net/post/470374/#p470374 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: bgt, sorting number array from least to gratest
Re: bgt, sorting number array from least to gratest you could write a radix sort and this could work for both numbers and strings. Unless there is a specific reason that you have things as strings. Radix sorting is not fast though. URL: https://forum.audiogames.net/post/470369/#p470369 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: bgt, sorting number array from least to gratest
2019-10-24
Thread
AudioGames . net Forum — Developers room : philip_bennefall via Audiogames-reflector
Re: bgt, sorting number array from least to gratest Be careful with doubles. They are not exact, they are approximate. Not all decimal numbers can be represented in a double, so you will get rounding errors etc. Use integers when you have no decimals, and use floats and doubles when you need decimals.Kind regards,Philip Bennefall URL: https://forum.audiogames.net/post/470337/#p470337 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: bgt, sorting number array from least to gratest
Re: bgt, sorting number array from least to gratest Doubles are for decimals. If you store a decimal in an integer, I believe it gets rounded internally. Doubles lift that restriction. URL: https://forum.audiogames.net/post/470299/#p470299 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: bgt, sorting number array from least to gratest
Re: bgt, sorting number array from least to gratest @8 I'm dumb. I have always thought arrays needed to be declared as string[]. LolThat worked, thanks. One more question, this goes for both arrays and standard variables. When is it best to use double versus int? Isn't double just allowing twice the number of values than int? URL: https://forum.audiogames.net/post/470293/#p470293 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: bgt, sorting number array from least to gratest
Re: bgt, sorting number array from least to gratest @8 I'm dumb. I have always thought arrays needed to be declared as string[]. Lol URL: https://forum.audiogames.net/post/470293/#p470293 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: bgt, sorting number array from least to gratest
Re: bgt, sorting number array from least to gratest @op, why is that second array there?I would do something like this:uint j; file f; string[] array; int index=0; double[] numarray; void main() { //open existing values f.open("test.txt","r"); array=string_split(f.read(),"\n",false); f.close(); //convert string values to integers for(uint j=0;j URL: https://forum.audiogames.net/post/470265/#p470265 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: bgt, sorting number array from least to gratest
2019-10-23
Thread
AudioGames . net Forum — Developers room : ashleygrobler04 via Audiogames-reflector
Re: bgt, sorting number array from least to gratest not the last time i tried, i took a list of names (strings) and it sorted them alphabeticly URL: https://forum.audiogames.net/post/470245/#p470245 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: bgt, sorting number array from least to gratest
Re: bgt, sorting number array from least to gratest Nope, not quite. In this scenario, python's sort method would produce similar results to that of BGT since the items are strings. You'd still have to change the items to ints. URL: https://forum.audiogames.net/post/470243/#p470243 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: bgt, sorting number array from least to gratest
Re: bgt, sorting number array from least to gratest Just use python, takes all the computer sciency shit out of the work. just list.sort() and done. URL: https://forum.audiogames.net/post/470238/#p470238 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: bgt, sorting number array from least to gratest
Re: bgt, sorting number array from least to gratest Hi. Here is the code I attempted. It did not work.uint j;file f;string[] array;int index=0;string[] numarray;void main(){//open existing valuesf.open("test.txt","r");array=string_split(f.read(),"\n",false);f.close();//convert string values to integersfor(uint j=0;j {index=string_to_number(array[j]);numarray.insert_last(index);}//reorder values from least to greatestnumarray.sort_ascending();for(uint j=0;j alert("value", numarray[j]);} URL: https://forum.audiogames.net/post/470235/#p470235 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: bgt, sorting number array from least to gratest
Re: bgt, sorting number array from least to gratest I seem to remember writing a BGT implementation of Quicksort, but I do not remember why. If you take a CS class, Array sorting will get entire lessons. Bubble Sort, Insertion Sort (simplest imo but slow), merge sort, and Quicksort are some of the best known. Quicksort is quickest, but kinda complicated, so if I can find my implementation, I might just post it. (Or you could look up an example in C or something, and work out how to port it, but then you'd have to understand the way references work in the language of choice.). URL: https://forum.audiogames.net/post/470234/#p470234 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: bgt, sorting number array from least to gratest
2019-10-23
Thread
AudioGames . net Forum — Developers room : ashleygrobler04 via Audiogames-reflector
Re: bgt, sorting number array from least to gratest Hi there, if you had python, you could just use list.soort i think. how ever, i don't know how to check this with BGT, maby some one else could help you out. URL: https://forum.audiogames.net/post/470231/#p470231 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
Re: bgt, sorting number array from least to gratest
2019-10-23
Thread
AudioGames . net Forum — Developers room : philip_bennefall via Audiogames-reflector
Re: bgt, sorting number array from least to gratest That's what you get if you sort strings. You need to get it into an array of integers, or an array of classes where you overload the comparison operators using the opCmp method.Kind regards,Philip Bennefall URL: https://forum.audiogames.net/post/470232/#p470232 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
bgt, sorting number array from least to gratest
bgt, sorting number array from least to gratest the value 1 comes before 1100 because it checks character by character instead of the whole number. And the value 500 comes after both 1 and 1100. Is there any easy way to sort it correctly? URL: https://forum.audiogames.net/post/470230/#p470230 -- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector