<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://mediawiki.zeropage.org/index.php?action=history&amp;feed=atom&amp;title=Randomwalk%2F%ED%99%8D%EC%84%A0</id>
	<title>Randomwalk/홍선 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://mediawiki.zeropage.org/index.php?action=history&amp;feed=atom&amp;title=Randomwalk%2F%ED%99%8D%EC%84%A0"/>
	<link rel="alternate" type="text/html" href="https://mediawiki.zeropage.org/index.php?title=Randomwalk/%ED%99%8D%EC%84%A0&amp;action=history"/>
	<updated>2026-05-16T05:10:09Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.8</generator>
	<entry>
		<id>https://mediawiki.zeropage.org/index.php?title=Randomwalk/%ED%99%8D%EC%84%A0&amp;diff=86884&amp;oldid=prev</id>
		<title>Maintenance script: Repair batch-0008 pages from live compare</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.zeropage.org/index.php?title=Randomwalk/%ED%99%8D%EC%84%A0&amp;diff=86884&amp;oldid=prev"/>
		<updated>2026-03-27T01:40:37Z</updated>

		<summary type="html">&lt;p&gt;Repair batch-0008 pages from live compare&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 01:40, 27 March 2026&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l8&quot;&gt;Line 8:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 8:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  //20041004 김홍선&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  //20041004 김홍선&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  const int Direction = 8;                   // 바퀴벌레가 움직이는 8방향&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  const int Direction = 8;                   // 바퀴벌레가 움직이는 8방향&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  const int imove&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[&lt;/del&gt;8&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;] &lt;/del&gt;= {-1,0,1,1,1,0,-1,-1}; // 바퀴벌레가 움직이는 방향의 x 좌표 증감&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  const int imove&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#91;&lt;/ins&gt;8&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#93; &lt;/ins&gt;= {-1,0,1,1,1,0,-1,-1}; // 바퀴벌레가 움직이는 방향의 x 좌표 증감&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  const int jmove&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[&lt;/del&gt;8&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;] &lt;/del&gt;= {1,1,1,0,-1,-1,-1,0}; // 바퀴벌레가 움직이는 방향의 y 좌표 증감&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  const int jmove&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#91;&lt;/ins&gt;8&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#93; &lt;/ins&gt;= {1,1,1,0,-1,-1,-1,0}; // 바퀴벌레가 움직이는 방향의 y 좌표 증감&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  int Tile&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[&lt;/del&gt;40&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;][&lt;/del&gt;20&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;] &lt;/del&gt;= {0,};                   // 바퀴벌레가 돌아다니는 타일의 배열화&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  int Tile&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#91;&lt;/ins&gt;40&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#93;&amp;amp;#91;&lt;/ins&gt;20&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#93; &lt;/ins&gt;= {0,};                   // 바퀴벌레가 돌아다니는 타일의 배열화&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  int size_x, size_y;                        // x, y 좌표의 타일 갯수&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  int size_x, size_y;                        // x, y 좌표의 타일 갯수&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  int count,t,R_count=0;                     // 바퀴벌레의 이동횟수, 랜덤 숫자, 바퀴벌레가 모든 타일을 돌아다니도록 하는 카운터&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  int count,t,R_count=0;                     // 바퀴벌레의 이동횟수, 랜덤 숫자, 바퀴벌레가 모든 타일을 돌아다니도록 하는 카운터&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l51&quot;&gt;Line 51:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 51:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  {&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  {&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  	  t=rand()%Direction;                  // 랜덤으로 바퀴벌레가 움직일 방향을 정한다&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  	  t=rand()%Direction;                  // 랜덤으로 바퀴벌레가 움직일 방향을 정한다&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  	  if(Pos_x + imove&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[&lt;/del&gt;t&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;] &lt;/del&gt;&amp;amp;gt;= 0 &amp;amp;amp;&amp;amp;amp; Pos_x + imove&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[&lt;/del&gt;t&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;] &lt;/del&gt;&amp;amp;lt; size_x) // 바퀴벌레가 타일밖으로 벗어나지 않도록 하는 조건&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  	  if(Pos_x + imove&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#91;&lt;/ins&gt;t&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#93; &lt;/ins&gt;&amp;amp;gt;= 0 &amp;amp;amp;&amp;amp;amp; Pos_x + imove&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#91;&lt;/ins&gt;t&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#93; &lt;/ins&gt;&amp;amp;lt; size_x) // 바퀴벌레가 타일밖으로 벗어나지 않도록 하는 조건&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  	  Pos_x += imove&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[&lt;/del&gt;t&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;]&lt;/del&gt;;                                     // 바퀴벌레의 x 좌표 위치를 갱신           &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  	  Pos_x += imove&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#91;&lt;/ins&gt;t&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#93;&lt;/ins&gt;;                                     // 바퀴벌레의 x 좌표 위치를 갱신           &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  	  if(Pos_y + jmove&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[&lt;/del&gt;t&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;] &lt;/del&gt;&amp;amp;gt;= 0 &amp;amp;amp;&amp;amp;amp; Pos_y + jmove&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[&lt;/del&gt;t&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;] &lt;/del&gt;&amp;amp;lt; size_y)  &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  	  if(Pos_y + jmove&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#91;&lt;/ins&gt;t&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#93; &lt;/ins&gt;&amp;amp;gt;= 0 &amp;amp;amp;&amp;amp;amp; Pos_y + jmove&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#91;&lt;/ins&gt;t&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#93; &lt;/ins&gt;&amp;amp;lt; size_y)  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  	  Pos_y += jmove&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[&lt;/del&gt;t&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;]&lt;/del&gt;;                                     // 바퀴벌레의 y 좌표 위치를 갱신&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  	  Pos_y += jmove&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#91;&lt;/ins&gt;t&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#93;&lt;/ins&gt;;                                     // 바퀴벌레의 y 좌표 위치를 갱신&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;        count++;                                               // 바퀴벌레가 총 움직인 횟수를 구하기 위한 카운터&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;        count++;                                               // 바퀴벌레가 총 움직인 횟수를 구하기 위한 카운터&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;        if(Tile&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[&lt;/del&gt;Pos_x&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;][&lt;/del&gt;Pos_y&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;]&lt;/del&gt;==0)&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;        if(Tile&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#91;&lt;/ins&gt;Pos_x&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#93;&amp;amp;#91;&lt;/ins&gt;Pos_y&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#93;&lt;/ins&gt;==0)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  	  R_count++;	                                         // 바퀴벌레가 모든 타일을 방문하면 멈추게 하기 위한 카운터&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  	  R_count++;	                                         // 바퀴벌레가 모든 타일을 방문하면 멈추게 하기 위한 카운터&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  	  Tile&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[&lt;/del&gt;Pos_x&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;][&lt;/del&gt;Pos_y&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;]&lt;/del&gt;++;                                  // 바퀴벌레가 타일을 방문할 때마다 증가하여 방문 횟수를 구한다.  &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  	  Tile&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#91;&lt;/ins&gt;Pos_x&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#93;&amp;amp;#91;&lt;/ins&gt;Pos_y&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#93;&lt;/ins&gt;++;                                  // 바퀴벌레가 타일을 방문할 때마다 증가하여 방문 횟수를 구한다.  &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  };&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  };&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;   &lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l68&quot;&gt;Line 68:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 68:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  	for(int m=0; m &amp;amp;lt; size_x; m++){&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  	for(int m=0; m &amp;amp;lt; size_x; m++){&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  		for(int n=0; n &amp;amp;lt; size_y; n++)&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  		for(int n=0; n &amp;amp;lt; size_y; n++)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  			cout &amp;amp;lt;&amp;amp;lt; Tile&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[&lt;/del&gt;m&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;][&lt;/del&gt;n&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;] &lt;/del&gt;&amp;amp;lt;&amp;amp;lt; &amp;quot;\t&amp;quot;;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  			cout &amp;amp;lt;&amp;amp;lt; Tile&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#91;&lt;/ins&gt;m&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#93;&amp;amp;#91;&lt;/ins&gt;n&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&amp;amp;#93; &lt;/ins&gt;&amp;amp;lt;&amp;amp;lt; &amp;quot;\t&amp;quot;;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  		    cout &amp;amp;lt;&amp;amp;lt; endl;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  		    cout &amp;amp;lt;&amp;amp;lt; endl;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  	}&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;  	}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l97&quot;&gt;Line 97:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 97:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;지저분한게... 어디를 고쳐야 할지... 막막하네요...&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;지저분한게... 어디를 고쳐야 할지... 막막하네요...&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;공부를 합시다 ㅡ_ㅡ^&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;공부를 합시다 ㅡ_ㅡ^&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-added&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Maintenance script</name></author>
	</entry>
	<entry>
		<id>https://mediawiki.zeropage.org/index.php?title=Randomwalk/%ED%99%8D%EC%84%A0&amp;diff=81461&amp;oldid=prev</id>
		<title>imported&gt;Unknown at 05:31, 7 February 2021</title>
		<link rel="alternate" type="text/html" href="https://mediawiki.zeropage.org/index.php?title=Randomwalk/%ED%99%8D%EC%84%A0&amp;diff=81461&amp;oldid=prev"/>
		<updated>2021-02-07T05:31:44Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== 자료구조 숙제 ==&lt;br /&gt;
