<?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=9506&amp;view=findpost&amp;p=92286</guid>
        <pubDate>Sat, 15 Mar 2003 18:04:13 +0000</pubDate>
        <title>Алгоритм обхождения стоящих шариков</title>
        <link>https://forum.sources.ru/index.php?showtopic=9506&amp;view=findpost&amp;p=92286</link>
        <description><![CDATA[Antipich: Народ, может хватит доказывать, что свой СТАНДАРТНЫЙ волновой вариант лучше другого.]]></description>
        <author>Antipich</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=9506&amp;view=findpost&amp;p=92285</guid>
        <pubDate>Sun, 09 Mar 2003 01:50:32 +0000</pubDate>
        <title>Алгоритм обхождения стоящих шариков</title>
        <link>https://forum.sources.ru/index.php?showtopic=9506&amp;view=findpost&amp;p=92285</link>
        <description><![CDATA[Shiru_Otaku: У всех так-же:))]]></description>
        <author>Shiru_Otaku</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=9506&amp;view=findpost&amp;p=92284</guid>
        <pubDate>Thu, 06 Mar 2003 10:09:34 +0000</pubDate>
        <title>Алгоритм обхождения стоящих шариков</title>
        <link>https://forum.sources.ru/index.php?showtopic=9506&amp;view=findpost&amp;p=92284</link>
        <description><![CDATA[kardinal:  Ну дык у меня также.]]></description>
        <author>kardinal</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=9506&amp;view=findpost&amp;p=92283</guid>
        <pubDate>Thu, 06 Mar 2003 01:09:13 +0000</pubDate>
        <title>Алгоритм обхождения стоящих шариков</title>
        <link>https://forum.sources.ru/index.php?showtopic=9506&amp;view=findpost&amp;p=92283</link>
        <description><![CDATA[Волченка: Я делала нечто подобное для пути в лабиринте.<br>Идея такова:<br>от нужного шарика смотришь во все стороны. Где нету стенки (у меня было -1, т.е. 0 - пустой проход), там ставишь 1. Дале уже от клеток с &quot;1&quot; смотришь и ставишь &quot;2&quot; ...<br>(ставишь только тогда, когда в нужной клетке &quot;0&quot;). и т.д. - пока не достигнешь нужной клетки. А путь просчитываешь в обратном порядке.<br>На этом принципе по лабиринту за мной бегали монстрики :-)<br><br>Мо чего-то упустила, но основа такая.]]></description>
        <author>Волченка</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=9506&amp;view=findpost&amp;p=92282</guid>
        <pubDate>Mon, 03 Mar 2003 18:50:17 +0000</pubDate>
        <title>Алгоритм обхождения стоящих шариков</title>
        <link>https://forum.sources.ru/index.php?showtopic=9506&amp;view=findpost&amp;p=92282</link>
        <description><![CDATA[kardinal: <div class='tag-quote'><span class='tag-quote-prefix'>Цитата</span> <span class='tag-quote__quote-info'>Shiru_Otaku, 03.03.03, 04:13:30</span><div class='quote '>Я незнаю правил Lines ;)</div></div><br>Увы, там нет ходов по диагонали.<br>]]></description>
        <author>kardinal</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=9506&amp;view=findpost&amp;p=92281</guid>
        <pubDate>Mon, 03 Mar 2003 01:13:30 +0000</pubDate>
        <title>Алгоритм обхождения стоящих шариков</title>
        <link>https://forum.sources.ru/index.php?showtopic=9506&amp;view=findpost&amp;p=92281</link>
        <description><![CDATA[Shiru_Otaku: Я незнаю правил Lines ;) Если можно делать диагональные ходы - то элементарным добавлением ещё 4-х проверок на диагонали можно получать действительно кратчайший путь...]]></description>
        <author>Shiru_Otaku</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=9506&amp;view=findpost&amp;p=92280</guid>
        <pubDate>Sun, 02 Mar 2003 12:03:29 +0000</pubDate>
        <title>Алгоритм обхождения стоящих шариков</title>
        <link>https://forum.sources.ru/index.php?showtopic=9506&amp;view=findpost&amp;p=92280</link>
        <description><![CDATA[kardinal: <div class='tag-quote'><span class='tag-quote-prefix'>Цитата</span> <span class='tag-quote__quote-info'>Shiru_Otaku, 02.03.03, 07:15:07</span><div class='quote '>Так это и есть волновой алгоритм;) Даже в самом простом виде, без диагоналей (путь далеко не кратчайший)...</div></div><br>  Шут с ним - как это называется, я допер до этого сам и не согласен с <strong class='tag-b'>Shiru_Otaku</strong>!!! В данной задаче это кратчайший путь!!!!!!!! Приведи пример, в котором это будет не так, тогда и поговорим!!!]]></description>
        <author>kardinal</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=9506&amp;view=findpost&amp;p=92279</guid>
        <pubDate>Sun, 02 Mar 2003 04:15:07 +0000</pubDate>
        <title>Алгоритм обхождения стоящих шариков</title>
        <link>https://forum.sources.ru/index.php?showtopic=9506&amp;view=findpost&amp;p=92279</link>
        <description><![CDATA[Shiru_Otaku: Так это и есть волновой алгоритм;) Даже в самом простом виде, без диагоналей (путь далеко не кратчайший)...]]></description>
        <author>Shiru_Otaku</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=9506&amp;view=findpost&amp;p=92278</guid>
        <pubDate>Sun, 02 Mar 2003 03:48:29 +0000</pubDate>
        <title>Алгоритм обхождения стоящих шариков</title>
        <link>https://forum.sources.ru/index.php?showtopic=9506&amp;view=findpost&amp;p=92278</link>
        <description><![CDATA[kardinal:  Я сделал такую игрушку лет восемь назад еще на турбо бэйсике. Тоже немного помучался с этим вопросом, но нашел очень простое решение:<br>  - в проге забиваешь bit-массив 9х9 для всех клеток ::) зеруешь (обнуляешь) его; скидываешь в него положение шариков (значение 0FFh); а по команде 'двигать шарик' заполняешь весь массив, от шарика по четырем направлениям, цифрами с номером шага(сначала 1, от одного по 4-м направлениям - 2 и т.д., естественно, только в нулевые ячейки и по часовой стрелке) пока не дойдешь до позиции назначения; если дальше не заполняется значит проход закрыт; как только доходишь до места назначения, в обратном порядке 'место....3,2,1,шар', строишь массив координат прохода(динамический, поскольку <br>каждый раз разный, но можно и простой   <br>2х81, чтобы не думать  ???не мало ли ???), этот массив берешь как за исходный для изображения движения шарика. Но придется все это запрограмировать.<br><br>вот пример: 0-пустые места;S-занятые шариками;V-место назначения;H-шар который двигать.<br><br>                               S  0  0  0  0  0  V  0  S <br>                               0  0  0  S  0  S  S  0  0<br>                               0  0  0  0  S  0  0  S  0<br>                               0  0  0  S  0  0  0  0  0<br>                               0  0  0  S  0  0  0  S  0 <br>                               0  S  0  S  0  0  0  0  S <br>                               0  0  H  0  0  0  0  0  0<br>                               0  0  0  S  0  S  0  0  0<br>                               0  0  0  0  0  0  0  0  0<br>bit-массив уже заполненный:<br><br>                               S  7  6. 7. 8. 9. V  13 S <br>                               7  6  5. S  9  S  S  12 11<br>                               6  5  4. 5  S  7  8  S  10<br>                               5  4  3. S  5  6  7  8  9<br>                               4  3  2. S  4  5  6  S  10 <br>                               3  S  1. S  3  4  5  6  S <br>                               2  1  H  1  2  3  4  5  6<br>                               3  2  1  S  3  S  5  6  7<br>                               4  3  2  3  4  5  6  7  8<br><br>Точками показан искомый кратчайший путь. После 9 можно и не заполнять (это я так).<br>***Все это не так сложно программируется.]]></description>
        <author>kardinal</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=9506&amp;view=findpost&amp;p=92277</guid>
        <pubDate>Sat, 01 Mar 2003 20:55:20 +0000</pubDate>
        <title>Алгоритм обхождения стоящих шариков</title>
        <link>https://forum.sources.ru/index.php?showtopic=9506&amp;view=findpost&amp;p=92277</link>
        <description><![CDATA[Jin X: Если нужны примеры (делал, когда сам интересовался), держи:<br><br>Движение по 4 направлениям:<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">Uses Crt;&#60;br&#62;Const&#60;br&#62; &nbsp; Wall = #254;&#60;br&#62; &nbsp; Move = #250;&#60;br&#62; &nbsp; Nk = 250;&#60;br&#62;&#60;br&#62;Var&#60;br&#62; &nbsp; R: array [0..79, 0..49] of Byte;&#60;br&#62; &nbsp; Ni: Byte;&#60;br&#62; &nbsp; FX, FY: Byte;&#60;br&#62; &nbsp; i, j: Word;&#60;br&#62;&#60;br&#62;Procedure Init;&#60;br&#62;Begin&#60;br&#62; &nbsp; For j := 0 to 49 do&#60;br&#62; &nbsp; &nbsp; &nbsp;For i := 0 to 79 do&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; If (i in [0, 79]) or (j in [0, 49]) then R[i, j] := 255&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; else Case Mem[$B800:j*160+i*2] of&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;32: R[i, j] := 254;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Ord(&#39;X&#39;): R[i, j] := 0;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1: R[i, j] := 253;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;else R[i, j] := 255&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; End;&#60;br&#62; &nbsp; Ni := 0&#60;br&#62;End;&#60;br&#62;&#60;br&#62;Procedure Clear;&#60;br&#62;Begin&#60;br&#62; &nbsp; For j := 1 to 48 do&#60;br&#62; &nbsp; &nbsp; &nbsp;For i := 1 to 78 do&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; Case Mem[$B800:j*160+i*2] of&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Ord(Move):&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Begin&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GotoXY(i, j);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Write(&#39; &#39;#8)&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;End;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2:&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Begin&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GotoXY(i, j);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Write(#1#8)&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;End&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; End&#60;br&#62;End;&#60;br&#62;&#60;br&#62;Procedure Start;&#60;br&#62;Var&#60;br&#62; &nbsp; Ok: Boolean;&#60;br&#62; &nbsp; X, Y, N, X1, Y1: Byte;&#60;br&#62;&#60;br&#62; Procedure Check(X, Y: Byte);&#60;br&#62; Begin&#60;br&#62; &nbsp; &nbsp;Case R[X, Y] of&#60;br&#62; &nbsp; &nbsp; &nbsp; 253: Ok := True;&#60;br&#62; &nbsp; &nbsp; &nbsp; 254: R[X, Y] := Ni+1&#60;br&#62; &nbsp; &nbsp;End&#60;br&#62; End;&#60;br&#62;&#60;br&#62; Procedure Find(X, Y: Byte);&#60;br&#62; Begin&#60;br&#62; &nbsp; &nbsp;If R[X, Y] &#60; N then&#60;br&#62; &nbsp; &nbsp;Begin&#60;br&#62; &nbsp; &nbsp; &nbsp; N := R[X, Y];&#60;br&#62; &nbsp; &nbsp; &nbsp; X1 := X;&#60;br&#62; &nbsp; &nbsp; &nbsp; Y1 := Y&#60;br&#62; &nbsp; &nbsp;End&#60;br&#62; End;&#60;br&#62;&#60;br&#62;Begin&#60;br&#62; &nbsp; Init;&#60;br&#62; &nbsp; Ok := False;&#60;br&#62; &nbsp; Repeat&#60;br&#62; &nbsp; &nbsp; &nbsp;For j := 1 to 48 do&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; For i := 1 to 78 do&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; Begin&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;If Ok then Break;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;If R[i, j] = Ni then&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Begin&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Check(i, j-1);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Check(i+1, j);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Check(i, j+1);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Check(i-1, j)&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;End&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; End;&#60;br&#62; &nbsp; &nbsp; &nbsp;Inc(Ni)&#60;br&#62; &nbsp; Until Ok or (Ni &#62; Nk);&#60;br&#62; &nbsp; If Ok then&#60;br&#62; &nbsp; Begin&#60;br&#62; &nbsp; &nbsp; &nbsp;X := FX;&#60;br&#62; &nbsp; &nbsp; &nbsp;Y := FY;&#60;br&#62; &nbsp; &nbsp; &nbsp;TextAttr := ;&#60;br&#62; &nbsp; &nbsp; &nbsp;Repeat&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; N := 255;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; Find(X, Y-1);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; Find(X+1, Y);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; Find(X, Y+1);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; Find(X-1, Y);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; If R[X1, Y1] = 0 then Break;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; GotoXY(X1, Y1);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; Write(Move);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; X := X1;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; Y := Y1&#60;br&#62; &nbsp; &nbsp; &nbsp;Until False&#60;br&#62; &nbsp; End&#60;br&#62; &nbsp; else&#60;br&#62; &nbsp; Begin&#60;br&#62; &nbsp; &nbsp; &nbsp;TextAttr := E;&#60;br&#62; &nbsp; &nbsp; &nbsp;GotoXY(FX, FY);&#60;br&#62; &nbsp; &nbsp; &nbsp;Write(#2)&#60;br&#62; &nbsp; End;&#60;br&#62; &nbsp; TextAttr := F;&#60;br&#62; &nbsp; Window(1, 1, 80, 50);&#60;br&#62; &nbsp; GotoXY(3, 1);&#60;br&#62; &nbsp; Write(&#39;Итераций - &#39;, Ni, &#39;/250 &nbsp;&#39;#8#8);&#60;br&#62; &nbsp; If ReadKey = #0 then ReadKey;&#60;br&#62; &nbsp; TextAttr := F;&#60;br&#62; &nbsp; Window(2, 2, 80, 49);&#60;br&#62; &nbsp; Clear;&#60;br&#62; &nbsp; GotoXY(FX, FY)&#60;br&#62;End;&#60;br&#62;&#60;br&#62;Begin&#60;br&#62; &nbsp; TextMode(Co80+Font8x8);&#60;br&#62; &nbsp; TextAttr := E;&#60;br&#62; &nbsp; ClrScr;&#60;br&#62; &nbsp; GotoXY(3, 50);&#60;br&#62; &nbsp; Write(#27#26#24#25&#39; - Move; Space,Del,PgDn,Home,End,Tab - Wall; Insert - Man; PgUp - Target&#39;);&#60;br&#62; &nbsp; GotoXY(54, 1);&#60;br&#62; &nbsp; Write(&#39;ENTER - Start; ESC - Exit&#39;);&#60;br&#62; &nbsp; Window(2, 2, 79, 49);&#60;br&#62; &nbsp; TextAttr := F;&#60;br&#62; &nbsp; ClrScr;&#60;br&#62; &nbsp; Window(2, 2, 80, 49);&#60;br&#62; &nbsp; Repeat&#60;br&#62; &nbsp; &nbsp; &nbsp;Case ReadKey of&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; #00: Case ReadKey of&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#72: If WhereY &#62; 1 then GotoXY(WhereX, WhereY-1);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#75: If WhereX &#62; 1 then GotoXY(WhereX-1, WhereY);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#77: If WhereX &#60; 78 then GotoXY(WhereX+1, WhereY);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#80: If WhereY &#60; 48 then GotoXY(WhereX, WhereY+1);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#71: {Home}&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Begin&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; If WhereY &#62; 1 then GotoXY(WhereX, WhereY-1);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; If Mem[$B800:WhereY*160+WhereX*2] = 32 then&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Write(Wall+#8) else Write(&#39; &#39;#8);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; If (FX = WhereX) and (FY = WhereY) then FX := 0&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;End;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#83: {Del}&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Begin&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; If WhereX &#62; 1 then GotoXY(WhereX-1, WhereY);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; If Mem[$B800:WhereY*160+WhereX*2] = 32 then&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Write(Wall+#8) else Write(&#39; &#39;#8);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; If (FX = WhereX) and (FY = WhereY) then FX := 0&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;End;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#81: {PgDn}&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Begin&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; If WhereX &#60; 78 then GotoXY(WhereX+1, WhereY);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; If Mem[$B800:WhereY*160+WhereX*2] = 32 then&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Write(Wall+#8) else Write(&#39; &#39;#8);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; If (FX = WhereX) and (FY = WhereY) then FX := 0&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;End;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#79: {End}&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Begin&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; If WhereY &#60; 48 then GotoXY(WhereX, WhereY+1);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; If Mem[$B800:WhereY*160+WhereX*2] = 32 then&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Write(Wall+#8) else Write(&#39; &#39;#8);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; If (FX = WhereX) and (FY = WhereY) then FX := 0&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;End;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#59: {F1 - Clr}&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Begin&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; For j := 1 to 48 do&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;For i := 1 to 78 do&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Begin&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GotoXY(i, j);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Write(&#39; &#39;#8)&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;End;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FX := 0&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;End;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#60: {F2 - Fill}&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Begin&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; For j := 1 to 48 do&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;For i := 1 to 78 do&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Begin&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GotoXY(i, j);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Write(Wall+#8)&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;End;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FX := 0&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;End;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#73: {PgUp}&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Write(&#39;X&#39;#8);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#82: {Ins}&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Begin&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i:= WhereX;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; j := WhereY;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GotoXY(FX, FY);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Write(&#39; &#39;);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GotoXY(i, j);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Write(#1#8);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FX := i;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FY := j&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;End&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; End;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; #09: {Tab}&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;For Ni := 1 to 100 do&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Begin&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i := Random(78)+1;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; j := Random(48)+1;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; If Mem[$B800:j*160+i*2] &#60;&#62; 1 then&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Begin&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;GotoXY(i, j);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Write(Wall+#8)&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; End&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;End;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; #32: {Space}&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; Begin&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;If Mem[$B800:WhereY*160+WhereX*2] = 32 then&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Write(Wall+#8) else Write(&#39; &#39;#8);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;If (FX = WhereX) and (FY = WhereY) then FX := 0&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; End;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; #13: {Enter}&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;If FX &#60;&#62; 0 then Start;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; #27: {Esc}&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Break&#60;br&#62; &nbsp; &nbsp; &nbsp;End&#60;br&#62; &nbsp; Until False;&#60;br&#62; &nbsp; TextMode(Co80);&#60;br&#62; &nbsp; TextAttr := 7;&#60;br&#62; &nbsp; ClrScr&#60;br&#62;End.</div></ol></div></div></div></div><script>preloadCodeButtons('1');</script><br>Движение по 8 направлениям:<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">Uses Crt;&#60;br&#62;Const&#60;br&#62; &nbsp; Wall = #254;&#60;br&#62; &nbsp; Move = #250;&#60;br&#62; &nbsp; Nk = 250;&#60;br&#62;&#60;br&#62;Var&#60;br&#62; &nbsp; R: array [0..79, 0..49] of Byte;&#60;br&#62; &nbsp; Ni: Byte;&#60;br&#62; &nbsp; FX, FY: Byte;&#60;br&#62; &nbsp; i, j: Word;&#60;br&#62;&#60;br&#62;Procedure Init;&#60;br&#62;Begin&#60;br&#62; &nbsp; For j := 0 to 49 do&#60;br&#62; &nbsp; &nbsp; &nbsp;For i := 0 to 79 do&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; If (i in [0, 79]) or (j in [0, 49]) then R[i, j] := 255&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; else Case Mem[$B800:j*160+i*2] of&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;32: R[i, j] := 254;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Ord(&#39;X&#39;): R[i, j] := 0;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;1: R[i, j] := 253;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;else R[i, j] := 255&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; End;&#60;br&#62; &nbsp; Ni := 0&#60;br&#62;End;&#60;br&#62;&#60;br&#62;Procedure Clear;&#60;br&#62;Begin&#60;br&#62; &nbsp; For j := 1 to 48 do&#60;br&#62; &nbsp; &nbsp; &nbsp;For i := 1 to 78 do&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; Case Mem[$B800:j*160+i*2] of&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Ord(Move):&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Begin&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GotoXY(i, j);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Write(&#39; &#39;#8)&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;End;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;2:&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Begin&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GotoXY(i, j);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Write(#1#8)&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;End&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; End&#60;br&#62;End;&#60;br&#62;&#60;br&#62;Procedure Start;&#60;br&#62;Var&#60;br&#62; &nbsp; Ok: Boolean;&#60;br&#62; &nbsp; X, Y, N, X1, Y1: Byte;&#60;br&#62;&#60;br&#62; Procedure Check(X, Y: Byte);&#60;br&#62; Begin&#60;br&#62; &nbsp; &nbsp;Case R[X, Y] of&#60;br&#62; &nbsp; &nbsp; &nbsp; 253: Ok := True;&#60;br&#62; &nbsp; &nbsp; &nbsp; 254: R[X, Y] := Ni+1&#60;br&#62; &nbsp; &nbsp;End&#60;br&#62; End;&#60;br&#62;&#60;br&#62; Procedure Find(X, Y: Byte);&#60;br&#62; Begin&#60;br&#62; &nbsp; &nbsp;If R[X, Y] &#60; N then&#60;br&#62; &nbsp; &nbsp;Begin&#60;br&#62; &nbsp; &nbsp; &nbsp; N := R[X, Y];&#60;br&#62; &nbsp; &nbsp; &nbsp; X1 := X;&#60;br&#62; &nbsp; &nbsp; &nbsp; Y1 := Y&#60;br&#62; &nbsp; &nbsp;End&#60;br&#62; End;&#60;br&#62;&#60;br&#62;Begin&#60;br&#62; &nbsp; Init;&#60;br&#62; &nbsp; Ok := False;&#60;br&#62; &nbsp; Repeat&#60;br&#62; &nbsp; &nbsp; &nbsp;For j := 1 to 48 do&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; For i := 1 to 78 do&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; Begin&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;If Ok then Break;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;If R[i, j] = Ni then&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Begin&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Check(i, j-1);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Check(i+1, j);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Check(i, j+1);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Check(i-1, j);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Check(i+1, j-1);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Check(i+1, j+1);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Check(i-1, j+1);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Check(i-1, j-1)&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;End&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; End;&#60;br&#62; &nbsp; &nbsp; &nbsp;Inc(Ni)&#60;br&#62; &nbsp; Until Ok or (Ni &#62; Nk);&#60;br&#62; &nbsp; If Ok then&#60;br&#62; &nbsp; Begin&#60;br&#62; &nbsp; &nbsp; &nbsp;X := FX;&#60;br&#62; &nbsp; &nbsp; &nbsp;Y := FY;&#60;br&#62; &nbsp; &nbsp; &nbsp;TextAttr := ;&#60;br&#62; &nbsp; &nbsp; &nbsp;Repeat&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; N := 255;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; Find(X, Y-1);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; Find(X+1, Y);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; Find(X, Y+1);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; Find(X-1, Y);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; Find(X+1, Y-1);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; Find(X+1, Y+1);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; Find(X-1, Y+1);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; Find(X-1, Y-1);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; If R[X1, Y1] = 0 then Break;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; GotoXY(X1, Y1);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; Write(Move);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; X := X1;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; Y := Y1&#60;br&#62; &nbsp; &nbsp; &nbsp;Until False&#60;br&#62; &nbsp; End&#60;br&#62; &nbsp; else&#60;br&#62; &nbsp; Begin&#60;br&#62; &nbsp; &nbsp; &nbsp;TextAttr := E;&#60;br&#62; &nbsp; &nbsp; &nbsp;GotoXY(FX, FY);&#60;br&#62; &nbsp; &nbsp; &nbsp;Write(#2)&#60;br&#62; &nbsp; End;&#60;br&#62; &nbsp; TextAttr := F;&#60;br&#62; &nbsp; Window(1, 1, 80, 50);&#60;br&#62; &nbsp; GotoXY(3, 1);&#60;br&#62; &nbsp; Write(&#39;Итераций - &#39;, Ni, &#39;/250 &nbsp;&#39;#8#8);&#60;br&#62; &nbsp; If ReadKey = #0 then ReadKey;&#60;br&#62; &nbsp; TextAttr := F;&#60;br&#62; &nbsp; Window(2, 2, 80, 49);&#60;br&#62; &nbsp; Clear;&#60;br&#62; &nbsp; GotoXY(FX, FY)&#60;br&#62;End;&#60;br&#62;&#60;br&#62;Begin&#60;br&#62; &nbsp; TextMode(Co80+Font8x8);&#60;br&#62; &nbsp; TextAttr := E;&#60;br&#62; &nbsp; ClrScr;&#60;br&#62; &nbsp; GotoXY(3, 50);&#60;br&#62; &nbsp; Write(#27#26#24#25&#39; - Move; Space,Del,PgDn,Home,End,Tab - Wall; Insert - Man; PgUp - Target&#39;);&#60;br&#62; &nbsp; GotoXY(54, 1);&#60;br&#62; &nbsp; Write(&#39;ENTER - Start; ESC - Exit&#39;);&#60;br&#62; &nbsp; Window(2, 2, 79, 49);&#60;br&#62; &nbsp; TextAttr := F;&#60;br&#62; &nbsp; ClrScr;&#60;br&#62; &nbsp; Window(2, 2, 80, 49);&#60;br&#62; &nbsp; Repeat&#60;br&#62; &nbsp; &nbsp; &nbsp;Case ReadKey of&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; #00: Case ReadKey of&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#72: If WhereY &#62; 1 then GotoXY(WhereX, WhereY-1);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#75: If WhereX &#62; 1 then GotoXY(WhereX-1, WhereY);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#77: If WhereX &#60; 78 then GotoXY(WhereX+1, WhereY);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#80: If WhereY &#60; 48 then GotoXY(WhereX, WhereY+1);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#71: {Home}&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Begin&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; If WhereY &#62; 1 then GotoXY(WhereX, WhereY-1);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; If Mem[$B800:WhereY*160+WhereX*2] = 32 then&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Write(Wall+#8) else Write(&#39; &#39;#8);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; If (FX = WhereX) and (FY = WhereY) then FX := 0&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;End;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#83: {Del}&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Begin&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; If WhereX &#62; 1 then GotoXY(WhereX-1, WhereY);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; If Mem[$B800:WhereY*160+WhereX*2] = 32 then&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Write(Wall+#8) else Write(&#39; &#39;#8);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; If (FX = WhereX) and (FY = WhereY) then FX := 0&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;End;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#81: {PgDn}&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Begin&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; If WhereX &#60; 78 then GotoXY(WhereX+1, WhereY);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; If Mem[$B800:WhereY*160+WhereX*2] = 32 then&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Write(Wall+#8) else Write(&#39; &#39;#8);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; If (FX = WhereX) and (FY = WhereY) then FX := 0&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;End;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#79: {End}&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Begin&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; If WhereY &#60; 48 then GotoXY(WhereX, WhereY+1);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; If Mem[$B800:WhereY*160+WhereX*2] = 32 then&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Write(Wall+#8) else Write(&#39; &#39;#8);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; If (FX = WhereX) and (FY = WhereY) then FX := 0&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;End;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#59: {F1 - Clr}&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Begin&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; For j := 1 to 48 do&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;For i := 1 to 78 do&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Begin&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GotoXY(i, j);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Write(&#39; &#39;#8)&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;End;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FX := 0&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;End;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#60: {F2 - Fill}&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Begin&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; For j := 1 to 48 do&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;For i := 1 to 78 do&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Begin&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GotoXY(i, j);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Write(Wall+#8)&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;End;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FX := 0&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;End;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#73: {PgUp}&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Write(&#39;X&#39;#8);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;#82: {Ins}&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Begin&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i:= WhereX;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; j := WhereY;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GotoXY(FX, FY);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Write(&#39; &#39;);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; GotoXY(i, j);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Write(#1#8);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FX := i;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; FY := j&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;End&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; End;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; #09: {Tab}&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;For Ni := 1 to 100 do&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Begin&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; i := Random(78)+1;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; j := Random(48)+1;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; If Mem[$B800:j*160+i*2] &#60;&#62; 1 then&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Begin&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;GotoXY(i, j);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Write(Wall+#8)&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; End&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;End;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; #32: {Space}&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; Begin&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;If Mem[$B800:WhereY*160+WhereX*2] = 32 then&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Write(Wall+#8) else Write(&#39; &#39;#8);&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;If (FX = WhereX) and (FY = WhereY) then FX := 0&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; End;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; #13: {Enter}&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;If FX &#60;&#62; 0 then Start;&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; #27: {Esc}&#60;br&#62; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Break&#60;br&#62; &nbsp; &nbsp; &nbsp;End&#60;br&#62; &nbsp; Until False;&#60;br&#62; &nbsp; TextMode(Co80);&#60;br&#62; &nbsp; TextAttr := 7;&#60;br&#62; &nbsp; ClrScr&#60;br&#62;End.</div></ol></div></div></div></div>]]></description>
        <author>Jin X</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=9506&amp;view=findpost&amp;p=92276</guid>
        <pubDate>Thu, 27 Feb 2003 09:39:15 +0000</pubDate>
        <title>Алгоритм обхождения стоящих шариков</title>
        <link>https://forum.sources.ru/index.php?showtopic=9506&amp;view=findpost&amp;p=92276</link>
        <description><![CDATA[Azatrix: Ооогромное спасибо за ссылку! &nbsp;:D]]></description>
        <author>Azatrix</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=9506&amp;view=findpost&amp;p=92275</guid>
        <pubDate>Thu, 27 Feb 2003 09:28:18 +0000</pubDate>
        <title>Алгоритм обхождения стоящих шариков</title>
        <link>https://forum.sources.ru/index.php?showtopic=9506&amp;view=findpost&amp;p=92275</link>
        <description><![CDATA[Sl0n: Вот здест глянь:<br>http://www.codemanual.net/main/algo/alg20.htm]]></description>
        <author>Sl0n</author>
        <category>Алгоритмы</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=9506&amp;view=findpost&amp;p=92274</guid>
        <pubDate>Thu, 27 Feb 2003 09:21:14 +0000</pubDate>
        <title>Алгоритм обхождения стоящих шариков</title>
        <link>https://forum.sources.ru/index.php?showtopic=9506&amp;view=findpost&amp;p=92274</link>
        <description><![CDATA[Azatrix: Как организовать работу алгоритма обхождения шариков в игре Lines (цветные линии)? Тут я делал игру Lines, а вот наткнулся на такую проблему. Шарики у меня резко переходят с одного места (начальная позиция) на другое (туда, куда переставил его игрок). А мне надобно сделать пошаговое перемещение шарика. Как в таком случае найти оптимальный для него путь?<br><br>Заранее благодарен, Азат. &nbsp;::)]]></description>
        <author>Azatrix</author>
        <category>Алгоритмы</category>
      </item>
	
      </channel>
      </rss>
	