correct recorded voice templates (Issue 858)
This commit is contained in:
parent
b507b5cdec
commit
3ab295b2b8
5 changed files with 263 additions and 295 deletions
|
@ -1,7 +1,6 @@
|
|||
:- op('==', xfy, 500).
|
||||
version(0).
|
||||
|
||||
|
||||
% before each announcement (beep)
|
||||
preamble - [].
|
||||
|
||||
|
@ -14,37 +13,33 @@ turn('right', ['turn.ogg', 'right-e.ogg']).
|
|||
turn('right_sh', ['sharp_right-e.ogg']).
|
||||
turn('right_sl', ['turn.ogg', 'right-e.ogg']).
|
||||
|
||||
prepare_turn(Turn, Dist) == ['Prepare_to-a.ogg', 'after-m.ogg', delay_450, D, delay_450, M] :-
|
||||
distance(Dist) == D, turn(Turn, M).
|
||||
turn(Turn, Dist) == ['after-m.ogg', delay_250, D, delay_250, M] :-
|
||||
distance(Dist) == D, turn(Turn, M).
|
||||
prepare_turn(Turn, Dist) == ['Prepare_to-a.ogg', 'after-m.ogg', delay_450, D, delay_450, M] :- distance(Dist) == D, turn(Turn, M).
|
||||
turn(Turn, Dist) == ['after-m.ogg', delay_250, D, delay_250, M] :- distance(Dist) == D, turn(Turn, M).
|
||||
turn(Turn) == M :- turn(Turn, M).
|
||||
|
||||
|
||||
prepare_make_ut(Dist) == ['Prepare_to-a.ogg', 'after-m.ogg', delay_300, D, delay_300,'turn_back-e.ogg'] :-
|
||||
distance(Dist) == D.
|
||||
|
||||
prepare_roundabout(Dist) == ['prepare_to-enter.ogg', 'after-m.ogg', delay_300, D] :-
|
||||
distance(Dist) == D.
|
||||
|
||||
make_ut(Dist) == ['after-m.ogg', delay_300, D, delay_300, 'turn_back-e.ogg'] :-
|
||||
distance(Dist) == D.
|
||||
prepare_make_ut(Dist) == ['Prepare_to-a.ogg', 'after-m.ogg', delay_300, D, delay_300,'turn_back-e.ogg'] :- distance(Dist) == D.
|
||||
make_ut(Dist) == ['after-m.ogg', delay_300, D, delay_300, 'turn_back-e.ogg'] :- distance(Dist) == D.
|
||||
make_ut == ['turn_back-e.ogg'].
|
||||
|
||||
roundabout(Dist, _Angle, Exit) == ['after-m.ogg', delay_300, D, delay_300, 'enter_the_roundabout-e.ogg', delay_250, 'and_take.ogg',
|
||||
delay_250, E, 'exit-e.ogg'] :- distance(Dist) == D, nth(Exit, E).
|
||||
prepare_roundabout(Dist) == ['prepare_to-enter.ogg', 'after-m.ogg', delay_300, D] :- distance(Dist) == D.
|
||||
roundabout(Dist, _Angle, Exit) == ['after-m.ogg', delay_300, D, delay_300, 'enter_the_roundabout-e.ogg', delay_250, 'and_take.ogg', delay_250, E, 'exit-e.ogg'] :- distance(Dist) == D, nth(Exit, E).
|
||||
roundabout(_Angle, Exit) == ['taking.ogg', delay_250, E, 'exit-e.ogg'] :- nth(Exit, E).
|
||||
|
||||
and_arrive_destination == ['arrive_at_your_destination-e.ogg']. % Miss and?
|
||||
go_ahead == ['continue_straight-e.ogg'].
|
||||
go_ahead(Dist) == ['follow-the-road-for.ogg', delay_250, D]:- distance(Dist) == D.
|
||||
|
||||
and_arrive_destination == ['arrive_at_your_destination-e.ogg'].
|
||||
|
||||
then == ['then.ogg', delay_350].
|
||||
reached_destination == ['you_have_reached_your_destination.ogg'].
|
||||
reached_destination == ['you_have_reached_your_destination-e.ogg'].
|
||||
bear_right == ['keep_right-e.ogg'].
|
||||
bear_left == ['keep_left-e.ogg'].
|
||||
route_recalc(_Dist) == []. % ['recalc.ogg']. %nothing to said possibly beep?
|
||||
route_new_calc(Dist) == ['the_trip_is_more_than.ogg', delay_150, D] :- distance(Dist) == D. % nothing to said possibly beep?
|
||||
|
||||
go_ahead(Dist) == ['drive_for-h.ogg', delay_250, D]:- distance(Dist) == D.
|
||||
go_ahead == ['continue_straight-e.ogg'].
|
||||
route_new_calc(Dist) == ['the_trip_is_about.ogg', delay_150, D] :- distance(Dist) == D.
|
||||
route_recalc(Dist) == ['recalc.ogg', delay_300, 'distance.ogg', delay_150, D]:- distance(Dist) == D.
|
||||
|
||||
location_lost == ['gps_signal_lost.ogg'].
|
||||
|
||||
|
||||
%%
|
||||
nth(1, '1st.ogg').
|
||||
|
@ -68,46 +63,45 @@ nth(17, '17th.ogg').
|
|||
|
||||
%%% distance measure
|
||||
distance(Dist) == T :- Dist < 1000, dist(Dist, F), append(F, 'meters-e.ogg',T).
|
||||
dist(D, ['10.ogg']) :- D < 20, !.
|
||||
dist(D, ['20.ogg']) :- D < 30, !.
|
||||
dist(D, ['30.ogg']) :- D < 40, !.
|
||||
dist(D, ['40.ogg']) :- D < 50, !.
|
||||
dist(D, ['50.ogg']) :- D < 60, !.
|
||||
dist(D, ['60.ogg']) :- D < 70, !.
|
||||
dist(D, ['70.ogg']) :- D < 80, !.
|
||||
dist(D, ['80.ogg']) :- D < 90, !.
|
||||
dist(D, ['90.ogg']) :- D < 100, !.
|
||||
dist(D, ['100.ogg']) :- D < 150, !.
|
||||
dist(D, ['100_and.ogg', '50.ogg']) :- D < 200, !.
|
||||
dist(D, ['200.ogg']) :- D < 250, !.
|
||||
dist(D, ['200_and.ogg', '50.ogg']) :- D < 300, !.
|
||||
dist(D, ['300.ogg']) :- D < 350, !.
|
||||
dist(D, ['300_and.ogg', '50.ogg']) :- D < 400, !.
|
||||
dist(D, ['400.ogg']) :- D < 450, !.
|
||||
dist(D, ['400_and.ogg', '50.ogg']) :- D < 500, !.
|
||||
dist(D, ['500.ogg']) :- D < 550, !.
|
||||
dist(D, ['500_and.ogg', '50.ogg']) :- D < 600, !.
|
||||
dist(D, ['600.ogg']) :- D < 650, !.
|
||||
dist(D, ['600_and.ogg', '50.ogg']) :- D < 700, !.
|
||||
dist(D, ['700.ogg']) :- D < 750, !.
|
||||
dist(D, ['700_and.ogg', '50.ogg']) :- D < 800, !.
|
||||
dist(D, ['800.ogg']) :- D < 850, !.
|
||||
dist(D, ['800_and.ogg', '50.ogg']) :- D < 900, !.
|
||||
dist(D, ['900.ogg']) :- D < 950, !.
|
||||
dist(D, ['10.ogg']) :- D < 15, !.
|
||||
dist(D, ['20.ogg']) :- D < 25, !.
|
||||
dist(D, ['30.ogg']) :- D < 35, !.
|
||||
dist(D, ['40.ogg']) :- D < 45, !.
|
||||
dist(D, ['50.ogg']) :- D < 55, !.
|
||||
dist(D, ['60.ogg']) :- D < 65, !.
|
||||
dist(D, ['70.ogg']) :- D < 75, !.
|
||||
dist(D, ['80.ogg']) :- D < 85, !.
|
||||
dist(D, ['90.ogg']) :- D < 95, !.
|
||||
dist(D, ['100.ogg']) :- D < 125, !.
|
||||
dist(D, ['100_and.ogg', '50.ogg']) :- D < 175, !.
|
||||
dist(D, ['200.ogg']) :- D < 225, !.
|
||||
dist(D, ['200_and.ogg', '50.ogg']) :- D < 275, !.
|
||||
dist(D, ['300.ogg']) :- D < 325, !.
|
||||
dist(D, ['300_and.ogg', '50.ogg']) :- D < 375, !.
|
||||
dist(D, ['400.ogg']) :- D < 425, !.
|
||||
dist(D, ['400_and.ogg', '50.ogg']) :- D < 475, !.
|
||||
dist(D, ['500.ogg']) :- D < 525, !.
|
||||
dist(D, ['500_and.ogg', '50.ogg']) :- D < 575, !.
|
||||
dist(D, ['600.ogg']) :- D < 625, !.
|
||||
dist(D, ['600_and.ogg', '50.ogg']) :- D < 675, !.
|
||||
dist(D, ['700.ogg']) :- D < 725, !.
|
||||
dist(D, ['700_and.ogg', '50.ogg']) :- D < 775, !.
|
||||
dist(D, ['800.ogg']) :- D < 825, !.
|
||||
dist(D, ['800_and.ogg', '50.ogg']) :- D < 875, !.
|
||||
dist(D, ['900.ogg']) :- D < 925, !.
|
||||
dist(D, ['900_and.ogg', '50.ogg']) :- !.
|
||||
|
||||
|
||||
distance(Dist) == ['more_than.ogg', '1.ogg', 'kilometer-e.ogg'] :- Dist < 1500.
|
||||
distance(Dist) == ['more_than.ogg', '2.ogg', 'kilometers-e.ogg'] :- Dist < 3000.
|
||||
distance(Dist) == ['more_than.ogg', '3.ogg', 'kilometers-e.ogg'] :- Dist < 4000.
|
||||
distance(Dist) == ['more_than.ogg', '4.ogg', 'kilometers-e.ogg'] :- Dist < 5000.
|
||||
distance(Dist) == ['more_than.ogg', '5.ogg', 'kilometers-e.ogg'] :- Dist < 6000.
|
||||
distance(Dist) == ['more_than.ogg', '6.ogg', 'kilometers-e.ogg'] :- Dist < 7000.
|
||||
distance(Dist) == ['more_than.ogg', '7.ogg', 'kilometers-e.ogg'] :- Dist < 8000.
|
||||
distance(Dist) == ['more_than.ogg', '8.ogg', 'kilometers-e.ogg'] :- Dist < 9000.
|
||||
distance(Dist) == ['more_than.ogg', '9.ogg', 'kilometers-e.ogg'] :- Dist < 10000.
|
||||
distance(Dist) == ['more_than.ogg', X, 'kilometers-e.ogg'] :- D is Dist/1000, dist(D, X).
|
||||
|
||||
distance(Dist) == ['about.ogg', '1.ogg', 'kilometer-e.ogg'] :- Dist < 1500.
|
||||
distance(Dist) == ['about.ogg', '2.ogg', 'kilometers-e.ogg'] :- Dist < 2500.
|
||||
distance(Dist) == ['about.ogg', '3.ogg', 'kilometers-e.ogg'] :- Dist < 3500.
|
||||
distance(Dist) == ['about.ogg', '4.ogg', 'kilometers-e.ogg'] :- Dist < 4500.
|
||||
distance(Dist) == ['about.ogg', '5.ogg', 'kilometers-e.ogg'] :- Dist < 5500.
|
||||
distance(Dist) == ['about.ogg', '6.ogg', 'kilometers-e.ogg'] :- Dist < 6500.
|
||||
distance(Dist) == ['about.ogg', '7.ogg', 'kilometers-e.ogg'] :- Dist < 7500.
|
||||
distance(Dist) == ['about.ogg', '8.ogg', 'kilometers-e.ogg'] :- Dist < 8500.
|
||||
distance(Dist) == ['about.ogg', '9.ogg', 'kilometers-e.ogg'] :- Dist < 9500.
|
||||
distance(Dist) == [X, 'kilometers-e.ogg'] :- D is Dist/1000, dist(D, X).
|
||||
|
||||
|
||||
%% resolve command main method
|
||||
|
@ -115,8 +109,7 @@ distance(Dist) == ['more_than.ogg', X, 'kilometers-e.ogg'] :- D is Dist/1000, di
|
|||
%% by adding exception cases.
|
||||
flatten(X, Y) :- flatten(X, [], Y), !.
|
||||
flatten([], Acc, Acc).
|
||||
flatten([X|Y], Acc, Res):-
|
||||
flatten(Y, Acc, R), flatten(X, R, Res).
|
||||
flatten([X|Y], Acc, Res):- flatten(Y, Acc, R), flatten(X, R, Res).
|
||||
flatten(X, Acc, [X|Acc]).
|
||||
|
||||
resolve(X, Y) :- resolve_impl(X,Z), flatten(Z, Y).
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
:- op('==', xfy, 500).
|
||||
version(0).
|
||||
|
||||
|
||||
% before each announcement (beep)
|
||||
preamble - [].
|
||||
|
||||
|
@ -14,37 +13,34 @@ turn('right', ['giro_a.ogg', 'derecha.ogg']).
|
|||
turn('right_sh', ['giro_fuerte.ogg', 'derecha.ogg']).
|
||||
turn('right_sl', ['giro_leve.ogg', 'derecha.ogg']).
|
||||
|
||||
prepare_turn(Turn, Dist) == ['despues_de.ogg', delay_450, D,'prepararse_para.ogg', delay_450, M] :-
|
||||
distance(Dist) == D, turn(Turn, M).
|
||||
turn(Turn, Dist) == ['despues_de.ogg', delay_250, D, delay_250, M] :-
|
||||
distance(Dist) == D, turn(Turn, M).
|
||||
prepare_turn(Turn, Dist) == ['despues_de.ogg', delay_450, D,'prepararse_para.ogg', delay_450, M] :- distance(Dist) == D, turn(Turn, M).
|
||||
turn(Turn, Dist) == ['despues_de.ogg', delay_250, D, delay_250, M] :- distance(Dist) == D, turn(Turn, M).
|
||||
turn(Turn) == M :- turn(Turn, M).
|
||||
|
||||
|
||||
prepare_make_ut(Dist) == [ 'despues_de.ogg', delay_300, D,'prepararse_para.ogg', delay_300,'giro_en_u.ogg'] :-
|
||||
distance(Dist) == D.
|
||||
|
||||
prepare_roundabout(Dist) == [ 'despues_de.ogg', delay_300, D,'prepara_entrar.ogg'] :-
|
||||
distance(Dist) == D.
|
||||
|
||||
make_ut(Dist) == ['despues_de.ogg', delay_300, D, delay_300, 'giro_en_u.ogg'] :-
|
||||
distance(Dist) == D.
|
||||
prepare_make_ut(Dist) == [ 'despues_de.ogg', delay_300, D,'prepararse_para.ogg', delay_300,'giro_en_u.ogg'] :- distance(Dist) == D.
|
||||
make_ut(Dist) == ['despues_de.ogg', delay_300, D, delay_300, 'giro_en_u.ogg'] :- distance(Dist) == D.
|
||||
make_ut == ['giro_en_u.ogg'].
|
||||
|
||||
prepare_roundabout(Dist) == [ 'despues_de.ogg', delay_300, D,'prepara_entrar.ogg'] :- distance(Dist) == D.
|
||||
roundabout(Dist, _Angle, Exit) == ['despues_de.ogg', delay_300, D, delay_300, 'entrar_glorieta.ogg', delay_250, 'y_tomar.ogg',
|
||||
delay_250, E, 'salida.ogg'] :- distance(Dist) == D, nth(Exit, E).
|
||||
delay_250, E, 'salida.ogg'] :- distance(Dist) == D, nth(Exit, E).
|
||||
roundabout(_Angle, Exit) == ['tomando la.ogg', delay_250, E, 'salida.ogg'] :- nth(Exit, E).
|
||||
|
||||
and_arrive_destination == ['destino.ogg']. % Miss and?
|
||||
go_ahead == ['siga.ogg'].
|
||||
go_ahead(Dist) == ['siga_por.ogg', delay_250, D]:- distance(Dist) == D.
|
||||
|
||||
and_arrive_destination == ['destino.ogg'].
|
||||
|
||||
then == ['entonces.ogg', delay_350].
|
||||
reached_destination == ['llegado.ogg'].
|
||||
bear_right == ['mantener_derecha.ogg'].
|
||||
bear_left == ['mantener_izquierda.ogg'].
|
||||
route_recalc(_Dist) == []. % ['recalcular.ogg']. %nothing to said possibly beep?
|
||||
route_new_calc(Dist) == ['eltrayecto.ogg', D] :- distance(Dist) == D. % nothing to said possibly beep?
|
||||
|
||||
go_ahead(Dist) == ['siga_por.ogg', delay_250, D]:- distance(Dist) == D.
|
||||
go_ahead == ['siga.ogg'].
|
||||
route_new_calc(Dist) == ['eltrayecto.ogg', D] :- distance(Dist) == D.
|
||||
route_recalc(Dist) == ['recalcular.ogg', D] :- distance(Dist) == D.
|
||||
|
||||
location_lost == ['gps_signal_lost.ogg'].
|
||||
|
||||
|
||||
%%
|
||||
nth(1, 'primera.ogg').
|
||||
|
@ -68,46 +64,45 @@ nth(17, 'diezsiete.ogg').
|
|||
|
||||
%%% distance measure
|
||||
distance(Dist) == T :- Dist < 1000, dist(Dist, F), append(F, 'metros.ogg',T).
|
||||
dist(D, ['diez.ogg']) :- D < 20, !.
|
||||
dist(D, ['veinte.ogg']) :- D < 30, !.
|
||||
dist(D, ['treinta.ogg']) :- D < 40, !.
|
||||
dist(D, ['cuarenta.ogg']) :- D < 50, !.
|
||||
dist(D, ['cincuenta.ogg']) :- D < 60, !.
|
||||
dist(D, ['sesenta.ogg']) :- D < 70, !.
|
||||
dist(D, ['setenta.ogg']) :- D < 80, !.
|
||||
dist(D, ['ochenta.ogg']) :- D < 90, !.
|
||||
dist(D, ['noventa.ogg']) :- D < 100, !.
|
||||
dist(D, ['cien.ogg']) :- D < 150, !.
|
||||
dist(D, ['ciento.ogg', 'cincuenta.ogg']) :- D < 200, !.
|
||||
dist(D, ['dos.ogg','cientos.ogg']) :- D < 250, !.
|
||||
dist(D, ['dos.ogg','cientos.ogg', 'cincuenta.ogg']) :- D < 300, !.
|
||||
dist(D, ['tres.ogg','cientos.ogg']) :- D < 350, !.
|
||||
dist(D, ['tres.ogg','cientos.ogg', 'cincuenta.ogg']) :- D < 400, !.
|
||||
dist(D, ['cuatro.ogg','cientos.ogg']) :- D < 450, !.
|
||||
dist(D, ['cuatro.ogg','cientos.ogg', 'cincuenta.ogg']) :- D < 500, !.
|
||||
dist(D, ['quinientos.ogg']) :- D < 550, !.
|
||||
dist(D, ['quinientos.ogg', 'cincuenta.ogg']) :- D < 600, !.
|
||||
dist(D, ['seis.ogg','cientos.ogg']) :- D < 650, !.
|
||||
dist(D, ['seis.ogg','cientos.ogg', 'cincuenta.ogg']) :- D < 700, !.
|
||||
dist(D, ['setescientos.ogg']) :- D < 750, !.
|
||||
dist(D, ['setescientos.ogg', 'cincuenta.ogg']) :- D < 800, !.
|
||||
dist(D, ['ocho.ogg','cientos.ogg']) :- D < 850, !.
|
||||
dist(D, ['ocho.ogg','cientos.ogg', 'cincuenta.ogg']) :- D < 900, !.
|
||||
dist(D, ['novecientos.ogg']) :- D < 950, !.
|
||||
dist(D, ['diez.ogg']) :- D < 15, !.
|
||||
dist(D, ['veinte.ogg']) :- D < 25, !.
|
||||
dist(D, ['treinta.ogg']) :- D < 35, !.
|
||||
dist(D, ['cuarenta.ogg']) :- D < 45, !.
|
||||
dist(D, ['cincuenta.ogg']) :- D < 55, !.
|
||||
dist(D, ['sesenta.ogg']) :- D < 65, !.
|
||||
dist(D, ['setenta.ogg']) :- D < 75, !.
|
||||
dist(D, ['ochenta.ogg']) :- D < 85, !.
|
||||
dist(D, ['noventa.ogg']) :- D < 95, !.
|
||||
dist(D, ['cien.ogg']) :- D < 125, !.
|
||||
dist(D, ['ciento.ogg', 'cincuenta.ogg']) :- D < 175, !.
|
||||
dist(D, ['dos.ogg','cientos.ogg']) :- D < 225, !.
|
||||
dist(D, ['dos.ogg','cientos.ogg', 'cincuenta.ogg']) :- D < 275, !.
|
||||
dist(D, ['tres.ogg','cientos.ogg']) :- D < 325, !.
|
||||
dist(D, ['tres.ogg','cientos.ogg', 'cincuenta.ogg']) :- D < 375, !.
|
||||
dist(D, ['cuatro.ogg','cientos.ogg']) :- D < 425, !.
|
||||
dist(D, ['cuatro.ogg','cientos.ogg', 'cincuenta.ogg']) :- D < 475, !.
|
||||
dist(D, ['quinientos.ogg']) :- D < 525, !.
|
||||
dist(D, ['quinientos.ogg', 'cincuenta.ogg']) :- D < 575, !.
|
||||
dist(D, ['seis.ogg','cientos.ogg']) :- D < 625, !.
|
||||
dist(D, ['seis.ogg','cientos.ogg', 'cincuenta.ogg']) :- D < 675, !.
|
||||
dist(D, ['setescientos.ogg']) :- D < 725, !.
|
||||
dist(D, ['setescientos.ogg', 'cincuenta.ogg']) :- D < 775, !.
|
||||
dist(D, ['ocho.ogg','cientos.ogg']) :- D < 825, !.
|
||||
dist(D, ['ocho.ogg','cientos.ogg', 'cincuenta.ogg']) :- D < 875, !.
|
||||
dist(D, ['novecientos.ogg']) :- D < 925, !.
|
||||
dist(D, ['novecientos.ogg', 'cincuenta.ogg']) :- !.
|
||||
|
||||
|
||||
distance(Dist) == ['mas_de.ogg', 'un.ogg', 'kilometro.ogg'] :- Dist < 1500.
|
||||
distance(Dist) == ['mas_de.ogg', 'dos.ogg', 'kilometros.ogg'] :- Dist < 3000.
|
||||
distance(Dist) == ['mas_de.ogg', 'tres.ogg', 'kilometros.ogg'] :- Dist < 4000.
|
||||
distance(Dist) == ['mas_de.ogg', 'cuatro.ogg', 'kilometros.ogg'] :- Dist < 5000.
|
||||
distance(Dist) == ['mas_de.ogg', 'cinco.ogg', 'kilometros.ogg'] :- Dist < 6000.
|
||||
distance(Dist) == ['mas_de.ogg', 'seis.ogg', 'kilometros.ogg'] :- Dist < 7000.
|
||||
distance(Dist) == ['mas_de.ogg', 'siete.ogg', 'kilometros.ogg'] :- Dist < 8000.
|
||||
distance(Dist) == ['mas_de.ogg', 'ocho.ogg', 'kilometros.ogg'] :- Dist < 9000.
|
||||
distance(Dist) == ['mas_de.ogg', 'nueve.ogg', 'kilometros.ogg'] :- Dist < 10000.
|
||||
distance(Dist) == ['mas_de.ogg', X, 'kilometros.ogg'] :- D is Dist/1000, dist(D, X).
|
||||
|
||||
distance(Dist) == ['cerca.ogg', 'un.ogg', 'kilometro.ogg'] :- Dist < 1500.
|
||||
distance(Dist) == ['cerca.ogg', 'dos.ogg', 'kilometros.ogg'] :- Dist < 2500.
|
||||
distance(Dist) == ['cerca.ogg', 'tres.ogg', 'kilometros.ogg'] :- Dist < 3500.
|
||||
distance(Dist) == ['cerca.ogg', 'cuatro.ogg', 'kilometros.ogg'] :- Dist < 4500.
|
||||
distance(Dist) == ['cerca.ogg', 'cinco.ogg', 'kilometros.ogg'] :- Dist < 5500.
|
||||
distance(Dist) == ['cerca.ogg', 'seis.ogg', 'kilometros.ogg'] :- Dist < 6500.
|
||||
distance(Dist) == ['cerca.ogg', 'siete.ogg', 'kilometros.ogg'] :- Dist < 7500.
|
||||
distance(Dist) == ['cerca.ogg', 'ocho.ogg', 'kilometros.ogg'] :- Dist < 8500.
|
||||
distance(Dist) == ['cerca.ogg', 'nueve.ogg', 'kilometros.ogg'] :- Dist < 9500.
|
||||
distance(Dist) == ['cerca.ogg', X, 'kilometros.ogg'] :- D is Dist/1000, dist(D, X).
|
||||
|
||||
|
||||
%% resolve command main method
|
||||
|
@ -115,8 +110,7 @@ distance(Dist) == ['mas_de.ogg', X, 'kilometros.ogg'] :- D is Dist/1000, dist(D,
|
|||
%% by adding exception cases.
|
||||
flatten(X, Y) :- flatten(X, [], Y), !.
|
||||
flatten([], Acc, Acc).
|
||||
flatten([X|Y], Acc, Res):-
|
||||
flatten(Y, Acc, R), flatten(X, R, Res).
|
||||
flatten([X|Y], Acc, Res):- flatten(Y, Acc, R), flatten(X, R, Res).
|
||||
flatten(X, Acc, [X|Acc]).
|
||||
|
||||
resolve(X, Y) :- resolve_impl(X,Z), flatten(Z, Y).
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
:- op('==', xfy, 500).
|
||||
version(0).
|
||||
|
||||
|
||||
% before each announcement (beep)
|
||||
preamble - [].
|
||||
|
||||
|
@ -14,37 +13,34 @@ turn('right', ['tournez.ogg', 'a_droite.ogg']).
|
|||
turn('right_sh', ['tournez_immediat.ogg', 'a_droite.ogg']).
|
||||
turn('right_sl', ['tournez_lentement.ogg', 'a_droite.ogg']).
|
||||
|
||||
prepare_turn(Turn, Dist) == ['dans.ogg', delay_450, D, 'preparez_vous_a.ogg', delay_450, M] :-
|
||||
distance(Dist) == D, turn(Turn, M).
|
||||
turn(Turn, Dist) == ['dans.ogg', delay_250, D, delay_250, M] :-
|
||||
distance(Dist) == D, turn(Turn, M).
|
||||
prepare_turn(Turn, Dist) == ['dans.ogg', delay_450, D, 'preparez_vous_a.ogg', delay_450, M] :- distance(Dist) == D, turn(Turn, M).
|
||||
turn(Turn, Dist) == ['dans.ogg', delay_250, D, delay_250, M] :- distance(Dist) == D, turn(Turn, M).
|
||||
turn(Turn) == M :- turn(Turn, M).
|
||||
|
||||
|
||||
prepare_make_ut(Dist) == ['dans.ogg', delay_300, D, 'preparez_vous_a.ogg', delay_300,'faire_demi_tour.ogg'] :-
|
||||
distance(Dist) == D.
|
||||
|
||||
prepare_roundabout(Dist) == ['dans.ogg', delay_300, D,'preparez_vous_a.ogg','entrez_dans_rondpoint.ogg'] :-
|
||||
distance(Dist) == D.
|
||||
|
||||
make_ut(Dist) == ['dans.ogg', delay_300, D, 'preparez_vous_a.ogg', delay_300,'faites_demi_tour.ogg'] :-
|
||||
distance(Dist) == D.
|
||||
prepare_make_ut(Dist) == ['dans.ogg', delay_300, D, 'preparez_vous_a.ogg', delay_300,'faire_demi_tour.ogg'] :- distance(Dist) == D.
|
||||
make_ut(Dist) == ['dans.ogg', delay_300, D, 'preparez_vous_a.ogg', delay_300,'faites_demi_tour.ogg'] :- distance(Dist) == D.
|
||||
make_ut == ['faites_demi_tour.ogg'].
|
||||
|
||||
prepare_roundabout(Dist) == ['dans.ogg', delay_300, D,'preparez_vous_a.ogg','entrez_dans_rondpoint.ogg'] :- distance(Dist) == D.
|
||||
roundabout(Dist, _Angle, Exit) == ['dans.ogg', delay_300, D, delay_300, 'entrez_dans_rondpoint.ogg', delay_250, 'et.ogg','prenez_la.ogg',
|
||||
delay_250, E, 'sortie.ogg'] :- distance(Dist) == D, nth(Exit, E).
|
||||
delay_250, E, 'sortie.ogg'] :- distance(Dist) == D, nth(Exit, E).
|
||||
roundabout(_Angle, Exit) == ['prenez_la.ogg', delay_250, E, 'sortie.ogg'] :- nth(Exit, E).
|
||||
|
||||
and_arrive_destination == ['arrivez_a_destination.ogg']. % Miss and?
|
||||
go_ahead == ['continuez_tout_droit.ogg'].
|
||||
go_ahead(Dist) == ['continuez_pendant.ogg', delay_250, D]:- distance(Dist) == D.
|
||||
|
||||
and_arrive_destination == ['arrivez_a_destination.ogg'].
|
||||
|
||||
then == ['puis.ogg', delay_350].
|
||||
reached_destination == ['vous_etes_arrives.ogg'].
|
||||
bear_right == ['serrez.ogg','a_droite.ogg'].
|
||||
bear_left == ['serrez.ogg','a_gauche.ogg'].
|
||||
route_recalc(_Dist) == []. % ['recalcul_itineraire.ogg']. %nothing to said possibly beep?
|
||||
route_new_calc(Dist) == ['le_trajet_fait.ogg', delay_150, D] :- distance(Dist) == D. % nothing to said possibly beep?
|
||||
|
||||
go_ahead(Dist) == ['continuez_pendant.ogg', delay_250, D]:- distance(Dist) == D.
|
||||
go_ahead == ['continuez_tout_droit.ogg'].
|
||||
route_new_calc(Dist) == ['le_trajet_fait.ogg', delay_150, D] :- distance(Dist) == D. % nothing to said possibly beep?
|
||||
route_recalc(Dist) == ['recalcul_itineraire.ogg', delay_150, D]:- distance(Dist) == D.
|
||||
|
||||
location_lost == ['gps_signal_lost.ogg'].
|
||||
|
||||
|
||||
%%
|
||||
nth(1, '1ere.ogg').
|
||||
|
@ -68,58 +64,55 @@ nth(17, '17eme.ogg').
|
|||
|
||||
%%% distance measure
|
||||
distance(Dist) == T :- Dist < 1000, dist(Dist, F), append(F, 'metres.ogg',T).
|
||||
dist(D, ['10-fr.ogg']) :- D < 20, !.
|
||||
dist(D, ['20-fr.ogg']) :- D < 30, !.
|
||||
dist(D, ['30-fr.ogg']) :- D < 40, !.
|
||||
dist(D, ['40-fr.ogg']) :- D < 50, !.
|
||||
dist(D, ['50-fr.ogg']) :- D < 60, !.
|
||||
dist(D, ['60-fr.ogg']) :- D < 70, !.
|
||||
dist(D, ['70-fr.ogg']) :- D < 80, !.
|
||||
dist(D, ['80-fr.ogg']) :- D < 90, !.
|
||||
dist(D, ['90-fr.ogg']) :- D < 100, !.
|
||||
dist(D, ['100-fr.ogg']) :- D < 150, !.
|
||||
dist(D, ['100-fr.ogg', '50-fr.ogg']) :- D < 200, !.
|
||||
dist(D, ['200-fr.ogg']) :- D < 250, !.
|
||||
dist(D, ['200-fr.ogg', '50-fr.ogg']) :- D < 300, !.
|
||||
dist(D, ['300-fr.ogg']) :- D < 350, !.
|
||||
dist(D, ['300-fr.ogg', '50-fr.ogg']) :- D < 400, !.
|
||||
dist(D, ['400-fr.ogg']) :- D < 450, !.
|
||||
dist(D, ['400-fr.ogg', '50-fr.ogg']) :- D < 500, !.
|
||||
dist(D, ['500-fr.ogg']) :- D < 550, !.
|
||||
dist(D, ['500-fr.ogg', '50-fr.ogg']) :- D < 600, !.
|
||||
dist(D, ['600-fr.ogg']) :- D < 650, !.
|
||||
dist(D, ['600-fr.ogg', '50-fr.ogg']) :- D < 700, !.
|
||||
dist(D, ['700-fr.ogg']) :- D < 750, !.
|
||||
dist(D, ['700-fr.ogg', '50-fr.ogg']) :- D < 800, !.
|
||||
dist(D, ['800-fr.ogg']) :- D < 850, !.
|
||||
dist(D, ['800-fr.ogg', '50-fr.ogg']) :- D < 900, !.
|
||||
dist(D, ['900-fr.ogg']) :- D < 950, !.
|
||||
dist(D, ['10-fr.ogg']) :- D < 15, !.
|
||||
dist(D, ['20-fr.ogg']) :- D < 25, !.
|
||||
dist(D, ['30-fr.ogg']) :- D < 35, !.
|
||||
dist(D, ['40-fr.ogg']) :- D < 45, !.
|
||||
dist(D, ['50-fr.ogg']) :- D < 55, !.
|
||||
dist(D, ['60-fr.ogg']) :- D < 65, !.
|
||||
dist(D, ['70-fr.ogg']) :- D < 75, !.
|
||||
dist(D, ['80-fr.ogg']) :- D < 85, !.
|
||||
dist(D, ['90-fr.ogg']) :- D < 95, !.
|
||||
dist(D, ['100-fr.ogg']) :- D < 125, !.
|
||||
dist(D, ['100-fr.ogg', '50-fr.ogg']) :- D < 175, !.
|
||||
dist(D, ['200-fr.ogg']) :- D < 225, !.
|
||||
dist(D, ['200-fr.ogg', '50-fr.ogg']) :- D < 275, !.
|
||||
dist(D, ['300-fr.ogg']) :- D < 325, !.
|
||||
dist(D, ['300-fr.ogg', '50-fr.ogg']) :- D < 375, !.
|
||||
dist(D, ['400-fr.ogg']) :- D < 425, !.
|
||||
dist(D, ['400-fr.ogg', '50-fr.ogg']) :- D < 475, !.
|
||||
dist(D, ['500-fr.ogg']) :- D < 525, !.
|
||||
dist(D, ['500-fr.ogg', '50-fr.ogg']) :- D < 575, !.
|
||||
dist(D, ['600-fr.ogg']) :- D < 625, !.
|
||||
dist(D, ['600-fr.ogg', '50-fr.ogg']) :- D < 675, !.
|
||||
dist(D, ['700-fr.ogg']) :- D < 725, !.
|
||||
dist(D, ['700-fr.ogg', '50-fr.ogg']) :- D < 775, !.
|
||||
dist(D, ['800-fr.ogg']) :- D < 825, !.
|
||||
dist(D, ['800-fr.ogg', '50-fr.ogg']) :- D < 875, !.
|
||||
dist(D, ['900-fr.ogg']) :- D < 925, !.
|
||||
dist(D, ['900-fr.ogg', '50-fr.ogg']) :- !.
|
||||
|
||||
|
||||
distance(Dist) == ['plus_de.ogg', '1-fr.ogg', 'kilometre.ogg'] :- Dist < 1500.
|
||||
distance(Dist) == ['plus_de.ogg', '2-fr.ogg', 'kilometre.ogg'] :- Dist < 3000.
|
||||
distance(Dist) == ['plus_de.ogg', '3-fr.ogg', 'kilometre.ogg'] :- Dist < 4000.
|
||||
distance(Dist) == ['plus_de.ogg', '4-fr.ogg', 'kilometre.ogg'] :- Dist < 5000.
|
||||
distance(Dist) == ['plus_de.ogg', '5-fr.ogg', 'kilometre.ogg'] :- Dist < 6000.
|
||||
distance(Dist) == ['plus_de.ogg', '6-fr.ogg', 'kilometre.ogg'] :- Dist < 7000.
|
||||
distance(Dist) == ['plus_de.ogg', '7-fr.ogg', 'kilometre.ogg'] :- Dist < 8000.
|
||||
distance(Dist) == ['plus_de.ogg', '8-fr.ogg', 'kilometre.ogg'] :- Dist < 9000.
|
||||
distance(Dist) == ['plus_de.ogg', '9-fr.ogg', 'kilometre.ogg'] :- Dist < 10000.
|
||||
distance(Dist) == ['plus_de.ogg', '2-fr.ogg', 'kilometre.ogg'] :- Dist < 2500.
|
||||
distance(Dist) == ['plus_de.ogg', '3-fr.ogg', 'kilometre.ogg'] :- Dist < 3500.
|
||||
distance(Dist) == ['plus_de.ogg', '4-fr.ogg', 'kilometre.ogg'] :- Dist < 4500.
|
||||
distance(Dist) == ['plus_de.ogg', '5-fr.ogg', 'kilometre.ogg'] :- Dist < 5500.
|
||||
distance(Dist) == ['plus_de.ogg', '6-fr.ogg', 'kilometre.ogg'] :- Dist < 6500.
|
||||
distance(Dist) == ['plus_de.ogg', '7-fr.ogg', 'kilometre.ogg'] :- Dist < 7500.
|
||||
distance(Dist) == ['plus_de.ogg', '8-fr.ogg', 'kilometre.ogg'] :- Dist < 8500.
|
||||
distance(Dist) == ['plus_de.ogg', '9-fr.ogg', 'kilometre.ogg'] :- Dist < 9500.
|
||||
distance(Dist) == ['plus_de.ogg', X, 'kilometre.ogg'] :- 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,
|
||||
%% by adding exception cases.
|
||||
flatten(X, Y) :- flatten(X, [], Y), !.
|
||||
flatten([], Acc, Acc).
|
||||
flatten([X|Y], Acc, Res):-
|
||||
flatten(Y, Acc, R), flatten(X, R, Res).
|
||||
flatten([X|Y], Acc, Res):- flatten(Y, Acc, R), flatten(X, R, Res).
|
||||
flatten(X, Acc, [X|Acc]).
|
||||
|
||||
resolve(X, Y) :- resolve_impl(X,Z), flatten(Z, Y).
|
||||
resolve_impl([],[]).
|
||||
resolve_impl([X|Rest], List) :- resolve_impl(Rest, Tail), ((X == L) -> append(L, Tail, List); List = Tail).
|
||||
|
||||
resolve_impl([X|Rest], List) :- resolve_impl(Rest, Tail), ((X == L) -> append(L, Tail, List); List = Tail).
|
|
@ -1,7 +1,6 @@
|
|||
:- op('==', xfy, 500).
|
||||
version(0).
|
||||
|
||||
|
||||
% before each announcement (beep)
|
||||
preamble - [].
|
||||
|
||||
|
@ -14,37 +13,34 @@ turn('right', ['turn.ogg', delay_350, 'right.ogg']).
|
|||
turn('right_sh', ['turn_sharply.ogg', delay_350,'right.ogg']).
|
||||
turn('right_sl', ['turn_slightly_right.ogg']).
|
||||
|
||||
prepare_turn(Turn, Dist) == ['Prepare_to.ogg', 'in.ogg', delay_300, D, delay_300, M] :-
|
||||
distance(Dist) == D, turn(Turn, M).
|
||||
turn(Turn, Dist) == ['in.ogg', delay_250, D, delay_250, M] :-
|
||||
distance(Dist) == D, turn(Turn, M).
|
||||
prepare_turn(Turn, Dist) == ['Prepare_to.ogg', 'in.ogg', delay_300, D, delay_300, M] :- distance(Dist) == D, turn(Turn, M).
|
||||
turn(Turn, Dist) == ['in.ogg', delay_250, D, delay_250, M] :- distance(Dist) == D, turn(Turn, M).
|
||||
turn(Turn) == M :- turn(Turn, M).
|
||||
|
||||
|
||||
prepare_make_ut(Dist) == ['Prepare_to.ogg', 'in.ogg', delay_300, D, delay_300,'Turn_back.ogg'] :-
|
||||
distance(Dist) == D.
|
||||
|
||||
prepare_roundabout(Dist) == ['Prepare_to.ogg', 'in.ogg', delay_300, D, delay_300, 'roundabout.ogg'] :-
|
||||
distance(Dist) == D.
|
||||
|
||||
make_ut(Dist) == ['in.ogg', delay_300, D, delay_300, 'Turn_back.ogg'] :-
|
||||
distance(Dist) == D.
|
||||
prepare_make_ut(Dist) == ['Prepare_to.ogg', 'in.ogg', delay_300, D, delay_300,'Turn_back.ogg'] :- distance(Dist) == D.
|
||||
make_ut(Dist) == ['in.ogg', delay_300, D, delay_300, 'Turn_back.ogg'] :- distance(Dist) == D.
|
||||
make_ut == ['Turn_back.ogg'].
|
||||
|
||||
prepare_roundabout(Dist) == ['Prepare_to.ogg', 'in.ogg', delay_300, D, delay_300, 'roundabout.ogg'] :- distance(Dist) == D.
|
||||
roundabout(Dist, _Angle, Exit) == ['in.ogg', delay_300, D, delay_300, 'roundabout.ogg', delay_250, 'DO.ogg', delay_250, E, 'the_exit.ogg'] :-
|
||||
distance(Dist) == D, nth(Exit, E).
|
||||
distance(Dist) == D, nth(Exit, E).
|
||||
roundabout(_Angle, Exit) == ['DO.ogg', delay_250, E, 'the_exit.ogg'] :- nth(Exit, E).
|
||||
|
||||
go_ahead == ['continue.ogg', 'stright.ogg'].
|
||||
go_ahead(Dist) == ['Drive.ogg', delay_250, D]:- distance(Dist) == D.
|
||||
|
||||
and_arrive_destination == ['arrive_at_destination.ogg'].
|
||||
|
||||
then == ['then.ogg', delay_350].
|
||||
reached_destination == ['you_reached.ogg',delay_250, 'TO_DESTINATION.ogg'].
|
||||
bear_right == ['bear_right.ogg'].
|
||||
bear_left == ['bear_left.ogg'].
|
||||
route_recalc(_Dist) == []. % 'recalc.ogg'
|
||||
route_new_calc(_Dist) == ['have_a_nice_trip_drive_carefully.ogg'].
|
||||
|
||||
go_ahead(Dist) == ['Drive.ogg', delay_250, D]:- distance(Dist) == D.
|
||||
go_ahead == ['continue.ogg', 'stright.ogg'].
|
||||
route_new_calc(Dist) == ['have_a_nice_trip_drive_carefully.ogg', delay_150, D] :- distance(Dist) == D.
|
||||
route_recalc(Dist) == ['recalc.ogg', delay_150, D]:- distance(Dist) == D.
|
||||
|
||||
location_lost == ['gps_signal_lost.ogg'].
|
||||
|
||||
|
||||
%%
|
||||
nth(1, '1st.ogg').
|
||||
|
@ -57,49 +53,48 @@ nth(7, '7th.ogg').
|
|||
nth(8, '8th.ogg').
|
||||
nth(9, '9th.ogg').
|
||||
|
||||
|
||||
%%% distance measure
|
||||
distance(Dist) == [F, 'meters.ogg'] :- Dist < 1000, dist(Dist, F).
|
||||
dist(D, '10.ogg') :- D < 20, !.
|
||||
dist(D, '20.ogg') :- D < 30, !.
|
||||
dist(D, '30.ogg') :- D < 40, !.
|
||||
dist(D, '40.ogg') :- D < 50, !.
|
||||
dist(D, '50.ogg') :- D < 60, !.
|
||||
dist(D, '60.ogg') :- D < 70, !.
|
||||
dist(D, '70.ogg') :- D < 80, !.
|
||||
dist(D, '80.ogg') :- D < 90, !.
|
||||
dist(D, '90.ogg') :- D < 100, !.
|
||||
dist(D, '100.ogg') :- D < 150, !.
|
||||
dist(D, '150.ogg') :- D < 200, !.
|
||||
dist(D, '200.ogg') :- D < 250, !.
|
||||
dist(D, '250.ogg') :- D < 300, !.
|
||||
dist(D, '300.ogg') :- D < 350, !.
|
||||
dist(D, '350.ogg') :- D < 400, !.
|
||||
dist(D, '400.ogg') :- D < 450, !.
|
||||
dist(D, '450.ogg') :- D < 500, !.
|
||||
dist(D, '500.ogg') :- D < 550, !.
|
||||
dist(D, '550.ogg') :- D < 600, !.
|
||||
dist(D, '600.ogg') :- D < 650, !.
|
||||
dist(D, '650.ogg') :- D < 700, !.
|
||||
dist(D, '700.ogg') :- D < 750, !.
|
||||
dist(D, '750.ogg') :- D < 800, !.
|
||||
dist(D, '800.ogg') :- D < 850, !.
|
||||
dist(D, '850.ogg') :- D < 900, !.
|
||||
dist(D, '900.ogg') :- D < 950, !.
|
||||
dist(D, '10.ogg') :- D < 15, !.
|
||||
dist(D, '20.ogg') :- D < 25, !.
|
||||
dist(D, '30.ogg') :- D < 35, !.
|
||||
dist(D, '40.ogg') :- D < 45, !.
|
||||
dist(D, '50.ogg') :- D < 55, !.
|
||||
dist(D, '60.ogg') :- D < 65, !.
|
||||
dist(D, '70.ogg') :- D < 75, !.
|
||||
dist(D, '80.ogg') :- D < 85, !.
|
||||
dist(D, '90.ogg') :- D < 95, !.
|
||||
dist(D, '100.ogg') :- D < 125, !.
|
||||
dist(D, '150.ogg') :- D < 175, !.
|
||||
dist(D, '200.ogg') :- D < 225, !.
|
||||
dist(D, '250.ogg') :- D < 275, !.
|
||||
dist(D, '300.ogg') :- D < 325, !.
|
||||
dist(D, '350.ogg') :- D < 375, !.
|
||||
dist(D, '400.ogg') :- D < 425, !.
|
||||
dist(D, '450.ogg') :- D < 475, !.
|
||||
dist(D, '500.ogg') :- D < 525, !.
|
||||
dist(D, '550.ogg') :- D < 575, !.
|
||||
dist(D, '600.ogg') :- D < 625, !.
|
||||
dist(D, '650.ogg') :- D < 675, !.
|
||||
dist(D, '700.ogg') :- D < 725, !.
|
||||
dist(D, '750.ogg') :- D < 775, !.
|
||||
dist(D, '800.ogg') :- D < 825, !.
|
||||
dist(D, '850.ogg') :- D < 875, !.
|
||||
dist(D, '900.ogg') :- D < 925, !.
|
||||
dist(D, '950.ogg') :- !.
|
||||
|
||||
|
||||
distance(Dist) == ['more_than.ogg', '1.ogg', 'kilometr.ogg'] :- Dist < 1500.
|
||||
distance(Dist) == ['more_than.ogg', '1.5k.ogg', 'kilometra.ogg'] :- Dist < 2000.
|
||||
distance(Dist) == ['more_than.ogg', '2.ogg', 'kilometra.ogg'] :- Dist < 3000.
|
||||
distance(Dist) == ['more_than.ogg', '3.ogg', 'kilometra.ogg'] :- Dist < 4000.
|
||||
distance(Dist) == ['more_than.ogg', '4.ogg', 'kilometra.ogg'] :- Dist < 5000.
|
||||
distance(Dist) == ['more_than.ogg', '5.ogg', 'kilometrov.ogg'] :- Dist < 6000.
|
||||
distance(Dist) == ['more_than.ogg', '6.ogg', 'kilometrov.ogg'] :- Dist < 7000.
|
||||
distance(Dist) == ['more_than.ogg', '7.ogg', 'kilometrov.ogg'] :- Dist < 8000.
|
||||
distance(Dist) == ['more_than.ogg', '8.ogg', 'kilometrov.ogg'] :- Dist < 9000.
|
||||
distance(Dist) == ['more_than.ogg', '9.ogg', 'kilometrov.ogg'] :- Dist < 10000.
|
||||
distance(Dist) == ['more_than.ogg', X, 'kilometrov.ogg'] :- D is Dist/1000, dist(D, X).
|
||||
|
||||
distance(Dist) == ['about.ogg', '1.ogg', 'kilometr.ogg'] :- Dist < 1500.
|
||||
distance(Dist) == ['about.ogg', '2.ogg', 'kilometra.ogg'] :- Dist < 2500.
|
||||
distance(Dist) == ['about.ogg', '3.ogg', 'kilometra.ogg'] :- Dist < 3500.
|
||||
distance(Dist) == ['about.ogg', '4.ogg', 'kilometra.ogg'] :- Dist < 4500.
|
||||
distance(Dist) == ['about.ogg', '5.ogg', 'kilometrov.ogg'] :- Dist < 5500.
|
||||
distance(Dist) == ['about.ogg', '6.ogg', 'kilometrov.ogg'] :- Dist < 6500.
|
||||
distance(Dist) == ['about.ogg', '7.ogg', 'kilometrov.ogg'] :- Dist < 7500.
|
||||
distance(Dist) == ['about.ogg', '8.ogg', 'kilometrov.ogg'] :- Dist < 8500.
|
||||
distance(Dist) == ['about.ogg', '9.ogg', 'kilometrov.ogg'] :- Dist < 9500.
|
||||
distance(Dist) == ['about.ogg', X, 'kilometrov.ogg'] :- D is Dist/1000, dist(D, X).
|
||||
|
||||
|
||||
%% resolve command main method
|
||||
|
@ -107,8 +102,7 @@ distance(Dist) == ['more_than.ogg', X, 'kilometrov.ogg'] :- D is Dist/1000, dist
|
|||
%% by adding exception cases.
|
||||
flatten(X, Y) :- flatten(X, [], Y), !.
|
||||
flatten([], Acc, Acc).
|
||||
flatten([X|Y], Acc, Res):-
|
||||
flatten(Y, Acc, R), flatten(X, R, Res).
|
||||
flatten([X|Y], Acc, Res):- flatten(Y, Acc, R), flatten(X, R, Res).
|
||||
flatten(X, Acc, [X|Acc]).
|
||||
|
||||
resolve(X, Y) :- resolve_impl(X,Z), flatten(Z, Y).
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
:- op('==', xfy, 500).
|
||||
version(0).
|
||||
|
||||
|
||||
% before each announcement (beep)
|
||||
preamble - [].
|
||||
|
||||
|
@ -14,37 +13,34 @@ turn('right', ['turn_right-e.ogg']).
|
|||
turn('right_sh', ['turn_sharp_right-e.ogg']).
|
||||
turn('right_sl', ['turn_slightly_right-e.ogg']).
|
||||
|
||||
prepare_turn(Turn, Dist) == ['Prepare_to.ogg', 'after-m.ogg', delay_300, D, delay_300, M] :-
|
||||
distance(Dist) == D, turn(Turn, M).
|
||||
turn(Turn, Dist) == ['after-m.ogg', delay_300, D, delay_300, M] :-
|
||||
distance(Dist) == D, turn(Turn, M).
|
||||
prepare_turn(Turn, Dist) == ['Prepare_to.ogg', 'after-m.ogg', delay_300, D, delay_300, M] :- distance(Dist) == D, turn(Turn, M).
|
||||
turn(Turn, Dist) == ['after-m.ogg', delay_300, D, delay_300, M] :- distance(Dist) == D, turn(Turn, M).
|
||||
turn(Turn) == M :- turn(Turn, M).
|
||||
|
||||
|
||||
prepare_make_ut(Dist) == ['Prepare_to.ogg', 'after-m.ogg', delay_300, D, delay_300,'turn_back-e.ogg'] :-
|
||||
distance(Dist) == D.
|
||||
|
||||
prepare_roundabout(Dist) == ['Prepare_to.ogg', 'after-m.ogg', delay_300, D, delay_300, 'cross_the_roundabout-e.ogg'] :-
|
||||
distance(Dist) == D.
|
||||
|
||||
make_ut(Dist) == ['after-m.ogg', delay_300, D, delay_300, 'turn_back-e.ogg'] :-
|
||||
distance(Dist) == D.
|
||||
prepare_make_ut(Dist) == ['Prepare_to.ogg', 'after-m.ogg', delay_300, D, delay_300,'turn_back-e.ogg'] :- distance(Dist) == D.
|
||||
make_ut(Dist) == ['after-m.ogg', delay_300, D, delay_300, 'turn_back-e.ogg'] :- distance(Dist) == D.
|
||||
make_ut == ['turn_back-e.ogg'].
|
||||
|
||||
prepare_roundabout(Dist) == ['Prepare_to.ogg', 'after-m.ogg', delay_300, D, delay_300, 'cross_the_roundabout-e.ogg'] :- distance(Dist) == D.
|
||||
roundabout(Dist, _Angle, Exit) == ['after-m.ogg', delay_300, D, delay_300, 'enter_the_roundabout-e.ogg', delay_250, 'and_take_the.ogg',
|
||||
delay_250, E, 'exit-e.ogg'] :- distance(Dist) == D, nth(Exit, E).
|
||||
delay_250, E, 'exit-e.ogg'] :- distance(Dist) == D, nth(Exit, E).
|
||||
roundabout(_Angle, Exit) == ['taking_the.ogg', delay_250, E, 'exit-e.ogg'] :- nth(Exit, E).
|
||||
|
||||
and_arrive_destination == ['arrive_at_your_destination-e.ogg']. % Miss and?
|
||||
go_ahead == ['continue_straight-e.ogg'].
|
||||
go_ahead(Dist) == ['Drive-n.ogg', delay_250, D]:- distance(Dist) == D.
|
||||
|
||||
and_arrive_destination == ['arrive_at_your_destination-e.ogg'].
|
||||
|
||||
then == ['then.ogg', delay_350].
|
||||
reached_destination == ['you_have_reached_your_destination.ogg'].
|
||||
bear_right == ['keep_right-e.ogg'].
|
||||
bear_left == ['keep_left-e.ogg'].
|
||||
route_recalc(_Dist) == []. % ['recalc.ogg']. %nothing to said possibly beep?
|
||||
route_new_calc(Dist) == ['the_trip_is_more_than.ogg', delay_150, D] :- distance(Dist) == D. % nothing to said possibly beep?
|
||||
|
||||
go_ahead(Dist) == ['Drive-n.ogg', delay_250, D]:- distance(Dist) == D.
|
||||
go_ahead == ['continue_straight-e.ogg'].
|
||||
route_new_calc(Dist) == ['the_trip_is_more_than.ogg', delay_150, D] :- distance(Dist) == D.
|
||||
route_recalc(Dist) == ['recalc.ogg' delay_150, D]:- distance(Dist) == D.
|
||||
|
||||
location_lost == ['gps_signal_lost.ogg'].
|
||||
|
||||
|
||||
%%
|
||||
nth(1, '1st.ogg').
|
||||
|
@ -68,55 +64,53 @@ nth(17, '17th.ogg').
|
|||
|
||||
%%% distance measure
|
||||
distance(Dist) == T :- Dist < 1000, dist(Dist, F), append(F, 'meters-10-e.ogg',T).
|
||||
dist(D, ['10.ogg']) :- D < 20, !.
|
||||
dist(D, ['20.ogg']) :- D < 30, !.
|
||||
dist(D, ['30.ogg']) :- D < 40, !.
|
||||
dist(D, ['40.ogg']) :- D < 50, !.
|
||||
dist(D, ['50.ogg']) :- D < 60, !.
|
||||
dist(D, ['60.ogg']) :- D < 70, !.
|
||||
dist(D, ['70.ogg']) :- D < 80, !.
|
||||
dist(D, ['80.ogg']) :- D < 90, !.
|
||||
dist(D, ['90.ogg']) :- D < 100, !.
|
||||
dist(D, ['100.ogg']) :- D < 150, !.
|
||||
dist(D, ['100_and.ogg', 'and_50.ogg']) :- D < 200, !.
|
||||
dist(D, ['200.ogg']) :- D < 250, !.
|
||||
dist(D, ['200_and.ogg', 'and_50.ogg']) :- D < 300, !.
|
||||
dist(D, ['300.ogg']) :- D < 350, !.
|
||||
dist(D, ['300_and.ogg', 'and_50.ogg']) :- D < 400, !.
|
||||
dist(D, ['400.ogg']) :- D < 450, !.
|
||||
dist(D, ['400_and.ogg', 'and_50.ogg']) :- D < 500, !.
|
||||
dist(D, ['500.ogg']) :- D < 550, !.
|
||||
dist(D, ['500_and.ogg', 'and_50.ogg']) :- D < 600, !.
|
||||
dist(D, ['600.ogg']) :- D < 650, !.
|
||||
dist(D, ['600_and.ogg', 'and_50.ogg']) :- D < 700, !.
|
||||
dist(D, ['700.ogg']) :- D < 750, !.
|
||||
dist(D, ['700_and.ogg', 'and_50.ogg']) :- D < 800, !.
|
||||
dist(D, ['800.ogg']) :- D < 850, !.
|
||||
dist(D, ['800_and.ogg', 'and_50.ogg']) :- D < 900, !.
|
||||
dist(D, ['900.ogg']) :- D < 950, !.
|
||||
dist(D, ['10.ogg']) :- D < 15, !.
|
||||
dist(D, ['20.ogg']) :- D < 25, !.
|
||||
dist(D, ['30.ogg']) :- D < 35, !.
|
||||
dist(D, ['40.ogg']) :- D < 45, !.
|
||||
dist(D, ['50.ogg']) :- D < 55, !.
|
||||
dist(D, ['60.ogg']) :- D < 65, !.
|
||||
dist(D, ['70.ogg']) :- D < 75, !.
|
||||
dist(D, ['80.ogg']) :- D < 85, !.
|
||||
dist(D, ['90.ogg']) :- D < 95, !.
|
||||
dist(D, ['100.ogg']) :- D < 1125, !.
|
||||
dist(D, ['100_and.ogg', 'and_50.ogg']) :- D < 175, !.
|
||||
dist(D, ['200.ogg']) :- D < 225, !.
|
||||
dist(D, ['200_and.ogg', 'and_50.ogg']) :- D < 275, !.
|
||||
dist(D, ['300.ogg']) :- D < 325, !.
|
||||
dist(D, ['300_and.ogg', 'and_50.ogg']) :- D < 375, !.
|
||||
dist(D, ['400.ogg']) :- D < 425, !.
|
||||
dist(D, ['400_and.ogg', 'and_50.ogg']) :- D < 475, !.
|
||||
dist(D, ['500.ogg']) :- D < 525, !.
|
||||
dist(D, ['500_and.ogg', 'and_50.ogg']) :- D < 675, !.
|
||||
dist(D, ['600.ogg']) :- D < 625, !.
|
||||
dist(D, ['600_and.ogg', 'and_50.ogg']) :- D < 675, !.
|
||||
dist(D, ['700.ogg']) :- D < 725, !.
|
||||
dist(D, ['700_and.ogg', 'and_50.ogg']) :- D < 775, !.
|
||||
dist(D, ['800.ogg']) :- D < 825, !.
|
||||
dist(D, ['800_and.ogg', 'and_50.ogg']) :- D < 875, !.
|
||||
dist(D, ['900.ogg']) :- D < 925, !.
|
||||
dist(D, ['900_and.ogg', 'and_50.ogg']) :- !.
|
||||
|
||||
|
||||
distance(Dist) == ['more_than.ogg', '1.ogg', 'kilometer-e.ogg'] :- Dist < 1500.
|
||||
distance(Dist) == ['more_than.ogg', '2.ogg', 'kilometers-1-2-e.ogg'] :- Dist < 3000.
|
||||
distance(Dist) == ['more_than.ogg', '3.ogg', 'kilometers-1-2-e.ogg'] :- Dist < 4000.
|
||||
distance(Dist) == ['more_than.ogg', '4.ogg', 'kilometers-1-2-e.ogg'] :- Dist < 5000.
|
||||
distance(Dist) == ['more_than.ogg', '5.ogg', 'kilometers-200-e.ogg'] :- Dist < 6000.
|
||||
distance(Dist) == ['more_than.ogg', '6.ogg', 'kilometers-200-e.ogg'] :- Dist < 7000.
|
||||
distance(Dist) == ['more_than.ogg', '7.ogg', 'kilometers-200-e.ogg'] :- Dist < 8000.
|
||||
distance(Dist) == ['more_than.ogg', '8.ogg', 'kilometers-200-e.ogg'] :- Dist < 9000.
|
||||
distance(Dist) == ['more_than.ogg', '9.ogg', 'kilometers-200-e.ogg'] :- Dist < 10000.
|
||||
distance(Dist) == ['more_than.ogg', '2.ogg', 'kilometers-1-2-e.ogg'] :- Dist < 2500.
|
||||
distance(Dist) == ['more_than.ogg', '3.ogg', 'kilometers-1-2-e.ogg'] :- Dist < 3500.
|
||||
distance(Dist) == ['more_than.ogg', '4.ogg', 'kilometers-1-2-e.ogg'] :- Dist < 4500.
|
||||
distance(Dist) == ['more_than.ogg', '5.ogg', 'kilometers-200-e.ogg'] :- Dist < 5500.
|
||||
distance(Dist) == ['more_than.ogg', '6.ogg', 'kilometers-200-e.ogg'] :- Dist < 6500.
|
||||
distance(Dist) == ['more_than.ogg', '7.ogg', 'kilometers-200-e.ogg'] :- Dist < 7500.
|
||||
distance(Dist) == ['more_than.ogg', '8.ogg', 'kilometers-200-e.ogg'] :- Dist < 8500.
|
||||
distance(Dist) == ['more_than.ogg', '9.ogg', 'kilometers-200-e.ogg'] :- Dist < 9500.
|
||||
distance(Dist) == ['more_than.ogg', X, 'kilometers-200-e.ogg'] :- 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,
|
||||
%% by adding exception cases.
|
||||
flatten(X, Y) :- flatten(X, [], Y), !.
|
||||
flatten([], Acc, Acc).
|
||||
flatten([X|Y], Acc, Res):-
|
||||
flatten(Y, Acc, R), flatten(X, R, Res).
|
||||
flatten([X|Y], Acc, Res):- flatten(Y, Acc, R), flatten(X, R, Res).
|
||||
flatten(X, Acc, [X|Acc]).
|
||||
|
||||
resolve(X, Y) :- resolve_impl(X,Z), flatten(Z, Y).
|
||||
|
|
Loading…
Reference in a new issue