Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
This is a brilliant solution Lonkero. The automatic rounding that KiXtart is apparently doing when the Interger is compared to a floating point number in "until $=$b" is a dream solution for removing the need for two inequalities.
The initialization of $b=0.5 so that the total song time is increased by half a minute makes your sizing correct when the rounding is done.
{edit} See below: this is not an accurate analysis. I still have a reservation about
code:
if $b<$ $x = split($w,",") endif
because the "$" is rescoped to be the count of songs and not the original media length after the 1st execution of the loop. If there were 50 one minute songs then "$" would be greater than the 49 minutes after the second loop and the array would reinitialize and you would be stuck in an infinite loop. But this does not seem to be a problem for the data provided.
If you would like to check here is some data for the 13th CD. kixgolf_cd.ini quote: [CD13] Title=Lonkero's Test Songs=1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1. 0,1.0,1.0,1.0,1.0,1.0,1.0
kixgolf_cd_results.ini quote: [CD13] Songs=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45
Excellent job!
{edit} The above code causes an infinite loop but not for the reason stated. It appears that the rescoped "$" falls out of scope until the next DIM statement. When the loop restarts "$" again is equal to 45.
The even minute songs have a problem with the auto-rounding feature.
Here is the loop evaluting the IF condition.
code:
50.5<45 49.5<45 48.5<45 47.5<45 46.5<45 45.5<45 This does not exit the until $=$b (45=46) 44.5<45 reset array
[ 17. March 2003, 17:23: Message edited by: Howard Bullock ]
|