diff options
| author | alex <aletu130@student.liu.se> | 2019-11-22 15:56:46 +0100 |
|---|---|---|
| committer | alex <aletu130@student.liu.se> | 2019-11-22 15:56:46 +0100 |
| commit | 9ed366cbce18b58df5f880e92e008c3906c93378 (patch) | |
| tree | 55fd3976ec65dd093998615c007d9e67e0ffdf0f /Kod/bilbana | |
| parent | 4e4073b4c12370d162b489757e51977eeab08b8a (diff) | |
| download | tfyy51-9ed366cbce18b58df5f880e92e008c3906c93378.tar.gz | |
Anpassade koden för att hantera trasiga givare. Kan dock inte hantera
'spöksignaler'.
Diffstat (limited to 'Kod/bilbana')
| -rw-r--r-- | Kod/bilbana/yc4/do_car.m | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Kod/bilbana/yc4/do_car.m b/Kod/bilbana/yc4/do_car.m index 7b7ebfd..26f9131 100644 --- a/Kod/bilbana/yc4/do_car.m +++ b/Kod/bilbana/yc4/do_car.m @@ -30,6 +30,14 @@ stop - Huruvida koden ska stoppas eller inte stop = false; if car.running == true [car.new_lap, car.new_check_point, car.time] = get_car_position(car.num); + %% KOMPENSERA FÖR TRASIG BANA + [car1new_lap, car1new_check_point, ~] = get_car_position(1); + if car1new_lap && (car1new_check_point || car1new_check_point) + car.new_lap = 0; + elseif car1new_lap + car.new_lap = 1; + end + %% if car.new_check_point == true && rand < car.miss_probability && car.lap >= 4 disp('Hoppar �ver givare'); car.new_check_point = false; @@ -118,6 +126,7 @@ if car.running == true %% NEW LAP if car.new_lap == true + disp('NEW LAP') car.lap_constants = gov_set(car.constant); car.new_lap = false; %TODO remove beep; |
