Corrections projet
This commit is contained in:
@@ -66,13 +66,15 @@ let
|
||||
false);
|
||||
tel
|
||||
|
||||
(* The car angle with the road should be in the range -120..120 degree *)
|
||||
node wrong_dir(ph : phase) returns (wrong : bool)
|
||||
var data : map_data; error : float; ang : float;
|
||||
var data : map_data; norm, error : float; ang : float;
|
||||
let
|
||||
data = lookup_phase(ph);
|
||||
ang = ph.ph_head *. (pi /. 180.0);
|
||||
norm = Mathext.sqrt(data.dir_x *. data.dir_x +. data.dir_y *. data.dir_y);
|
||||
error = data.dir_x *. Mathext.cos(ang) +. data.dir_y *. Mathext.sin(ang);
|
||||
wrong = error <. -. 0.5;
|
||||
wrong = error <. -. 0.5 *. norm;
|
||||
tel
|
||||
|
||||
fun aggregate_events(lightRun, speedExcess, exitRoad, collisionEvent,
|
||||
@@ -188,7 +190,7 @@ tel
|
||||
(* Scoring *)
|
||||
|
||||
node scoringA(e : event; rstatus : status) returns (score : int)
|
||||
var penalty : int; collision_count : int;
|
||||
var penalty : int;
|
||||
let
|
||||
score = (10000 fby score)
|
||||
+ if Utilities.rising_edge(rstatus = Arrived) then 1000 else 0
|
||||
@@ -198,9 +200,7 @@ let
|
||||
+ (if e.speedExcess then -2 else 0)
|
||||
+ (if Utilities.rising_edge(e.exitRoad) then -5000 else 0)
|
||||
+ (if Utilities.rising_edge(e.dirEvent) then -2000 else 0)
|
||||
+ (if collision_count = 0 then -500 else 0)
|
||||
+ (if collision_count < 0 then 10 else 0);
|
||||
collision_count = Utilities.countdown(not e.collisionEvent, 20);
|
||||
+ (if Utilities.rising_edge(e.collisionEvent) then -500 else 0);
|
||||
tel
|
||||
|
||||
node scoringB(ph : phase) returns (score : int)
|
||||
|
||||
Reference in New Issue
Block a user