Replace crlf with lf

This commit is contained in:
Victor Shcherb 2011-05-07 13:28:34 +02:00
parent a0ffc06121
commit 262d99c7b4
15 changed files with 612 additions and 612 deletions

View file

@ -1,3 +1,3 @@
#Thu Apr 29 00:40:57 EEST 2010
eclipse.preferences.version=1
encoding/<project>=UTF-8
#Thu Apr 29 00:40:57 EEST 2010
eclipse.preferences.version=1
encoding/<project>=UTF-8

View file

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="hello world example" />
<Content type="html">
<![CDATA[
<iframe src="http://www.bidforfix.com/p/osmand.net/ads/iframe/"
scrolling="no" frameborder="0" style="border:none; width:600px; height:100px"/>
]]></Content>
</Module>
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="hello world example" />
<Content type="html">
<![CDATA[
<iframe src="http://www.bidforfix.com/p/osmand.net/ads/iframe/"
scrolling="no" frameborder="0" style="border:none; width:600px; height:100px"/>
]]></Content>
</Module>

View file

@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="hello world example" />
<Content type="html">
<![CDATA[
<iframe src="http://www.facebook.com/widgets/like.php?href=http://osmand.googlecode.com"
scrolling="no" frameborder="0" style="border:none; width:450px; height:80px"/>
]]></Content>
</Module>
<?xml version="1.0" encoding="UTF-8" ?>
<Module>
<ModulePrefs title="hello world example" />
<Content type="html">
<![CDATA[
<iframe src="http://www.facebook.com/widgets/like.php?href=http://osmand.googlecode.com"
scrolling="no" frameborder="0" style="border:none; width:450px; height:80px"/>
]]></Content>
</Module>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true"
android:drawable="@drawable/bicycle_icon_on" />
<item android:drawable="@drawable/bicycle_icon_off" />
</selector>
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true"
android:drawable="@drawable/bicycle_icon_on" />
<item android:drawable="@drawable/bicycle_icon_off" />
</selector>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/button_left_pushed" />
<item android:drawable="@drawable/button_left_simple" />
</selector>
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/button_left_pushed" />
<item android:drawable="@drawable/button_left_simple" />
</selector>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/button_right_pushed" />
<item android:drawable="@drawable/button_right_simple" />
</selector>
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/button_right_pushed" />
<item android:drawable="@drawable/button_right_simple" />
</selector>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true"
android:drawable="@drawable/beetle_icon_on" />
<item android:drawable="@drawable/beetle_icon_off" />
</selector>
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true"
android:drawable="@drawable/beetle_icon_on" />
<item android:drawable="@drawable/beetle_icon_off" />
</selector>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/headline_close_button_pressed" />
<item android:drawable="@drawable/headline_close_button" />
</selector>
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true" android:drawable="@drawable/headline_close_button_pressed" />
<item android:drawable="@drawable/headline_close_button" />
</selector>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true"
android:drawable="@drawable/pedestrian_icon_on" />
<item android:drawable="@drawable/pedestrian_icon_off" />
</selector>
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true"
android:drawable="@drawable/pedestrian_icon_on" />
<item android:drawable="@drawable/pedestrian_icon_off" />
</selector>

View file

@ -1,20 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:orientation="vertical">
<TextView android:id="@+id/Label" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center" android:text="@string/select_index_file_to_download"></TextView>
<EditText android:id="@+id/search_box"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="@string/download_type_to_filter"
android:inputType="text"
android:layout_marginLeft="3dp" android:layout_marginRight="3dp"
android:maxLines="1"/>
<ListView android:id="@android:id/list" android:layout_width="fill_parent" android:layout_weight="1" android:layout_height="wrap_content"
android:layout_marginLeft="3dp" android:layout_marginTop="3dp" android:layout_marginRight="3dp" ></ListView>
<Button android:id="@+id/DownloadButton" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center" android:text="@string/download_files"
android:layout_marginLeft = "3dp" android:layout_marginTop ="3dp" android:layout_marginRight = "3dp" android:visibility="gone"/>
</LinearLayout>
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" android:orientation="vertical">
<TextView android:id="@+id/Label" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center" android:text="@string/select_index_file_to_download"></TextView>
<EditText android:id="@+id/search_box"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="@string/download_type_to_filter"
android:inputType="text"
android:layout_marginLeft="3dp" android:layout_marginRight="3dp"
android:maxLines="1"/>
<ListView android:id="@android:id/list" android:layout_width="fill_parent" android:layout_weight="1" android:layout_height="wrap_content"
android:layout_marginLeft="3dp" android:layout_marginTop="3dp" android:layout_marginRight="3dp" ></ListView>
<Button android:id="@+id/DownloadButton" android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center" android:text="@string/download_files"
android:layout_marginLeft = "3dp" android:layout_marginTop ="3dp" android:layout_marginRight = "3dp" android:visibility="gone"/>
</LinearLayout>

