diff options
| author | alex <aletu130@student.liu.se> | 2019-10-20 14:32:08 +0200 |
|---|---|---|
| committer | alex <aletu130@student.liu.se> | 2019-10-20 14:32:08 +0200 |
| commit | 1111d306f96fbe7d1608e1eaa156680fd5b21ecf (patch) | |
| tree | 961fc7e4eb7946a385e0dac66bb109a24715fea8 /Kod/bilbana/yc4 | |
| parent | 2e7e0e16cd6585a75f7c61272c000161ca3f0a0c (diff) | |
| download | tfyy51-1111d306f96fbe7d1608e1eaa156680fd5b21ecf.tar.gz | |
Implementera freeze_david
Diffstat (limited to 'Kod/bilbana/yc4')
| -rw-r--r-- | Kod/bilbana/yc4/main.m | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/Kod/bilbana/yc4/main.m b/Kod/bilbana/yc4/main.m index be0e3e8..2512faf 100644 --- a/Kod/bilbana/yc4/main.m +++ b/Kod/bilbana/yc4/main.m @@ -15,9 +15,7 @@ start_race(2) car1 = struct; car1.segment = 1; car1.lap = 0; - car1.lap_times = []; - car1.seg_times = []; car2 = struct; @@ -30,6 +28,7 @@ tocs = []; %% MAIN LOOP while 1 + tic; %% PRE-LOOP if strcmp(get(hf,'currentcharacter'),'q') close(hf) @@ -47,7 +46,7 @@ while 1 if car1.new_check_point == true % beep; if car1.lap ~= 0 - car1.seg_times(car1.lap, car1.segment) = toc(car1.seg_tic); % TODO + car1.seg_times(car1.lap, car1.segment) = toc(car1.seg_tic); end car1.segment = car1.segment + 1; car1.seg_tic = tic; @@ -61,9 +60,9 @@ while 1 car1.lap_tic = tic; continue; end - car1.seg_times(car1.lap, car1.segment) = toc(car1.seg_tic); % TODO + car1.seg_times(car1.lap, car1.segment) = toc(car1.seg_tic); car1.seg_tic = tic; - car1.lap_times(car1.lap) = toc(car1.lap_tic); % TODO + car1.lap_times(car1.lap) = toc(car1.lap_tic); car1.lap_tic = tic; car1.segment = 1; car1.lap = car1.lap + 1; @@ -73,12 +72,12 @@ while 1 if car2.new_check_point == true % beep; if car2.lap ~= 0 - car2.seg_times(car2.lap, car2.segment) = toc(car2.seg_tic); % TODO + car2.seg_times(car2.lap, car2.segment) = toc(car2.seg_tic); end car2.segment = car2.segment + 1; car2.seg_tic = tic; elseif car2.new_lap == true - % beep; + beep; if car2.lap == 0 % dont save time for first lap car2.segment = 1; @@ -87,9 +86,9 @@ while 1 car2.lap_tic = tic; continue; end - car2.seg_times(car2.lap, car2.segment) = toc(car2.seg_tic); % TODO + car2.seg_times(car2.lap, car2.segment) = toc(car2.seg_tic); car2.seg_tic = tic; - car2.lap_times(car2.lap) = toc(car2.lap_tic); % TODO + car2.lap_times(car2.lap) = toc(car2.lap_tic); car2.lap_tic = tic; car2.segment = 1; car2.lap = car2.lap + 1; @@ -114,9 +113,8 @@ while 1 %% DISPLAY %% END OF LOOP - tocs(end + 1) = toc; pause(0.1) - tic; + tocs(end + 1) = toc; end %% END OF PROGRAM |
