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 #Thu Apr 29 00:40:57 EEST 2010
eclipse.preferences.version=1 eclipse.preferences.version=1
encoding/<project>=UTF-8 encoding/<project>=UTF-8

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,23 +1,23 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<menu <menu
xmlns:android="http://schemas.android.com/apk/res/android"> xmlns:android="http://schemas.android.com/apk/res/android">
<group android:id="@+id/map_context_menu" android:menuCategory="container"> <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: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_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> <item android:id="@+id/map_show_settings" android:title="@string/settings_Button" android:icon="@android:drawable/ic_menu_preferences"></item>
<!-- not visible by default --> <!-- 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_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_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: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/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/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: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> <item android:id="@+id/map_show_point_options" android:title="@string/show_point_options"></item>
</group> </group>
</menu> </menu>

View file

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

View file

@ -1,124 +1,124 @@
:- op('==', xfy, 500). :- op('==', xfy, 500).
version(0). version(0).
% before each announcement (beep) % before each announcement (beep)
preamble - []. preamble - [].
%% TURNS %% TURNS
turn('left', ['turn.ogg', 'left-e.ogg']). turn('left', ['turn.ogg', 'left-e.ogg']).
turn('left_sh', ['sharp_left-e.ogg']). turn('left_sh', ['sharp_left-e.ogg']).
turn('left_sl', ['turn.ogg', 'left-e.ogg']). turn('left_sl', ['turn.ogg', 'left-e.ogg']).
turn('right', ['turn.ogg', 'right-e.ogg']). turn('right', ['turn.ogg', 'right-e.ogg']).
turn('right_sh', ['sharp_right-e.ogg']). turn('right_sh', ['sharp_right-e.ogg']).
turn('right_sl', ['turn.ogg', '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] :- prepare_turn(Turn, Dist) == ['Prepare_to-a.ogg', 'after-m.ogg', delay_450, D, delay_450, M] :-
distance(Dist) == D, turn(Turn, M). distance(Dist) == D, turn(Turn, M).
turn(Turn, Dist) == ['after-m.ogg', delay_250, D, delay_250, M] :- turn(Turn, Dist) == ['after-m.ogg', delay_250, D, delay_250, M] :-
distance(Dist) == D, turn(Turn, M). distance(Dist) == D, turn(Turn, M).
turn(Turn) == M :- 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'] :- prepare_make_ut(Dist) == ['Prepare_to-a.ogg', 'after-m.ogg', delay_300, D, delay_300,'turn_back-e.ogg'] :-
distance(Dist) == D. distance(Dist) == D.
prepare_roundabout(Dist) == ['prepare_to-enter.ogg', 'after-m.ogg', delay_300, D] :- prepare_roundabout(Dist) == ['prepare_to-enter.ogg', 'after-m.ogg', delay_300, D] :-
distance(Dist) == D. distance(Dist) == D.
make_ut(Dist) == ['after-m.ogg', delay_300, D, delay_300, 'turn_back-e.ogg'] :- make_ut(Dist) == ['after-m.ogg', delay_300, D, delay_300, 'turn_back-e.ogg'] :-
distance(Dist) == D. distance(Dist) == D.
make_ut == ['turn_back-e.ogg']. 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', 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). 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). 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? and_arrive_destination == ['arrive_at_your_destination-e.ogg']. % Miss and?
then == ['then.ogg', delay_350]. then == ['then.ogg', delay_350].
reached_destination == ['you_have_reached_your_destination.ogg']. reached_destination == ['you_have_reached_your_destination.ogg'].
bear_right == ['keep_right-e.ogg']. bear_right == ['keep_right-e.ogg'].
bear_left == ['keep_left-e.ogg']. bear_left == ['keep_left-e.ogg'].
route_recalc(_Dist) == []. % ['recalc.ogg']. %nothing to said possibly beep? 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? 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(Dist) == ['drive_for-h.ogg', delay_250, D]:- distance(Dist) == D.
go_ahead == ['continue_straight-e.ogg']. go_ahead == ['continue_straight-e.ogg'].
%% %%
nth(1, '1st.ogg'). nth(1, '1st.ogg').
nth(2, '2nd.ogg'). nth(2, '2nd.ogg').
nth(3, '3rd.ogg'). nth(3, '3rd.ogg').
nth(4, '4th.ogg'). nth(4, '4th.ogg').
nth(5, '5th.ogg'). nth(5, '5th.ogg').
nth(6, '6th.ogg'). nth(6, '6th.ogg').
nth(7, '7th.ogg'). nth(7, '7th.ogg').
nth(8, '8th.ogg'). nth(8, '8th.ogg').
nth(9, '9th.ogg'). nth(9, '9th.ogg').
nth(10, '10th.ogg'). nth(10, '10th.ogg').
nth(11, '11th.ogg'). nth(11, '11th.ogg').
nth(12, '12th.ogg'). nth(12, '12th.ogg').
nth(13, '13th.ogg'). nth(13, '13th.ogg').
nth(14, '14th.ogg'). nth(14, '14th.ogg').
nth(15, '15th.ogg'). nth(15, '15th.ogg').
nth(16, '16th.ogg'). nth(16, '16th.ogg').
nth(17, '17th.ogg'). nth(17, '17th.ogg').
%%% distance measure %%% distance measure
distance(Dist) == T :- Dist < 1000, dist(Dist, F), append(F, 'meters-e.ogg',T). distance(Dist) == T :- Dist < 1000, dist(Dist, F), append(F, 'meters-e.ogg',T).
dist(D, ['10.ogg']) :- D < 20, !. dist(D, ['10.ogg']) :- D < 20, !.
dist(D, ['20.ogg']) :- D < 30, !. dist(D, ['20.ogg']) :- D < 30, !.
dist(D, ['30.ogg']) :- D < 40, !. dist(D, ['30.ogg']) :- D < 40, !.
dist(D, ['40.ogg']) :- D < 50, !. dist(D, ['40.ogg']) :- D < 50, !.
dist(D, ['50.ogg']) :- D < 60, !. dist(D, ['50.ogg']) :- D < 60, !.
dist(D, ['60.ogg']) :- D < 70, !. dist(D, ['60.ogg']) :- D < 70, !.
dist(D, ['70.ogg']) :- D < 80, !. dist(D, ['70.ogg']) :- D < 80, !.
dist(D, ['80.ogg']) :- D < 90, !. dist(D, ['80.ogg']) :- D < 90, !.
dist(D, ['90.ogg']) :- D < 100, !. dist(D, ['90.ogg']) :- D < 100, !.
dist(D, ['100.ogg']) :- D < 150, !. dist(D, ['100.ogg']) :- D < 150, !.
dist(D, ['100_and.ogg', '50.ogg']) :- D < 200, !. dist(D, ['100_and.ogg', '50.ogg']) :- D < 200, !.
dist(D, ['200.ogg']) :- D < 250, !. dist(D, ['200.ogg']) :- D < 250, !.
dist(D, ['200_and.ogg', '50.ogg']) :- D < 300, !. dist(D, ['200_and.ogg', '50.ogg']) :- D < 300, !.
dist(D, ['300.ogg']) :- D < 350, !. dist(D, ['300.ogg']) :- D < 350, !.
dist(D, ['300_and.ogg', '50.ogg']) :- D < 400, !. dist(D, ['300_and.ogg', '50.ogg']) :- D < 400, !.
dist(D, ['400.ogg']) :- D < 450, !. dist(D, ['400.ogg']) :- D < 450, !.
dist(D, ['400_and.ogg', '50.ogg']) :- D < 500, !. dist(D, ['400_and.ogg', '50.ogg']) :- D < 500, !.
dist(D, ['500.ogg']) :- D < 550, !. dist(D, ['500.ogg']) :- D < 550, !.
dist(D, ['500_and.ogg', '50.ogg']) :- D < 600, !. dist(D, ['500_and.ogg', '50.ogg']) :- D < 600, !.
dist(D, ['600.ogg']) :- D < 650, !. dist(D, ['600.ogg']) :- D < 650, !.
dist(D, ['600_and.ogg', '50.ogg']) :- D < 700, !. dist(D, ['600_and.ogg', '50.ogg']) :- D < 700, !.
dist(D, ['700.ogg']) :- D < 750, !. dist(D, ['700.ogg']) :- D < 750, !.
dist(D, ['700_and.ogg', '50.ogg']) :- D < 800, !. dist(D, ['700_and.ogg', '50.ogg']) :- D < 800, !.
dist(D, ['800.ogg']) :- D < 850, !. dist(D, ['800.ogg']) :- D < 850, !.
dist(D, ['800_and.ogg', '50.ogg']) :- D < 900, !. dist(D, ['800_and.ogg', '50.ogg']) :- D < 900, !.
dist(D, ['900.ogg']) :- D < 950, !. dist(D, ['900.ogg']) :- D < 950, !.
dist(D, ['900_and.ogg', '50.ogg']) :- !. dist(D, ['900_and.ogg', '50.ogg']) :- !.
distance(Dist) == ['more_than.ogg', '1.ogg', 'kilometer-e.ogg'] :- Dist < 1500. 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', '2.ogg', 'kilometers-e.ogg'] :- Dist < 3000.
distance(Dist) == ['more_than.ogg', '3.ogg', 'kilometers-e.ogg'] :- Dist < 4000. 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', '4.ogg', 'kilometers-e.ogg'] :- Dist < 5000.
distance(Dist) == ['more_than.ogg', '5.ogg', 'kilometers-e.ogg'] :- Dist < 6000. 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', '6.ogg', 'kilometers-e.ogg'] :- Dist < 7000.
distance(Dist) == ['more_than.ogg', '7.ogg', 'kilometers-e.ogg'] :- Dist < 8000. 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', '8.ogg', 'kilometers-e.ogg'] :- Dist < 9000.
distance(Dist) == ['more_than.ogg', '9.ogg', 'kilometers-e.ogg'] :- Dist < 10000. 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) == ['more_than.ogg', X, 'kilometers-e.ogg'] :- D is Dist/1000, dist(D, X).
%% resolve command main method %% resolve command main method
%% if you are familar with Prolog you can input specific to the whole mechanism, %% if you are familar with Prolog you can input specific to the whole mechanism,
%% by adding exception cases. %% by adding exception cases.
flatten(X, Y) :- flatten(X, [], Y), !. flatten(X, Y) :- flatten(X, [], Y), !.
flatten([], Acc, Acc). flatten([], Acc, Acc).
flatten([X|Y], Acc, Res):- flatten([X|Y], Acc, Res):-
flatten(Y, Acc, R), flatten(X, R, Res). flatten(Y, Acc, R), flatten(X, R, Res).
flatten(X, Acc, [X|Acc]). flatten(X, Acc, [X|Acc]).
resolve(X, Y) :- resolve_impl(X,Z), flatten(Z, Y). resolve(X, Y) :- resolve_impl(X,Z), flatten(Z, Y).
resolve_impl([],[]). 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).