View file

@ -1,23 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<menu
xmlns:android="http://schemas.android.com/apk/res/android">
<group android:id="@+id/map_context_menu" android:menuCategory="container">
<item android:title="@string/where_am_i" android:id="@+id/map_where_am_i" android:icon="@android:drawable/ic_menu_mylocation"></item>
<item android:id="@+id/map_layers" android:title="@string/menu_layers" android:icon="@android:drawable/ic_menu_mapmode"></item>
<item android:id="@+id/map_show_settings" android:title="@string/settings_Button" android:icon="@android:drawable/ic_menu_preferences"></item>
<!-- not visible by default -->
<item android:id="@+id/map_navigate_to_point" android:title="@string/stop_navigation" android:visible="false" android:icon="@android:drawable/ic_menu_close_clear_cancel"></item>
<item android:id="@+id/map_mute" android:title="@string/menu_mute_off" android:visible="false"></item>
<item android:id="@+id/map_get_directions" android:title="@string/get_directions" android:icon="@android:drawable/ic_menu_directions"></item>
<item android:title="@string/map_specify_point" android:id="@+id/map_specify_point" android:icon="@android:drawable/ic_menu_search"></item>
<item android:title="@string/show_gps_status" android:id="@+id/map_show_gps_status" android:icon="@android:drawable/ic_menu_compass"></item>
<item android:title="@string/map_route_by_gpx" android:id="@+id/map_gpx_routing"></item>
<item android:id="@+id/map_show_point_options" android:title="@string/show_point_options"></item>
</group>
</menu>
<?xml version="1.0" encoding="utf-8"?>
<menu
xmlns:android="http://schemas.android.com/apk/res/android">
<group android:id="@+id/map_context_menu" android:menuCategory="container">
<item android:title="@string/where_am_i" android:id="@+id/map_where_am_i" android:icon="@android:drawable/ic_menu_mylocation"></item>
<item android:id="@+id/map_layers" android:title="@string/menu_layers" android:icon="@android:drawable/ic_menu_mapmode"></item>
<item android:id="@+id/map_show_settings" android:title="@string/settings_Button" android:icon="@android:drawable/ic_menu_preferences"></item>
<!-- not visible by default -->
<item android:id="@+id/map_navigate_to_point" android:title="@string/stop_navigation" android:visible="false" android:icon="@android:drawable/ic_menu_close_clear_cancel"></item>
<item android:id="@+id/map_mute" android:title="@string/menu_mute_off" android:visible="false"></item>
<item android:id="@+id/map_get_directions" android:title="@string/get_directions" android:icon="@android:drawable/ic_menu_directions"></item>
<item android:title="@string/map_specify_point" android:id="@+id/map_specify_point" android:icon="@android:drawable/ic_menu_search"></item>
<item android:title="@string/show_gps_status" android:id="@+id/map_show_gps_status" android:icon="@android:drawable/ic_menu_compass"></item>
<item android:title="@string/map_route_by_gpx" android:id="@+id/map_gpx_routing"></item>
<item android:id="@+id/map_show_point_options" android:title="@string/show_point_options"></item>
</group>
</menu>

View file

