<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://wiki.kram.nz/index.php?action=history&amp;feed=atom&amp;title=SE250%3Alab-X%3Ahpan027</id>
	<title>SE250:lab-X:hpan027 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.kram.nz/index.php?action=history&amp;feed=atom&amp;title=SE250%3Alab-X%3Ahpan027"/>
	<link rel="alternate" type="text/html" href="https://wiki.kram.nz/index.php?title=SE250:lab-X:hpan027&amp;action=history"/>
	<updated>2026-04-28T12:13:56Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://wiki.kram.nz/index.php?title=SE250:lab-X:hpan027&amp;diff=8955&amp;oldid=prev</id>
		<title>Mark: 22 revision(s)</title>
		<link rel="alternate" type="text/html" href="https://wiki.kram.nz/index.php?title=SE250:lab-X:hpan027&amp;diff=8955&amp;oldid=prev"/>
		<updated>2008-11-03T05:20:45Z</updated>

		<summary type="html">&lt;p&gt;22 revision(s)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[SE250:lab-X]]&lt;br /&gt;
&lt;br /&gt;
Final lab&lt;br /&gt;
&lt;br /&gt;
== Task One ==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;#039;Calculate how many different states exist for the 8-piece puzzle.&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;#039;Estimate the number of edges in the complete state space graph.&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;#039;Explain how you made these calculations in your report.&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
*Number of state 9!&lt;br /&gt;
*Number of edges:&lt;br /&gt;
**When space is at a corner - 2 possible moves (4/9)&lt;br /&gt;
**When space is at a side - 3 possible moves (4/9)&lt;br /&gt;
**When space is at centre - 4 possible moves (1/9)&lt;br /&gt;
**If the space is fixed, then there are 8! possible states&lt;br /&gt;
**Hence 8! * 2 * 4 + 8! * 3 * 4 + 8! * 4 + 1&lt;br /&gt;
**967681&lt;br /&gt;
**Have to recheck this later&lt;br /&gt;
&lt;br /&gt;
*Upon doing task three&lt;br /&gt;
**There are a lot of overlaps (e.g. 1-&amp;gt;3 and 3-&amp;gt;1 would be along the same edge)&lt;br /&gt;
**Number should be halved?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Task Two ==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;#039;The main search code can be found in search.c. In your own&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;#039;words, write a summary of the search algorithm in your report.&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
*There seems to be a stack. Probably a depth-first search. Too much code to read, might revisit later.&lt;br /&gt;
*Read task four. Heh.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Task Three ==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;#039;By hand, draw a graph of the region of the state space within two&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;#039;consecutive moves of the initial state shown. Highlight the start&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;#039;and goal states, and the solution path from the start to the goal.&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
&amp;lt;img src=&amp;quot;http://studwww.cs.auckland.ac.nz/~hpan027/250-10-art.jpg&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*Forgot to point out the goal state&lt;br /&gt;
*New and exciting intermittent step of trying to get code to compile&lt;br /&gt;
*Stuff on main lab page was helpful&lt;br /&gt;
*Seems to check out - the 123456.78 has 2 neighbours, each of which has 2 other neighbours&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Task Four ==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;#039;Use the print state function to print the first few states the search&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;#039;code checks, compare this to your graph and describe in your&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;#039;own words how this search strategy traverses the search space.&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
*Output&lt;br /&gt;
 .12&lt;br /&gt;
 345&lt;br /&gt;
 678&lt;br /&gt;
 1.2&lt;br /&gt;
 345&lt;br /&gt;
 678&lt;br /&gt;
 12.&lt;br /&gt;
 345&lt;br /&gt;
 678&lt;br /&gt;
 125&lt;br /&gt;
 34.&lt;br /&gt;
 678&lt;br /&gt;
 125&lt;br /&gt;
 348&lt;br /&gt;
 67.&lt;br /&gt;
 142&lt;br /&gt;
 3.5&lt;br /&gt;
 678&lt;br /&gt;
*One consecutive move at a time&lt;br /&gt;
*Backtrack &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Task Five ==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;#039;Run the search code. What do you notice about the solution compared&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;#039;with the solution in your state graph?&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
*My state graph did not print out properly - this task is kinda hard for me to do&lt;br /&gt;
*Solution is probably not the shortest path etc.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Task Six ==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;#039;Make a one-line change to the code in search.c to convert the algorithm from depth-first&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;#039;to breadth first search.&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;#039;What do you notice about the breadth-first solution compared&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;#039;with the depth first one?&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
*Requires some thought&lt;br /&gt;
*Changing a stack to a queue in 1 line is hard&lt;br /&gt;
*Does rewriting OrderedStackList into a queue count?&lt;br /&gt;
*Skipping ahead for now&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Task Seven ==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;#039;Conduct searches from the initial state to the goal state below for&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;#039;both breadth first and depth first search.&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;#039;How many states have to be examined before the solution is found&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;#039;in each case? Compare the path returned for both solutions.&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Task Eight ==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;#039;What are the obvious benefits of using each of these two different&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;#039;search strategies? Under what circumstances would we prefer one&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;#039;over the other? Suggest some features of the state-space that will&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;#039;affect the relative performance of the algorithms.&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
*Depth-first to conserve memory, finite state space&lt;br /&gt;
*Breadth-first for shortest path, infinite state space&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Task Nine ==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;#039;How are infinite loops (such as moving a piece back and forth)&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;#039;prevented in the supplied code? What data structures are used?&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
*A set was implemented using hash tables&lt;br /&gt;
*Happened to be applicable because of the relatively small number of states for an 8-puzzle&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Task Ten ==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;#039;Implement iterative deepening search.&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
*.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Conclusions ==&lt;br /&gt;
&lt;br /&gt;
*Code still does not compile &amp;#039;out of the box&amp;#039; :(&lt;br /&gt;
*C sucks with chain #include of things - it&amp;#039;s hard to find where functions and structs are defined&lt;br /&gt;
**Makes code very hard to read in general&lt;br /&gt;
*Having to make one line modification to fully written code is [[SE250:lab-X:hpan027#Task_Six | annoying]]&lt;/div&gt;</summary>
		<author><name>Mark</name></author>
	</entry>
</feed>