View file

@ -1,116 +1,116 @@
:- op('==', xfy, 500). :- op('==', xfy, 500).
version(0). version(0).
% before each announcement (beep) % before each announcement (beep)
preamble - []. preamble - [].
%% TURNS %% TURNS
turn('left', ['turn.ogg', delay_350, 'left.ogg']). turn('left', ['turn.ogg', delay_350, 'left.ogg']).
turn('left_sh', ['turn_sharply.ogg', delay_350, 'left.ogg']). turn('left_sh', ['turn_sharply.ogg', delay_350, 'left.ogg']).
turn('left_sl', ['turn_slightly_left.ogg']). turn('left_sl', ['turn_slightly_left.ogg']).
turn('right', ['turn.ogg', delay_350, 'right.ogg']). turn('right', ['turn.ogg', delay_350, 'right.ogg']).
turn('right_sh', ['turn_sharply.ogg', delay_350,'right.ogg']). turn('right_sh', ['turn_sharply.ogg', delay_350,'right.ogg']).
turn('right_sl', ['turn_slightly_right.ogg']). turn('right_sl', ['turn_slightly_right.ogg']).
prepare_turn(Turn, Dist) == ['Prepare_to.ogg', 'in.ogg', delay_300, D, delay_300, M] :- prepare_turn(Turn, Dist) == ['Prepare_to.ogg', 'in.ogg', delay_300, D, delay_300, M] :-
distance(Dist) == D, turn(Turn, M). distance(Dist) == D, turn(Turn, M).
turn(Turn, Dist) == ['in.ogg', delay_250, D, delay_250, M] :- turn(Turn, Dist) == ['in.ogg', delay_250, D, delay_250, M] :-
distance(Dist) == D, turn(Turn, M). distance(Dist) == D, turn(Turn, M).
turn(Turn) == M :- 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'] :- prepare_make_ut(Dist) == ['Prepare_to.ogg', 'in.ogg', delay_300, D, delay_300,'Turn_back.ogg'] :-
distance(Dist) == D. distance(Dist) == D.
prepare_roundabout(Dist) == ['Prepare_to.ogg', 'in.ogg', delay_300, D, delay_300, 'roundabout.ogg'] :- prepare_roundabout(Dist) == ['Prepare_to.ogg', 'in.ogg', delay_300, D, delay_300, 'roundabout.ogg'] :-
distance(Dist) == D. distance(Dist) == D.
make_ut(Dist) == ['in.ogg', delay_300, D, delay_300, 'Turn_back.ogg'] :- make_ut(Dist) == ['in.ogg', delay_300, D, delay_300, 'Turn_back.ogg'] :-
distance(Dist) == D. distance(Dist) == D.
make_ut == ['Turn_back.ogg']. 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'] :- 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). roundabout(_Angle, Exit) == ['DO.ogg', delay_250, E, 'the_exit.ogg'] :- nth(Exit, E).
and_arrive_destination == ['arrive_at_destination.ogg']. and_arrive_destination == ['arrive_at_destination.ogg'].
then == ['then.ogg', delay_350]. then == ['then.ogg', delay_350].
reached_destination == ['you_reached.ogg',delay_250, 'TO_DESTINATION.ogg']. reached_destination == ['you_reached.ogg',delay_250, 'TO_DESTINATION.ogg'].
bear_right == ['bear_right.ogg']. bear_right == ['bear_right.ogg'].
bear_left == ['bear_left.ogg']. bear_left == ['bear_left.ogg'].
route_recalc(_Dist) == []. % 'recalc.ogg' route_recalc(_Dist) == []. % 'recalc.ogg'
route_new_calc(_Dist) == ['have_a_nice_trip_drive_carefully.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(Dist) == ['Drive.ogg', delay_250, D]:- distance(Dist) == D.
go_ahead == ['continue.ogg', 'stright.ogg']. go_ahead == ['continue.ogg', 'stright.ogg'].
%% %%
nth(1, '1st.ogg'). nth(1, '1st.ogg').
nth(2, '2nd.ogg'). nth(2, '2nd.ogg').
nth(3, '3rd.ogg'). nth(3, '3rd.ogg').
nth(4, '4th.ogg'). nth(4, '4th.ogg').
nth(5, '5th.ogg'). nth(5, '5th.ogg').
nth(6, '6th.ogg'). nth(6, '6th.ogg').
nth(7, '7th.ogg'). nth(7, '7th.ogg').
nth(8, '8th.ogg'). nth(8, '8th.ogg').
nth(9, '9th.ogg'). nth(9, '9th.ogg').
%%% distance measure %%% distance measure
distance(Dist) == [F, 'meters.ogg'] :- Dist < 1000, dist(Dist, F). distance(Dist) == [F, 'meters.ogg'] :- Dist < 1000, dist(Dist, F).
dist(D, '10.ogg') :- D < 20, !. dist(D, '10.ogg') :- D < 20, !.
dist(D, '20.ogg') :- D < 30, !. dist(D, '20.ogg') :- D < 30, !.
dist(D, '30.ogg') :- D < 40, !. dist(D, '30.ogg') :- D < 40, !.
dist(D, '40.ogg') :- D < 50, !. dist(D, '40.ogg') :- D < 50, !.
dist(D, '50.ogg') :- D < 60, !. dist(D, '50.ogg') :- D < 60, !.
dist(D, '60.ogg') :- D < 70, !. dist(D, '60.ogg') :- D < 70, !.
dist(D, '70.ogg') :- D < 80, !. dist(D, '70.ogg') :- D < 80, !.
dist(D, '80.ogg') :- D < 90, !. dist(D, '80.ogg') :- D < 90, !.
dist(D, '90.ogg') :- D < 100, !. dist(D, '90.ogg') :- D < 100, !.
dist(D, '100.ogg') :- D < 150, !. dist(D, '100.ogg') :- D < 150, !.
dist(D, '150.ogg') :- D < 200, !. dist(D, '150.ogg') :- D < 200, !.
dist(D, '200.ogg') :- D < 250, !. dist(D, '200.ogg') :- D < 250, !.
dist(D, '250.ogg') :- D < 300, !. dist(D, '250.ogg') :- D < 300, !.
dist(D, '300.ogg') :- D < 350, !. dist(D, '300.ogg') :- D < 350, !.
dist(D, '350.ogg') :- D < 400, !. dist(D, '350.ogg') :- D < 400, !.
dist(D, '400.ogg') :- D < 450, !. dist(D, '400.ogg') :- D < 450, !.
dist(D, '450.ogg') :- D < 500, !. dist(D, '450.ogg') :- D < 500, !.
dist(D, '500.ogg') :- D < 550, !. dist(D, '500.ogg') :- D < 550, !.
dist(D, '550.ogg') :- D < 600, !. dist(D, '550.ogg') :- D < 600, !.
dist(D, '600.ogg') :- D < 650, !. dist(D, '600.ogg') :- D < 650, !.
dist(D, '650.ogg') :- D < 700, !. dist(D, '650.ogg') :- D < 700, !.
dist(D, '700.ogg') :- D < 750, !. dist(D, '700.ogg') :- D < 750, !.
dist(D, '750.ogg') :- D < 800, !. dist(D, '750.ogg') :- D < 800, !.
dist(D, '800.ogg') :- D < 850, !. dist(D, '800.ogg') :- D < 850, !.
dist(D, '850.ogg') :- D < 900, !. dist(D, '850.ogg') :- D < 900, !.
dist(D, '900.ogg') :- D < 950, !. dist(D, '900.ogg') :- D < 950, !.
dist(D, '950.ogg') :- !. dist(D, '950.ogg') :- !.
distance(Dist) == ['more_than.ogg', '1.ogg', 'kilometr.ogg'] :- Dist < 1500. 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', '1.5k.ogg', 'kilometra.ogg'] :- Dist < 2000.
distance(Dist) == ['more_than.ogg', '2.ogg', 'kilometra.ogg'] :- Dist < 3000. 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', '3.ogg', 'kilometra.ogg'] :- Dist < 4000.
distance(Dist) == ['more_than.ogg', '4.ogg', 'kilometra.ogg'] :- Dist < 5000. 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', '5.ogg', 'kilometrov.ogg'] :- Dist < 6000.
distance(Dist) == ['more_than.ogg', '6.ogg', 'kilometrov.ogg'] :- Dist < 7000. 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', '7.ogg', 'kilometrov.ogg'] :- Dist < 8000.
distance(Dist) == ['more_than.ogg', '8.ogg', 'kilometrov.ogg'] :- Dist < 9000. 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', '9.ogg', 'kilometrov.ogg'] :- Dist < 10000.
distance(Dist) == ['more_than.ogg', X, 'kilometrov.ogg'] :- D is Dist/1000, dist(D, X). distance(Dist) == ['more_than.ogg', X, 'kilometrov.ogg'] :- D is Dist/1000, dist(D, X).
%% resolve command main method %% resolve command main method
%% if you are familar with Prolog you can input specific to the whole mechanism, %% if you are familar with Prolog you can input specific to the whole mechanism,
%% by adding exception cases. %% by adding exception cases.
flatten(X, Y) :- flatten(X, [], Y), !. flatten(X, Y) :- flatten(X, [], Y), !.
flatten([], Acc, Acc). flatten([], Acc, Acc).
flatten([X|Y], Acc, Res):- flatten([X|Y], Acc, Res):-
flatten(Y, Acc, R), flatten(X, R, Res). flatten(Y, Acc, R), flatten(X, R, Res).
flatten(X, Acc, [X|Acc]). flatten(X, Acc, [X|Acc]).
resolve(X, Y) :- resolve_impl(X,Z), flatten(Z, Y). resolve(X, Y) :- resolve_impl(X,Z), flatten(Z, Y).
resolve_impl([],[]). 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).

