08-04-2020, Wednesday-12:05:28  
		
	
	
		prototyper.nut
Warum ist max_speed in der Ausgabe negativ?
	
	
	
Warum ist max_speed in der Ausgabe negativ?
Zitat:planned_convoy.length 8
wt 3
plan station
evaluate this candidate: 1153046759
valuate: (function : 0x0B985C60)
... length = 8
... max_speed = -727379968
... min_top_speed = 10817536
convoy length: 8
... length = 19
... max_speed = -727379968
... min_top_speed = 2926049
convoy length: 19
... length = 8
... max_speed = -727379968
... min_top_speed = 5354425
convoy length: 8
vehicle found: Seeschiff_Fracht_1882
vehicle found: Schubeinheit
vehicle found: Schlepper
max_length: 24
CARUNITS_PER_TILE: 16
Code:
...
//             print("Test[" + ind + "] = " + test.get_name())
            // append
            cnv[ind] = cnv[ind-1].append(test, freight)
            local c = cnv[ind]
//             local ccc = ["weight","power","min_top_speed","max_speed","length","missing_freight","capacity","maintenance","price","running_cost"]
//             foreach(key in ccc) print(" ... " + key + " = " + c[key] )
            // check constraints
            // .. length
            local l = (ind > 1 ?  cnv[ind-1].length : 0) + max( CARUNITS_PER_TILE/2, test.get_length()); 
            //gui.add_message_at(our_player, "convoy length max: " + max( CARUNITS_PER_TILE/2, test.get_length()), test)
            //max_vehicles  
      if ( wt == wt_water ) {
        a = 16 * 4
      } 
      else if ( wt == wt_rail ) {
        a = 16 * 3
      }
      else {
        a = 16
      } 
            if (l > a ) { //) {  max_length   CARUNITS_PER_TILE
                continue;
            }
            // .. more ??
            gui.add_message_at(our_player, "convoy length: " + l, world.get_time())
             local ccc = ["min_top_speed","max_speed","length"]
             foreach(key in ccc) gui.add_message_at(our_player," ... " + key + " = " + c[key], world.get_time())
            // check if convoy finished
            if (test.can_be_last() &&  !c.missing_freight  &&  c.min_top_speed >= min_speed) {
                // evaluate this candidate
                    gui.add_message_at(our_player, "valuate: " + valuate, world.get_time())
                if (valuate) {
                    local value = valuate.call(getroottable(), c)
//                     print(" === " + value)
                    gui.add_message_at(our_player, "evaluate this candidate: " + value, world.get_time())
                    if (best==null  ||  value > best_value) {
                        best = c
                        best_value = value  
                    } 
                }
....
Script-KI für Simutrans r10894+ / Simutrans Nightly Builds
	
	

 
 

 