&lt;br /&gt;
=== Randomwalk Problem ===&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
 == Roach.h ==&lt;br /&gt;
 &lt;br /&gt;
 //20041004 김홍선&lt;br /&gt;
 const int Direction = 8;                   // 바퀴벌레가 움직이는 8방향&lt;br /&gt;
 const int imove[8] = {-1,0,1,1,1,0,-1,-1}; // 바퀴벌레가 움직이는 방향의 x 좌표 증감&lt;br /&gt;
 const int jmove[8] = {1,1,1,0,-1,-1,-1,0}; // 바퀴벌레가 움직이는 방향의 y 좌표 증감&lt;br /&gt;
 int Tile[40][20] = {0,};                   // 바퀴벌레가 돌아다니는 타일의 배열화&lt;br /&gt;
 int size_x, size_y;                        // x, y 좌표의 타일 갯수&lt;br /&gt;
 int count,t,R_count=0;                     // 바퀴벌레의 이동횟수, 랜덤 숫자, 바퀴벌레가 모든 타일을 돌아다니도록 하는 카운터&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 class Roach&lt;br /&gt;
 {&lt;br /&gt;
 private:&lt;br /&gt;
 		int Pos_x, Pos_y;                  // 바퀴벌레의 위치&lt;br /&gt;
 public:&lt;br /&gt;
 	    void Initiation();                 // 타일의 초기화&lt;br /&gt;
 		void Input();                      // 바퀴벌레의 시작위치 입력함수&lt;br /&gt;
 		void Walk();                       // 바퀴벌레가 움직이는 메서드&lt;br /&gt;
 		void show();                       // 결과값 출력 함수&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 void Roach :: Initiation()                 // 타일의 초기화&lt;br /&gt;
 {&lt;br /&gt;
 	  cout &amp;amp;lt;&amp;amp;lt; &amp;quot;가로의 크기를 설정하세요. ( 2 &amp;amp;lt; x &amp;amp;lt;=40 ) \n&amp;quot;;&lt;br /&gt;
 	  while(!(cin &amp;amp;gt;&amp;amp;gt; size_x) || size_x&amp;amp;lt;3 || size_x &amp;amp;gt; 40)     &lt;br /&gt;
 		  cerr &amp;amp;lt;&amp;amp;lt; &amp;quot;잘못된 값을 입력하셨습니다. 다시 입력해주세요.\n&amp;quot;;&lt;br /&gt;
 	  cout &amp;amp;lt;&amp;amp;lt; &amp;quot;세로의 크기를 설정하세요. ( 2 &amp;amp;lt; y &amp;amp;lt;=20 ) \n&amp;quot;;&lt;br /&gt;
 	  while(!(cin &amp;amp;gt;&amp;amp;gt; size_y) || size_y &amp;amp;lt; 3 || size_y &amp;amp;gt;20)&lt;br /&gt;
 		  cerr &amp;amp;lt;&amp;amp;lt; &amp;quot;잘못된 값을 입력하셨습니다. 다시 입력해주세요.\n&amp;quot;;&lt;br /&gt;
 };                                         &lt;br /&gt;
 &lt;br /&gt;
 void Roach :: Input()                      // 바퀴벌레의 시작위치 입력함수&lt;br /&gt;
 {&lt;br /&gt;
 	  int i,j;&lt;br /&gt;
 	  cout &amp;amp;lt;&amp;amp;lt; &amp;quot;x 좌표의 위치를 설정하세요 \n&amp;quot;;&lt;br /&gt;
 	  cin &amp;amp;gt;&amp;amp;gt; i;&lt;br /&gt;
 	  cout &amp;amp;lt;&amp;amp;lt; &amp;quot;y 좌표의 위치를 설정하세요 \n&amp;quot;;&lt;br /&gt;
 	  cin &amp;amp;gt;&amp;amp;gt; j;&lt;br /&gt;
       Pos_x = i;&lt;br /&gt;
 	  Pos_y = j;&lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 void Roach :: Walk()&lt;br /&gt;
 {&lt;br /&gt;
 	  t=rand()%Direction;                  // 랜덤으로 바퀴벌레가 움직일 방향을 정한다&lt;br /&gt;
 	  if(Pos_x + imove[t] &amp;amp;gt;= 0 &amp;amp;amp;&amp;amp;amp; Pos_x + imove[t] &amp;amp;lt; size_x) // 바퀴벌레가 타일밖으로 벗어나지 않도록 하는 조건&lt;br /&gt;
 	  Pos_x += imove[t];                                     // 바퀴벌레의 x 좌표 위치를 갱신          &lt;br /&gt;
 	  if(Pos_y + jmove[t] &amp;amp;gt;= 0 &amp;amp;amp;&amp;amp;amp; Pos_y + jmove[t] &amp;amp;lt; size_y) &lt;br /&gt;
 	  Pos_y += jmove[t];                                     // 바퀴벌레의 y 좌표 위치를 갱신&lt;br /&gt;
       count++;                                               // 바퀴벌레가 총 움직인 횟수를 구하기 위한 카운터&lt;br /&gt;
       if(Tile[Pos_x][Pos_y]==0)&lt;br /&gt;
 	  R_count++;	                                         // 바퀴벌레가 모든 타일을 방문하면 멈추게 하기 위한 카운터&lt;br /&gt;
 	  Tile[Pos_x][Pos_y]++;                                  // 바퀴벌레가 타일을 방문할 때마다 증가하여 방문 횟수를 구한다. &lt;br /&gt;
 };&lt;br /&gt;
 &lt;br /&gt;
 void Roach :: show()&lt;br /&gt;
 {&lt;br /&gt;
 	cout &amp;amp;lt;&amp;amp;lt; &amp;quot;바퀴벌레의 총 이동횟수는 &amp;quot; &amp;amp;lt;&amp;amp;lt; count &amp;amp;lt;&amp;amp;lt; &amp;quot; 입니다.\n&amp;quot;;&lt;br /&gt;
 	cout &amp;amp;lt;&amp;amp;lt; &amp;quot;현재 위치는 &amp;quot; &amp;amp;lt;&amp;amp;lt; Pos_x &amp;amp;lt;&amp;amp;lt; &amp;quot; , &amp;quot; &amp;amp;lt;&amp;amp;lt; Pos_y &amp;amp;lt;&amp;amp;lt; &amp;quot;입니다.\n&amp;quot;;&lt;br /&gt;
 	cout &amp;amp;lt;&amp;amp;lt; &amp;quot;각 타일을 방문한 횟수는 다음과 같습니다. \n&amp;quot;;&lt;br /&gt;
 	for(int m=0; m &amp;amp;lt; size_x; m++){&lt;br /&gt;
 		for(int n=0; n &amp;amp;lt; size_y; n++)&lt;br /&gt;
 			cout &amp;amp;lt;&amp;amp;lt; Tile[m][n] &amp;amp;lt;&amp;amp;lt; &amp;quot;\t&amp;quot;;&lt;br /&gt;
 		    cout &amp;amp;lt;&amp;amp;lt; endl;&lt;br /&gt;
 	}&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 //20041004 김홍선&lt;br /&gt;
 #include &amp;amp;lt;iostream.h&amp;amp;gt;&lt;br /&gt;
 #include &amp;amp;lt;cstdlib&amp;amp;gt;&lt;br /&gt;
 #include &amp;amp;lt;ctime&amp;amp;gt;&lt;br /&gt;
 #include &amp;quot;Roach.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 void main()&lt;br /&gt;
 {&lt;br /&gt;
 	srand((unsigned)time(NULL));                   // 시간을 이용해 랜덤을 설정&lt;br /&gt;
     Roach Hong;                                    // Hong 이라는 Roach 클래스를 생성&lt;br /&gt;
 	Hong.Initiation();                             // 타일 배열을 초기화&lt;br /&gt;
 	Hong.Input();                                  // 바퀴벌레의 시작위치 설정&lt;br /&gt;
 	while(R_count!=size_x*size_y || count &amp;amp;lt; 50000) // 바퀴벌레가 모든 타일을 거치면 멈추거나 횟수가 50000을 넘으면 멈추게 한다&lt;br /&gt;
 	Hong.Walk();                                   // 바퀴벌레의 이동 메서드&lt;br /&gt;
 	Hong.show();	                               // 결과값 출력&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
지저분한게... 어디를 고쳐야 할지... 막막하네요...&lt;br /&gt;
공부를 합시다 ㅡ_ㅡ^&lt;br /&gt;
&lt;/div&gt;</summary>
		<author><name>imported&gt;Unknown</name></author>
	</entry>
</feed>