@ -1,154 +1,154 @@
package net.osmand;
import org.apache.commons.logging.Log;
/**
* That class is replacing of standard LogFactory due to
* problems with Android implementation of LogFactory.
*
* 1. It is impossible to replace standard LogFactory (that is hidden in android.jar)
* 2. Implementation of LogFactory always creates Logger.getLogger(String name)
* 3. + It is possible to enable logger level by calling
* Logger.getLogger("net.osmand").setLevel(Level.ALL);
* 4. Logger goes to low level android.util.Log where android.util.Log#isLoggable(String, int) is checked
* String tag -> is string of length 23 (stripped full class name)
* 5. It is impossible to set for all tags debug level (info is default) - android.util.Log#isLoggable(String, int).
*
*/
public class LogUtil {
public static String TAG = "net.osmand"; //$NON-NLS-1$
private static class OsmandLogImplementation implements Log {
private final String fullName;
private final String name;
public OsmandLogImplementation(String name){
this.fullName = name;
this.name = fullName.substring(fullName.lastIndexOf('.') + 1);
}
@Override
public void debug(Object message) {
if(isDebugEnabled()){
android.util.Log.d(TAG, name + " " + message); //$NON-NLS-1$
}
}
@Override
public void debug(Object message, Throwable t) {
if(isDebugEnabled()){
android.util.Log.d(TAG, name + " " + message, t); //$NON-NLS-1$
}
}
@Override
public void error(Object message) {
if(isErrorEnabled()){
android.util.Log.e(TAG, name + " " + message); //$NON-NLS-1$
}
}
@Override
public void error(Object message, Throwable t) {
if(isErrorEnabled()){
android.util.Log.e(TAG, name + " " + message, t); //$NON-NLS-1$
}
}
@Override
public void fatal(Object message) {
if(isFatalEnabled()){
android.util.Log.e(TAG, name + " " + message); //$NON-NLS-1$
}
}
@Override
public void fatal(Object message, Throwable t) {
if(isFatalEnabled()){
android.util.Log.e(TAG, name + " " + message, t); //$NON-NLS-1$
}
}
@Override
public void info(Object message) {
if(isInfoEnabled()){
android.util.Log.i(TAG, name + " " + message); //$NON-NLS-1$
}
}
@Override
public void info(Object message, Throwable t) {
if(isInfoEnabled()){
android.util.Log.i(TAG, name + " " + message, t); //$NON-NLS-1$
}
}
@Override
public boolean isDebugEnabled() {
// For debur purposes always true
// return android.util.Log.isLoggable(TAG, android.util.Log.DEBUG);
return true;
}
@Override
public boolean isErrorEnabled() {
return android.util.Log.isLoggable(TAG, android.util.Log.ERROR);
}
@Override
public boolean isFatalEnabled() {
return android.util.Log.isLoggable(TAG, android.util.Log.ERROR);
}
@Override
public boolean isInfoEnabled() {
return android.util.Log.isLoggable(TAG, android.util.Log.INFO);
}
@Override
public boolean isTraceEnabled() {
return android.util.Log.isLoggable(TAG, android.util.Log.DEBUG);
}
@Override
public boolean isWarnEnabled() {
return android.util.Log.isLoggable(TAG, android.util.Log.WARN);
}
@Override
public void trace(Object message) {
if(isTraceEnabled()){
android.util.Log.d(TAG, name + " " + message); //$NON-NLS-1$
}
}
@Override
public void trace(Object message, Throwable t) {
if(isTraceEnabled()){
android.util.Log.d(TAG, name + " " + message, t); //$NON-NLS-1$
}
}
@Override
public void warn(Object message) {
if(isWarnEnabled()){
android.util.Log.w(TAG, name + " " + message); //$NON-NLS-1$
}
}
@Override
public void warn(Object message, Throwable t) {
if(isWarnEnabled()){
android.util.Log.w(TAG, name + " " + message, t); //$NON-NLS-1$
}
}
}
public static Log getLog(String name){
return new OsmandLogImplementation(name);
}
public static Log getLog(Class<?> cl){
return getLog(cl.getName());
}
}
package net.osmand;
import org.apache.commons.logging.Log;
/**
* That class is replacing of standard LogFactory due to
* problems with Android implementation of LogFactory.
*
* 1. It is impossible to replace standard LogFactory (that is hidden in android.jar)
* 2. Implementation of LogFactory always creates Logger.getLogger(String name)
* 3. + It is possible to enable logger level by calling
* Logger.getLogger("net.osmand").setLevel(Level.ALL);
* 4. Logger goes to low level android.util.Log where android.util.Log#isLoggable(String, int) is checked
* String tag -> is string of length 23 (stripped full class name)
* 5. It is impossible to set for all tags debug level (info is default) - android.util.Log#isLoggable(String, int).
*
*/
public class LogUtil {
public static String TAG = "net.osmand"; //$NON-NLS-1$
private static class OsmandLogImplementation implements Log {
private final String fullName;
private final String name;
public OsmandLogImplementation(String name){
this.fullName = name;
this.name = fullName.substring(fullName.lastIndexOf('.') + 1);
}
@Override
public void debug(Object message) {
if(isDebugEnabled()){
android.util.Log.d(TAG, name + " " + message); //$NON-NLS-1$
}
}
@Override
public void debug(Object message, Throwable t) {
if(isDebugEnabled()){
android.util.Log.d(TAG, name + " " + message, t); //$NON-NLS-1$
}
}
@Override
public void error(Object message) {
if(isErrorEnabled()){
android.util.Log.e(TAG, name + " " + message); //$NON-NLS-1$
}
}
@Override
public void error(Object message, Throwable t) {
if(isErrorEnabled()){
android.util.Log.e(TAG, name + " " + message, t); //$NON-NLS-1$
}
}
@Override
public void fatal(Object message) {
if(isFatalEnabled()){
android.util.Log.e(TAG, name + " " + message); //$NON-NLS-1$
}
}
@Override
public void fatal(Object message, Throwable t) {
if(isFatalEnabled()){
android.util.Log.e(TAG, name + " " + message, t); //$NON-NLS-1$
}
}
@Override
public void info(Object message) {
if(isInfoEnabled()){
android.util.Log.i(TAG, name + " " + message); //$NON-NLS-1$
}
}
@Override
public void info(Object message, Throwable t) {
if(isInfoEnabled()){
android.util.Log.i(TAG, name + " " + message, t); //$NON-NLS-1$
}
}
@Override
public boolean isDebugEnabled() {
// For debur purposes always true
// return android.util.Log.isLoggable(TAG, android.util.Log.DEBUG);
return true;
}
@Override
public boolean isErrorEnabled() {
return android.util.Log.isLoggable(TAG, android.util.Log.ERROR);
}
@Override
public boolean isFatalEnabled() {
return android.util.Log.isLoggable(TAG, android.util.Log.ERROR);
}
@Override
public boolean isInfoEnabled() {
return android.util.Log.isLoggable(TAG, android.util.Log.INFO);
}
@Override
public boolean isTraceEnabled() {
return android.util.Log.isLoggable(TAG, android.util.Log.DEBUG);
}
@Override
public boolean isWarnEnabled() {
return android.util.Log.isLoggable(TAG, android.util.Log.WARN);
}
@Override
public void trace(Object message) {
if(isTraceEnabled()){
android.util.Log.d(TAG, name + " " + message); //$NON-NLS-1$
}
}
@Override
public void trace(Object message, Throwable t) {
if(isTraceEnabled()){
android.util.Log.d(TAG, name + " " + message, t); //$NON-NLS-1$
}
}
@Override
public void warn(Object message) {
if(isWarnEnabled()){
android.util.Log.w(TAG, name + " " + message); //$NON-NLS-1$
}
}
@Override
public void warn(Object message, Throwable t) {
if(isWarnEnabled()){
android.util.Log.w(TAG, name + " " + message, t); //$NON-NLS-1$
}
}
}
public static Log getLog(String name){
return new OsmandLogImplementation(name);
}
public static Log getLog(Class<?> cl){
return getLog(cl.getName());
}
}

