SE250:lab-X:dsan039

From Marks Wiki
Jump to navigation Jump to search

it begins here.

Task One

9! different states. Each move will have 8! different combinations (from the rest of the numbers) associated with its potential outcome, (8x8!+12x8!+4x8!)/2. (=12x8!). The divisor of 2 is the result of and edge being bidirectional, which at least one edge is (in every state).

.........
..................
..........................

Task Two

Just looking at the search algorithm, and not the functions it calls on to manipulate the state space. I think it uses a stack system - just by looking the the push and pop commands. I'm not sure if this has an advantage over a queue system (the reverse ordering of children searched) of if im even following the right path. Basically the node is added to a struct holding nodes visited and is then itself checked to be the 'goal' state. Its child states are added to the stateset, and if they have not been seen before they are added to the stack to be themselves checked in the following loops.

Task Three

I found this code difficult to understand, and so moved onto task 3 for a break. The graph i drew looks a little strange, i treated the box as a matrix with rows 1 - 3 and columns 1 - 3, then used each (r,c) position to represent the nodes. There are 4 unique paths from the beginning white space to the final state 2 moves away.

I think my graph is kinda the same as the one printed out, only mine doesn't give justice to the complexity of the potential search process - i used bidirectional arrows instead of explicitly showing the search pattern.

Task Four

(I think...)There is a final struct which holds the optimised route to the goal state. When search is run, the states are printed with this route shown, however the total number of stated checked is printed at the bottom, (and this will probably be a number larger then the number of states printed). The print_state function will print out the number of states visited in total