<?xml version='1.0' encoding="utf-8"?>
      <rss version='2.0'>
      <channel>
      <title>Форум на Исходниках.RU</title>
      <link>https://forum.sources.ru</link>
      <description>Форум на Исходниках.RU</description>
      <generator>Форум на Исходниках.RU</generator>
  	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=367557&amp;view=findpost&amp;p=3235700</guid>
        <pubDate>Sat, 10 Nov 2012 20:39:02 +0000</pubDate>
        <title>Экспертная система (Turbo Prolog)</title>
        <link>https://forum.sources.ru/index.php?showtopic=367557&amp;view=findpost&amp;p=3235700</link>
        <description><![CDATA[Gabbi: Есть программа экспертной системы по подборе сотового телефона. Все работает нормально, только нужно добавить одну вещь... Нужно чтобы после того как система выдала нам один вариант телефона, она задавала следующий вопрос: &quot;Выберите следующий вариант из списка.&quot; и вылетает список из трех элементов: 1. Показать телефон подешевле. 2. Показать телефон подороже. 3. Данная модель меня устраивает. Нужно сделать проверку по стоимости и при нажатии 1 или 2 выдавал другую модель телефона с такими же параметрами. Ну а при нажатии 3 просто завершала работу.<br>
Вот код программы:<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">database</div><div class="code_line">&nbsp;&nbsp;yes(string)</div><div class="code_line">&nbsp;&nbsp;no(string)</div><div class="code_line">&nbsp;&nbsp;maybe(string)</div><div class="code_line">&nbsp;</div><div class="code_line">predicates</div><div class="code_line">&nbsp;&nbsp;repeat</div><div class="code_line">&nbsp;&nbsp;run</div><div class="code_line">&nbsp;&nbsp;tel(string,integer)</div><div class="code_line">&nbsp;&nbsp;is(string)</div><div class="code_line">&nbsp;&nbsp;positive(string)</div><div class="code_line">&nbsp;&nbsp;negative(string)</div><div class="code_line">&nbsp;&nbsp;xpositive(string)</div><div class="code_line">&nbsp;&nbsp;xnegative(string)</div><div class="code_line">&nbsp;&nbsp;ask(string,char)</div><div class="code_line">&nbsp;&nbsp;remember(string,char)</div><div class="code_line">&nbsp;&nbsp;delete_all</div><div class="code_line">clauses</div><div class="code_line">&nbsp;&nbsp;repeat.</div><div class="code_line">&nbsp;&nbsp;repeat:-repeat.</div><div class="code_line">%-----------------------------------------------------------------------------</div><div class="code_line">% описываем технические характеристики сотового телефона</div><div class="code_line">&nbsp;&nbsp;tel(&quot;Nokia 1202&quot;, 1000):- positive(&quot;цветной дисплей&quot;),positive(&quot;емкий аккумулятор&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; negative(&quot;имеет камеру&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; negative(&quot;имеет FM-радио&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; negative(&quot;имеет Mp3-плеер&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; is(&quot;только для связи&quot;).</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp;tel(&quot;Nokia 1208&quot;, 1190):-positive(&quot;цветной дисплей&quot;),positive(&quot;емкий аккумулятор&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; negative(&quot;имеет камеру&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; negative(&quot;имеет FM-радио&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; negative(&quot;имеет Mp3-плеер&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; is(&quot;только для связи&quot;).</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp;tel(&quot;Samsung E1070&quot;, 890):- positive(&quot;цветной дисплей&quot;),positive(&quot;емкий аккумулятор&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; negative(&quot;имеет камеру&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; negative(&quot;имеет FM-радио&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; negative(&quot;имеет Mp3-плеер&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; is(&quot;только для связи&quot;).</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp;tel(&quot;Nokia 2630&quot;, 2490):-positive(&quot;цветной дисплей&quot;),positive(&quot;емкий аккумулятор&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;negative (&quot;имеет камеру&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive (&quot;имеет FM-радио&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; negative(&quot;имеет Mp3-плеер&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; is(&quot;только для связи&quot;), is(&quot;развлечения и музыка&quot;).</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp;tel(&quot;LG KP105&quot;, 1490):- positive(&quot;цветной дисплей&quot;),positive(&quot;емкий аккумулятор&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; negative (&quot;имеет камеру&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive (&quot;имеет FM-радио&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; negative(&quot;имеет Mp3-плеер&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; is(&quot;только для связи&quot;).</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp;tel(&quot;LG GB110&quot;, 2550):- positive(&quot;цветной дисплей&quot;),positive(&quot;емкий аккумулятор&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; negative (&quot;имеет камеру&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive (&quot;имеет FM-радио&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;negative (&quot;имеет Mp3-плеер&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; is(&quot;только для связи&quot;), is(&quot;развлечения и музыка&quot;).</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp;tel(&quot;Nokia E52&quot;, 12990):- positive(&quot;цветной дисплей&quot;), positive (&quot;емкий аккумулятор&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive (&quot;имеет камеру&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive (&quot;имеет FM-радио&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive (&quot;имеет флэш-карту&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; negative(&quot;имеет навигацию&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; negative(&quot;имеет Mp3-плеер&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; is(&quot;мобильный офис&quot;).</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp;tel(&quot;Nokia E66&quot;, 11890):- positive(&quot;цветной дисплей&quot;), positive (&quot;емкий аккумулятор&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive (&quot;имеет камеру&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive (&quot;имеет FM-радио&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive (&quot;имеет флэш-карту&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; negative (&quot;имеет навигацию&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; negative(&quot;имеет Mp3-плеер&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; is(&quot;мобильный офис&quot;), &nbsp;is(&quot;помощник в путешествиях&quot;).</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp;tel(&quot;Nokia E63&quot;, 13500):- positive(&quot;цветной дисплей&quot;), positive (&quot;емкий аккумулятор&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive (&quot;имеет камеру&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive (&quot;имеет FM-радио&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive (&quot;имеет флэш-карту&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; negative (&quot;имеет навигацию&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; negative(&quot;имеет Mp3-плеер&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; is(&quot;мобильный офис&quot;), &nbsp;is(&quot;помощник в путешествиях&quot;).</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp;tel(&quot;Nokia 5310&quot;, 7990):- positive(&quot;цветной дисплей&quot;), positive (&quot;емкий аккумулятор&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive (&quot;имеет камеру&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive (&quot;имеет FM-радио&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive (&quot;имеет флэш-карту&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive (&quot;имеет Mp3-плеер&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; negative(&quot;сенсорный дисплей&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive (&quot;имеет дополнительные клавиши управления Mp3-плеером&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; is(&quot;развлечения и музыка&quot;).</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp;tel(&quot;Nokia 5530&quot;, 7780):- positive(&quot;цветной дисплей&quot;), positive (&quot;емкий аккумулятор&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive (&quot;имеет камеру&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive (&quot;имеет FM-радио&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive (&quot;имеет флэш-карту&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive (&quot;имеет Mp3-плеер&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; negative (&quot;сенсорный дисплей&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive (&quot;имеет дополнительные клавиши управления Mp3-плеером&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; is(&quot;развлечения и музыка&quot;).</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp;tel(&quot;Nokia 5800&quot;, 8890):- positive(&quot;цветной дисплей&quot;), positive (&quot;емкий аккумулятор&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive (&quot;имеет камеру&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive (&quot;имеет FM-радио&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive (&quot;имеет флэш-карту&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive (&quot;имеет Mp3-плеер&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; negative (&quot;сенсорный дисплей&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive (&quot;имеет дополнительные клавиши управления Mp3-плеером&quot;),</div><div class="code_line">is(&quot;развлечения и музыка&quot;), is(&quot;мобильный офис&quot;),is (&quot;помощник в путешествиях&quot;).</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp;tel(&quot;SonyEricsson W595&quot;, 8450):- positive(&quot;цветной дисплей&quot;), negative (&quot;емкий аккумулятор&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive (&quot;имеет камеру&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive (&quot;имеет FM-радио&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive (&quot;имеет флэш-карту&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive (&quot;имеет Mp3-плеер&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; negative(&quot;сенсорный дисплей&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; negative (&quot;имеет дополнительные клавиши управления Mp3-плеером&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; is(&quot;развлечения и музыка&quot;).</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp;tel(&quot;SonyEricsson W395&quot;, 7890):- positive(&quot;цветной дисплей&quot;), negative (&quot;емкий аккумулятор&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive (&quot;имеет камеру&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive (&quot;имеет FM-радио&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive (&quot;имеет флэш-карту&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive (&quot;имеет Mp3-плеер&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; negative(&quot;сенсорный дисплей&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; negative (&quot;имеет дополнительные клавиши управления Mp3-плеером&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; is(&quot;развлечения и музыка&quot;).</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp;tel(&quot;Nokia N86&quot;, 24790):- positive(&quot;цветной дисплей&quot;), positive (&quot;емкий аккумулятор&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive (&quot;имеет камеру&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive (&quot;имеет FM-радио&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive (&quot;имеет флэш-карту&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive (&quot;имеет навигацию&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive (&quot;имеет Mp3-плеер&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; negative (&quot;имеет Wi-Fi&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive (&quot;имеет дополнительную клавиатуру&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; is(&quot;помощник в путешествиях&quot;), is(&quot;мобильный офис&quot;).</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp;tel(&quot;Nokia N97&quot;, 27990):- positive(&quot;цветной дисплей&quot;), positive (&quot;емкий аккумулятор&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive (&quot;имеет камеру&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive (&quot;имеет FM-радио&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive (&quot;имеет флэш-карту&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive (&quot;имеет навигацию&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive (&quot;имеет Mp3-плеер&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; negative (&quot;имеет Wi-Fi&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive (&quot;имеет дополнительную клавиатуру&quot;),</div><div class="code_line">is(&quot;помощник в путешествиях&quot;), is(&quot;мобильный офис&quot;), is(&quot;развлечения и музыка&quot;).</div><div class="code_line">&nbsp;</div><div class="code_line">&nbsp;&nbsp;tel(&quot;Такой телефон еще не произведен!!!!&quot;, 0).</div><div class="code_line">&nbsp;</div><div class="code_line">%-----------------------------------------------------------------------------</div><div class="code_line">&nbsp;&nbsp;is(&quot;только для связи&quot;):-positive(&quot;звонить и отправлять смс&quot;),!.</div><div class="code_line">&nbsp;&nbsp;is(&quot;мобильный офис&quot;):- positive(&quot;смартфон&quot;),!;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; negative(&quot;слушать музыку&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive(&quot;звонить и отправлять смс&quot;).</div><div class="code_line">&nbsp;&nbsp;is(&quot;развлечения и музыка&quot;):- positive(&quot;слушать музыку&quot;),!;</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; positive(&quot;звонить и отправлять смс&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; negative(&quot;смартфон&quot;).</div><div class="code_line">&nbsp;&nbsp;is(&quot;помощник в путешествиях&quot;):-positive(&quot;имеет GPS-навигацию&quot;).</div><div class="code_line">%-----------------------------------------------------------------------------</div><div class="code_line">% работа с динамической базой данных</div><div class="code_line">&nbsp;&nbsp;positive(X):-xpositive(X),!; xnegative(X),!,fail; ask(X,&#39;y&#39;).</div><div class="code_line">&nbsp;&nbsp;negative(X):-xnegative(X),!; xpositive(X),!,fail; ask(X,&#39;n&#39;).</div><div class="code_line">&nbsp;&nbsp;ask(X,R):-write(X,&quot; &nbsp;? &nbsp;: &quot;),readchar(Reply),write(Reply,&quot;\n&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;remember(X,Reply),R=Reply.</div><div class="code_line">% проверка присутствия фактов в динамической базе данных</div><div class="code_line">&nbsp;&nbsp;xpositive(X):-yes(X);maybe(X).</div><div class="code_line">&nbsp;&nbsp;xnegative(X):-no(X);maybe(X).</div><div class="code_line">% запоминаем факт в динамической базе данных</div><div class="code_line">&nbsp;&nbsp;remember(X,&#39;y&#39;):-asserta(yes(X)).</div><div class="code_line">&nbsp;&nbsp;remember(X,&#39;n&#39;):-assertz(no(X)).</div><div class="code_line">&nbsp;&nbsp;remember(X,&#39;q&#39;):-asserta(maybe(X)).</div><div class="code_line">% очищаем память от фактов динамической базы данных</div><div class="code_line">delete_all:-retract(yes(_)),delete_all.</div><div class="code_line">delete_all:-retract(no(_)),delete_all.</div><div class="code_line">delete_all:-retract(maybe(_)),delete_all.</div><div class="code_line">delete_all.</div><div class="code_line">%-----------------------------------------------------------------------------</div><div class="code_line">&nbsp;&nbsp;run:-delete_all,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; repeat,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; write(&quot;На вопросы отвечать (y-да, n-нет, q-не знаю).\n&quot;), &nbsp; &nbsp; </div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; </div><div class="code_line">&nbsp;&nbsp; &nbsp;make_selection(X, A, CHOOSE),</div><div class="code_line">&nbsp;&nbsp; &nbsp;continue_selection(CHOOSE, X, A),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; write(&quot;Завершить работу программы (y/n): &quot;),readchar(Z),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; write(Z),nl,</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; Z=&#39;y&#39;.</div><div class="code_line">&nbsp;</div><div class="code_line">make_selection(X, A, CHOOSE) :- tel(X,A), write(&quot;Ваш выбор: &quot;,X,&quot; цена: &quot;,A,&quot;\n&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;write(&quot;Устраивает ли вас цена? \n1-да, данная модель меня устраивает\n2-нет, покажите модель по дешевле\n3-нет, покажите модель по дороже\n&quot;),</div><div class="code_line">&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;readchar(CHOOSE).</div><div class="code_line">&nbsp;</div><div class="code_line">continue_selection(&#39;1&#39;, X, A) :- &nbsp;!, write(&quot;Ваш выбор: &quot;,X,&quot; цена: &quot;,A,&quot;\n&quot;), !.</div><div class="code_line">continue_selection(&#39;2&#39;, X, A) :- &nbsp;!, tel(X, Z), Z &#60; A, write(&quot;--&#62;&#62;&quot;, X, &quot; - &quot;, Z).</div><div class="code_line">continue_selection(&#39;3&#39;, X, A) :- &nbsp;!, tel(X, Z), Z &#62; A, write(&quot;--&#62;&#62;&quot;, X, &quot; - &quot;, Z).</div><div class="code_line">&nbsp;</div><div class="code_line">goal</div><div class="code_line">&nbsp;&nbsp;makewindow(1,10,12,&quot; Экспертная система : СОТОВЫЕ ТЕЛЕФОНЫ &quot;,0,0,25,80),</div><div class="code_line">&nbsp;&nbsp;write(&quot;--------------------------------------------&quot;),nl,</div><div class="code_line">&nbsp;&nbsp;run.</div></ol></div></div></div></div><script>preloadCodeButtons('1');</script><br>
Вопрос в том, почему при попытке поиска телефона стоимостью ниже/выше, программа выходит на начало поиска, а не остается в предекате выбора меньшей/высшей цены? Может кто-нибудь подсказать реализацию выбора телефона с меньшей или высшей ценой? <br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">continue_selection(&#39;2&#39;, X, A) :- &nbsp;!, tel(X, Z), Z &#60; A, write(&quot;--&#62;&#62;&quot;, X, &quot; - &quot;, Z).</div><div class="code_line">continue_selection(&#39;3&#39;, X, A) :- &nbsp;!, tel(X, Z), Z &#62; A, write(&quot;--&#62;&#62;&quot;, X, &quot; - &quot;, Z).</div></ol></div></div></div></div>]]></description>
        <author>Gabbi</author>
        <category>Prolog</category>
      </item>
	
      </channel>
      </rss>
	