View file

@ -1,124 +1,124 @@
:- op('==', xfy, 500).
version(0).
% before each announcement (beep)
preamble - [].
%% TURNS
turn('left', ['turn.ogg', 'left-e.ogg']).
turn('left_sh', ['sharp_left-e.ogg']).
turn('left_sl', ['turn.ogg', 'left-e.ogg']).
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).
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.
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).
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?
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_for-h.ogg', delay_250, D]:- distance(Dist) == D.
go_ahead == ['continue_straight-e.ogg'].
%%
nth(1, '1st.ogg').
nth(2, '2nd.ogg').
nth(3, '3rd.ogg').
nth(4, '4th.ogg').
nth(5, '5th.ogg').
nth(6, '6th.ogg').
nth(7, '7th.ogg').
nth(8, '8th.ogg').
nth(9, '9th.ogg').
nth(10, '10th.ogg').
nth(11, '11th.ogg').
nth(12, '12th.ogg').
nth(13, '13th.ogg').
nth(14, '14th.ogg').
nth(15, '15th.ogg').
nth(16, '16th.ogg').
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, ['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).
%% 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, Acc, [X|Acc]).
resolve(X, Y) :- resolve_impl(X,Z), flatten(Z, Y).
resolve_impl([],[]).
:- op('==', xfy, 500).
version(0).
% before each announcement (beep)
preamble - [].
%% TURNS
turn('left', ['turn.ogg', 'left-e.ogg']).
turn('left_sh', ['sharp_left-e.ogg']).
turn('left_sl', ['turn.ogg', 'left-e.ogg']).
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).
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.
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).
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?
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_for-h.ogg', delay_250, D]:- distance(Dist) == D.
go_ahead == ['continue_straight-e.ogg'].
%%
nth(1, '1st.ogg').
nth(2, '2nd.ogg').
nth(3, '3rd.ogg').
nth(4, '4th.ogg').
nth(5, '5th.ogg').
nth(6, '6th.ogg').
nth(7, '7th.ogg').
nth(8, '8th.ogg').
nth(9, '9th.ogg').
nth(10, '10th.ogg').
nth(11, '11th.ogg').
nth(12, '12th.ogg').
nth(13, '13th.ogg').
nth(14, '14th.ogg').
nth(15, '15th.ogg').
nth(16, '16th.ogg').
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, ['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).
%% 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, 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).

