Mathematical distance rounding in pl-tts
This commit is contained in:
parent
742ab06b41
commit
05a2a1144c
1 changed files with 47 additions and 46 deletions
|
@ -7,13 +7,13 @@ preamble - [].
|
|||
|
||||
%% TURNS
|
||||
turn('left', ['skręć w lewo ']).
|
||||
turn('left_sh', ['ostro w lewo ']).
|
||||
turn('left_sl', ['lekko w lewo ']).
|
||||
turn('left_sh', ['skręć ostro w lewo ']).
|
||||
turn('left_sl', ['skręć lekko w lewo ']).
|
||||
turn('right', ['skręć w prawo ']).
|
||||
turn('right_sh', ['ostro w prawo ']).
|
||||
turn('right_sl', ['lekko w prawo ']).
|
||||
turn('right_sh', ['skręć ostro w prawo ']).
|
||||
turn('right_sl', ['skręć lekko w prawo ']).
|
||||
|
||||
prepare_turn(Turn, Dist) == ['Za ', D, ' ', M] :-
|
||||
prepare_turn(Turn, Dist) == ['Za ', D, M] :-
|
||||
distance(Dist) == D, turn(Turn, M).
|
||||
turn(Turn, Dist) == ['Za ', D, M] :-
|
||||
distance(Dist) == D, turn(Turn, M).
|
||||
|
@ -38,11 +38,11 @@ then == ['następnie '].
|
|||
reached_destination == ['Cel został osiągnięty! '].
|
||||
bear_right == ['trzymaj się prawej '].
|
||||
bear_left == ['trzymaj się lewej '].
|
||||
route_recalc(_Dist) == []. % ['Wyznaczam nową drogę ']. %nothing to said possibly beep?
|
||||
route_new_calc(Dist) == ['Odległość wynosi ', D] :- distance(Dist) == D. % nothing to said possibly beep?
|
||||
route_recalc(_Dist) == []. % ['Wyznaczam nową trasę ']. %nothing to said possibly beep?
|
||||
route_new_calc(Dist) == ['Długość trasy to ', D] :- distance(Dist) == D. % nothing to said possibly beep?
|
||||
|
||||
go_ahead(Dist) == ['Jedź tą drogą ', D]:- distance(Dist) == D.
|
||||
go_ahead == ['Jedź tą drogą '].
|
||||
go_ahead(Dist) == ['Jedź prosto ', D]:- distance(Dist) == D.
|
||||
go_ahead == ['Jedź prosto '].
|
||||
|
||||
%%
|
||||
nth(1, 'pierwszy ').
|
||||
|
@ -66,44 +66,45 @@ nth(17, 'siedemnasty ').
|
|||
|
||||
%%% distance measure
|
||||
distance(Dist) == T :- Dist < 1000, dist(Dist, F), append(F, ' metrów',T).
|
||||
dist(D, ['10 ']) :- D < 20, !.
|
||||
dist(D, ['20 ']) :- D < 30, !.
|
||||
dist(D, ['30 ']) :- D < 40, !.
|
||||
dist(D, ['40 ']) :- D < 50, !.
|
||||
dist(D, ['50 ']) :- D < 60, !.
|
||||
dist(D, ['60 ']) :- D < 70, !.
|
||||
dist(D, ['70 ']) :- D < 80, !.
|
||||
dist(D, ['80 ']) :- D < 90, !.
|
||||
dist(D, ['90 ']) :- D < 100, !.
|
||||
dist(D, ['100 ']) :- D < 150, !.
|
||||
dist(D, ['150 ']) :- D < 200, !.
|
||||
dist(D, ['200 ']) :- D < 250, !.
|
||||
dist(D, ['250 ']) :- D < 300, !.
|
||||
dist(D, ['300 ']) :- D < 350, !.
|
||||
dist(D, ['350 ']) :- D < 400, !.
|
||||
dist(D, ['400 ']) :- D < 450, !.
|
||||
dist(D, ['450 ']) :- D < 500, !.
|
||||
dist(D, ['500 ']) :- D < 550, !.
|
||||
dist(D, ['550 ']) :- D < 600, !.
|
||||
dist(D, ['600 ']) :- D < 650, !.
|
||||
dist(D, ['650 ']) :- D < 700, !.
|
||||
dist(D, ['700 ']) :- D < 750, !.
|
||||
dist(D, ['750 ']) :- D < 800, !.
|
||||
dist(D, ['800 ']) :- D < 850, !.
|
||||
dist(D, ['850 ']) :- D < 900, !.
|
||||
dist(D, ['900 ']) :- D < 950, !.
|
||||
dist(D, ['950 ']) :- !.
|
||||
dist(D, ['10 ']) :- D < 15, !.
|
||||
dist(D, ['20 ']) :- D < 25, !.
|
||||
dist(D, ['30 ']) :- D < 35, !.
|
||||
dist(D, ['40 ']) :- D < 45, !.
|
||||
dist(D, ['50 ']) :- D < 55, !.
|
||||
dist(D, ['60 ']) :- D < 65, !.
|
||||
dist(D, ['70 ']) :- D < 75, !.
|
||||
dist(D, ['80 ']) :- D < 85, !.
|
||||
dist(D, ['90 ']) :- D < 95, !.
|
||||
dist(D, ['100 ']) :- D < 125, !.
|
||||
dist(D, ['150 ']) :- D < 175, !.
|
||||
dist(D, ['200 ']) :- D < 225, !.
|
||||
dist(D, ['250 ']) :- D < 275, !.
|
||||
dist(D, ['300 ']) :- D < 325, !.
|
||||
dist(D, ['350 ']) :- D < 375, !.
|
||||
dist(D, ['400 ']) :- D < 425, !.
|
||||
dist(D, ['450 ']) :- D < 475, !.
|
||||
dist(D, ['500 ']) :- D < 525, !.
|
||||
dist(D, ['550 ']) :- D < 575, !.
|
||||
dist(D, ['600 ']) :- D < 625, !.
|
||||
dist(D, ['650 ']) :- D < 675, !.
|
||||
dist(D, ['700 ']) :- D < 725, !.
|
||||
dist(D, ['750 ']) :- D < 775, !.
|
||||
dist(D, ['800 ']) :- D < 825, !.
|
||||
dist(D, ['850 ']) :- D < 875, !.
|
||||
dist(D, ['900 ']) :- D < 925, !.
|
||||
dist(D, ['950 ']) :- D < 975, !.
|
||||
dist(D, ['1000 ']) :- !.
|
||||
|
||||
distance(Dist) == ['ponad jeden kilometr '] :- Dist < 1500.
|
||||
distance(Dist) == ['ponad dwa kilometry '] :- Dist < 3000.
|
||||
distance(Dist) == ['ponad trzy kilometry '] :- Dist < 4000.
|
||||
distance(Dist) == ['ponad cztery kilometry '] :- Dist < 5000.
|
||||
distance(Dist) == ['ponad pięć kilometrów '] :- Dist < 6000.
|
||||
distance(Dist) == ['ponad sześć kilometrów '] :- Dist < 7000.
|
||||
distance(Dist) == ['ponad siedem kilometrów '] :- Dist < 8000.
|
||||
distance(Dist) == ['ponad osiem kilometrów '] :- Dist < 9000.
|
||||
distance(Dist) == ['ponad dziewięć kilometrów '] :- Dist < 10000.
|
||||
distance(Dist) == ['ponad ', X, ' kilometrów '] :- D is Dist/1000, dist(D, X).
|
||||
distance(Dist) == ['około jeden kilometr '] :- Dist < 1500.
|
||||
distance(Dist) == ['około dwa kilometry '] :- Dist < 2500.
|
||||
distance(Dist) == ['około trzy kilometry '] :- Dist < 3500.
|
||||
distance(Dist) == ['około cztery kilometry '] :- Dist < 4500.
|
||||
distance(Dist) == ['około pięć kilometrów '] :- Dist < 5500.
|
||||
distance(Dist) == ['około sześć kilometrów '] :- Dist < 6500.
|
||||
distance(Dist) == ['około siedem kilometrów '] :- Dist < 7500.
|
||||
distance(Dist) == ['około osiem kilometrów '] :- Dist < 8500.
|
||||
distance(Dist) == ['około dziewięć kilometrów '] :- Dist < 9500.
|
||||
distance(Dist) == ['około ', X, ' kilometrów '] :- D is Dist/1000, dist(D, X).
|
||||
|
||||
%% resolve command main method
|
||||
%% if you are familar with Prolog you can input specific to the whole mechanism,
|
||||
|
|
Loading…
Reference in a new issue