View file

@ -1,124 +1,124 @@
:- op('==', xfy, 500). :- op('==', xfy, 500).
version(0). version(0).
% before each announcement (beep) % before each announcement (beep)
preamble - []. preamble - [].
%% TURNS %% TURNS
turn('left', ['turn_left-e.ogg']). turn('left', ['turn_left-e.ogg']).
turn('left_sh', ['turn_sharp_left-e.ogg']). turn('left_sh', ['turn_sharp_left-e.ogg']).
turn('left_sl', ['turn_slightly_left-e.ogg']). turn('left_sl', ['turn_slightly_left-e.ogg']).
turn('right', ['turn_right-e.ogg']). turn('right', ['turn_right-e.ogg']).
turn('right_sh', ['turn_sharp_right-e.ogg']). turn('right_sh', ['turn_sharp_right-e.ogg']).
turn('right_sl', ['turn_slightly_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] :- prepare_turn(Turn, Dist) == ['Prepare_to.ogg', 'after-m.ogg', delay_300, D, delay_300, M] :-
distance(Dist) == D, turn(Turn, M). distance(Dist) == D, turn(Turn, M).
turn(Turn, Dist) == ['after-m.ogg', delay_300, D, delay_300, M] :- turn(Turn, Dist) == ['after-m.ogg', delay_300, D, delay_300, M] :-
distance(Dist) == D, turn(Turn, M). distance(Dist) == D, turn(Turn, M).
turn(Turn) == M :- 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'] :- prepare_make_ut(Dist) == ['Prepare_to.ogg', 'after-m.ogg', delay_300, D, delay_300,'turn_back-e.ogg'] :-
distance(Dist) == D. distance(Dist) == D.
prepare_roundabout(Dist) == ['Prepare_to.ogg', 'after-m.ogg', delay_300, D, delay_300, 'cross_the_roundabout-e.ogg'] :- prepare_roundabout(Dist) == ['Prepare_to.ogg', 'after-m.ogg', delay_300, D, delay_300, 'cross_the_roundabout-e.ogg'] :-
distance(Dist) == D. distance(Dist) == D.
make_ut(Dist) == ['after-m.ogg', delay_300, D, delay_300, 'turn_back-e.ogg'] :- make_ut(Dist) == ['after-m.ogg', delay_300, D, delay_300, 'turn_back-e.ogg'] :-
distance(Dist) == D. distance(Dist) == D.
make_ut == ['turn_back-e.ogg']. 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', 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). 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? and_arrive_destination == ['arrive_at_your_destination-e.ogg']. % Miss and?
then == ['then.ogg', delay_350]. then == ['then.ogg', delay_350].
reached_destination == ['you_have_reached_your_destination.ogg']. reached_destination == ['you_have_reached_your_destination.ogg'].
bear_right == ['keep_right-e.ogg']. bear_right == ['keep_right-e.ogg'].
bear_left == ['keep_left-e.ogg']. bear_left == ['keep_left-e.ogg'].
route_recalc(_Dist) == []. % ['recalc.ogg']. %nothing to said possibly beep? 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? 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(Dist) == ['Drive-n.ogg', delay_250, D]:- distance(Dist) == D.
go_ahead == ['continue_straight-e.ogg']. go_ahead == ['continue_straight-e.ogg'].
%% %%
nth(1, '1st.ogg'). nth(1, '1st.ogg').
nth(2, '2nd.ogg'). nth(2, '2nd.ogg').
nth(3, '3rd.ogg'). nth(3, '3rd.ogg').
nth(4, '4th.ogg'). nth(4, '4th.ogg').
nth(5, '5th.ogg'). nth(5, '5th.ogg').
nth(6, '6th.ogg'). nth(6, '6th.ogg').
nth(7, '7th.ogg'). nth(7, '7th.ogg').
nth(8, '8th.ogg'). nth(8, '8th.ogg').
nth(9, '9th.ogg'). nth(9, '9th.ogg').
nth(10, '10th.ogg'). nth(10, '10th.ogg').
nth(11, '11th.ogg'). nth(11, '11th.ogg').
nth(12, '12th.ogg'). nth(12, '12th.ogg').
nth(13, '13th.ogg'). nth(13, '13th.ogg').
nth(14, '14th.ogg'). nth(14, '14th.ogg').
nth(15, '15th.ogg'). nth(15, '15th.ogg').
nth(16, '16th.ogg'). nth(16, '16th.ogg').
nth(17, '17th.ogg'). nth(17, '17th.ogg').
%%% distance measure %%% distance measure
distance(Dist) == T :- Dist < 1000, dist(Dist, F), append(F, 'meters-10-e.ogg',T). distance(Dist) == T :- Dist < 1000, dist(Dist, F), append(F, 'meters-10-e.ogg',T).
dist(D, ['10.ogg']) :- D < 20, !. dist(D, ['10.ogg']) :- D < 20, !.
dist(D, ['20.ogg']) :- D < 30, !. dist(D, ['20.ogg']) :- D < 30, !.
dist(D, ['30.ogg']) :- D < 40, !. dist(D, ['30.ogg']) :- D < 40, !.
dist(D, ['40.ogg']) :- D < 50, !. dist(D, ['40.ogg']) :- D < 50, !.
dist(D, ['50.ogg']) :- D < 60, !. dist(D, ['50.ogg']) :- D < 60, !.
dist(D, ['60.ogg']) :- D < 70, !. dist(D, ['60.ogg']) :- D < 70, !.
dist(D, ['70.ogg']) :- D < 80, !. dist(D, ['70.ogg']) :- D < 80, !.
dist(D, ['80.ogg']) :- D < 90, !. dist(D, ['80.ogg']) :- D < 90, !.
dist(D, ['90.ogg']) :- D < 100, !. dist(D, ['90.ogg']) :- D < 100, !.
dist(D, ['100.ogg']) :- D < 150, !. dist(D, ['100.ogg']) :- D < 150, !.
dist(D, ['100_and.ogg', 'and_50.ogg']) :- D < 200, !. dist(D, ['100_and.ogg', 'and_50.ogg']) :- D < 200, !.
dist(D, ['200.ogg']) :- D < 250, !. dist(D, ['200.ogg']) :- D < 250, !.
dist(D, ['200_and.ogg', 'and_50.ogg']) :- D < 300, !. dist(D, ['200_and.ogg', 'and_50.ogg']) :- D < 300, !.
dist(D, ['300.ogg']) :- D < 350, !. dist(D, ['300.ogg']) :- D < 350, !.
dist(D, ['300_and.ogg', 'and_50.ogg']) :- D < 400, !. dist(D, ['300_and.ogg', 'and_50.ogg']) :- D < 400, !.
dist(D, ['400.ogg']) :- D < 450, !. dist(D, ['400.ogg']) :- D < 450, !.
dist(D, ['400_and.ogg', 'and_50.ogg']) :- D < 500, !. dist(D, ['400_and.ogg', 'and_50.ogg']) :- D < 500, !.
dist(D, ['500.ogg']) :- D < 550, !. dist(D, ['500.ogg']) :- D < 550, !.
dist(D, ['500_and.ogg', 'and_50.ogg']) :- D < 600, !. dist(D, ['500_and.ogg', 'and_50.ogg']) :- D < 600, !.
dist(D, ['600.ogg']) :- D < 650, !. dist(D, ['600.ogg']) :- D < 650, !.
dist(D, ['600_and.ogg', 'and_50.ogg']) :- D < 700, !. dist(D, ['600_and.ogg', 'and_50.ogg']) :- D < 700, !.
dist(D, ['700.ogg']) :- D < 750, !. dist(D, ['700.ogg']) :- D < 750, !.
dist(D, ['700_and.ogg', 'and_50.ogg']) :- D < 800, !. dist(D, ['700_and.ogg', 'and_50.ogg']) :- D < 800, !.
dist(D, ['800.ogg']) :- D < 850, !. dist(D, ['800.ogg']) :- D < 850, !.
dist(D, ['800_and.ogg', 'and_50.ogg']) :- D < 900, !. dist(D, ['800_and.ogg', 'and_50.ogg']) :- D < 900, !.
dist(D, ['900.ogg']) :- D < 950, !. dist(D, ['900.ogg']) :- D < 950, !.
dist(D, ['900_and.ogg', 'and_50.ogg']) :- !. 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', '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', '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', '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', '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', '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', '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', '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', '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', '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). distance(Dist) == ['more_than.ogg', X, 'kilometers-200-e.ogg'] :- D is Dist/1000, dist(D, X).
%% resolve command main method %% resolve command main method
%% if you are familar with Prolog you can input specific to the whole mechanism, %% if you are familar with Prolog you can input specific to the whole mechanism,
%% by adding exception cases. %% by adding exception cases.
flatten(X, Y) :- flatten(X, [], Y), !. flatten(X, Y) :- flatten(X, [], Y), !.
flatten([], Acc, Acc). flatten([], Acc, Acc).
flatten([X|Y], Acc, Res):- flatten([X|Y], Acc, Res):-
flatten(Y, Acc, R), flatten(X, R, Res). flatten(Y, Acc, R), flatten(X, R, Res).
flatten(X, Acc, [X|Acc]). flatten(X, Acc, [X|Acc]).
resolve(X, Y) :- resolve_impl(X,Z), flatten(Z, Y). resolve(X, Y) :- resolve_impl(X,Z), flatten(Z, Y).
resolve_impl([],[]). 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).