View file

@ -1,116 +1,116 @@
:- op('==', xfy, 500).
version(0).
% before each announcement (beep)
preamble - [].
%% TURNS
turn('left', ['turn.ogg', delay_350, 'left.ogg']).
turn('left_sh', ['turn_sharply.ogg', delay_350, 'left.ogg']).
turn('left_sl', ['turn_slightly_left.ogg']).
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).
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.
make_ut == ['Turn_back.ogg'].
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).
roundabout(_Angle, Exit) == ['DO.ogg', delay_250, E, 'the_exit.ogg'] :- nth(Exit, E).
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'].
%%
nth(1, '1st.ogg').
nth(2, '2nd.ogg').
nth(3, '3rd.ogg').
nth(4, '4th.ogg').
nth(5, '5th.ogg').
nth(6, '6th.ogg').
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, '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).
%% 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, Acc, [X|Acc]).
resolve(X, Y) :- resolve_impl(X,Z), flatten(Z, Y).
resolve_impl([],[]).
:- op('==', xfy, 500).
version(0).
% before each announcement (beep)
preamble - [].
%% TURNS
turn('left', ['turn.ogg', delay_350, 'left.ogg']).
turn('left_sh', ['turn_sharply.ogg', delay_350, 'left.ogg']).
turn('left_sl', ['turn_slightly_left.ogg']).
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).
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.
make_ut == ['Turn_back.ogg'].
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).
roundabout(_Angle, Exit) == ['DO.ogg', delay_250, E, 'the_exit.ogg'] :- nth(Exit, E).
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'].
%%
nth(1, '1st.ogg').
nth(2, '2nd.ogg').
nth(3, '3rd.ogg').
nth(4, '4th.ogg').
nth(5, '5th.ogg').
nth(6, '6th.ogg').
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, '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).
%% 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, 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).

View file

@ -1,124 +1,124 @@
:- op('==', xfy, 500).
version(0).
% before each announcement (beep)
preamble - [].
%% TURNS
turn('left', ['turn_left-e.ogg']).
turn('left_sh', ['turn_sharp_left-e.ogg']).
turn('left_sl', ['turn_slightly_left-e.ogg']).
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).
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.
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_the.ogg',
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?
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'].
%%
nth(1, '1st.ogg').
nth(2, '2nd.ogg').
nth(3, '3rd.ogg').
nth(4, '4th.ogg').
nth(5, '5th.ogg').
nth(6, '6th.ogg').
nth(7, '7th.ogg').
nth(8, '8th.ogg').
nth(9, '9th.ogg').
nth(10, '10th.ogg').
nth(11, '11th.ogg').
nth(12, '12th.ogg').
nth(13, '13th.ogg').
nth(14, '14th.ogg').
nth(15, '15th.ogg').
nth(16, '16th.ogg').
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, ['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', 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, Acc, [X|Acc]).
resolve(X, Y) :- resolve_impl(X,Z), flatten(Z, Y).
resolve_impl([],[]).
:- op('==', xfy, 500).
version(0).
% before each announcement (beep)
preamble - [].
%% TURNS
turn('left', ['turn_left-e.ogg']).
turn('left_sh', ['turn_sharp_left-e.ogg']).
turn('left_sl', ['turn_slightly_left-e.ogg']).
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).
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.
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_the.ogg',
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?
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'].
%%
nth(1, '1st.ogg').
nth(2, '2nd.ogg').
nth(3, '3rd.ogg').
nth(4, '4th.ogg').
nth(5, '5th.ogg').
nth(6, '6th.ogg').
nth(7, '7th.ogg').
nth(8, '8th.ogg').
nth(9, '9th.ogg').
nth(10, '10th.ogg').
nth(11, '11th.ogg').
nth(12, '12th.ogg').
nth(13, '13th.ogg').
nth(14, '14th.ogg').
nth(15, '15th.ogg').
nth(16, '16th.ogg').
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, ['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', 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, 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).