# Information of the LO Subject: Data Structures, Algorithms Topic: Maze Routing Education Level: UG Problem Statement: Given a n x n maze, find a path from.

## Presentation on theme: "Information of the LO Subject: Data Structures, Algorithms Topic: Maze Routing Education Level: UG Problem Statement: Given a n x n maze, find a path from."— Presentation transcript:

Information of the LO Subject: Data Structures, Algorithms Topic: Maze Routing Education Level: UG Problem Statement: Given a n x n maze, find a path from start to finish by moving either horizontally or vertically without going through the walls. Authors: Mentor: Jasveer Singh T. Jethra Prof. Sachin Patkar Priyadarshan H 1

Pre requisites Before using this LO, the user should know about the following: No prerequisites 2

Learning objectives After interacting with this LO the user should be able to: Find a path in a maze from start to finish. 3

Keywords in this LO These are the keywords and their description in this LO 1.Live Node: This is a node which has been traversed and all possible ways of expansion have not been explored. 2. E-node: E-node or Expansion Node is the current node from which we explore for possible empty nodes in the neighbourhood. There is only one E-node at any instant. 3. Dead Node: If we leave a E-node from the direction in which this node was entered then it becomes a dead node. This node is to be treated as a wall in future. 4. Wall: It is a node (block) which cannot be entered. 4

5. Empty Node: This is a node which is available for traversal. 6. Start Node: It is the node from which we start traversing the maze. This node can never be a wall. 7. Finish Node: It is a node where we intend to reach. This node can never be a wall. 5

Element groups in this LO S. No.Name of the element group and Abbreviation Name of the elements in the group Rank of element group (in terms of the most important element group on the screen that students should focus on) 1: most important, 2: next in importance, … and so on 1Maze1 2Screen text 2 (Will not be available for Interactivity part) 3Interactivity Block 2 (Will not be available for Demo part) 4Legend3 6

Element groups in this LO – Sample template of LO 7 Maze On screen text/Interact ivity block Legend

Write the name of the element group 1 - Maze The title of each column explains contains guidelines on the details required. ) 8 Name of the element AbbreviationReference image Image for using in LO Functional or interactivity details Connected to Maze Explained in next slide Wall # Maze is made of these blocks. Empty Block # Live node# Expansion node E-node# Dead node# Start Node# Finish Node# # Refer Keywords slide No. 4 Start Finish

Functionality of Maze 9 It is a square area of n x n blocks with walls on the four sides of the boundary and walls at some places within the n x n area. In the square area excluding the walls, the (1,1) block represents the start node and (n,n) block represents the finish node. These blocks are always empty. The figure in slide no. 13 shows a maze with all empty blocks surrounded by walls. The fig in slide no. 17 shows a maze with walls within.

Write the name of the element group 3 - Interactivity The title of each column explains contains guidelines on the details required. ) 10 Name of the element Abbreviati on Referenc e image Image for using in LO Functional or interactivity details Wall Style Dropdown box 1.Default 2.Predefined path 3.No path (Refer next slide for functionality of wall styles) Find path Button If a user clicks on the find path button, the algorithm starts executing. (For example of operation refer slides 15 to 42)

Functionality of Wall styles 11 1.Default: When user selects this style, the animator can choose any maze of n x n size which should be legibly displayable on the screen with the only constraint that there should not be any walls in the interior of the wall. 2.Predefined Path: When user selects this style, the animator can choose any maze of n x n size which should be legibly displayable on the screen with the only constraint that there should exist a path from start to finish. For instance, see the maze shown in slide no. 17. 3.No Path: When user selects this style, the animator can choose any maze of n x n size which should be legibly displayable on the screen with the only constraint that there should NOT exist any path from start to finish. For instance, in any maze surround the Finish Node with walls.

Write the name of the element group 4 - Legend The title of each column explains contains guidelines on the details required. ) 12 Start Finish Wall Empty Node Live Node Expansion Node (E-node) Dead Node Start Node Finish Node Legend: Interactivity (for both Demo and Interactivity part): When the user places the mouse pointer on top of any of the legend objects, popup a message which defines that particular object. Use the definition as given in the Keywords (Refer Slide no. 4). For instance, if the user places his mouse pointer on Wall object, then popup It is a node (block) which cannot be entered.

Supportive image for step 1 13 Start Finish

Step 1 14 S. No. Description of the action / interactivity Start Time of the action End Time of the action Audio narratio n On screen text 1. Image shows a typical maze of size 6x6 surrounded by walls 010 Problem Statement: Find a path from start to finish by moving either horizontally or vertically without going through the walls.

Precedence rule 16 Case no. 1 : If the incoming direction is from the left, then precedence for selecting the new empty node is shown in the fig. (a). Case no. 3 : If the incoming direction is from the right, then precedence for selecting the new empty node is shown in the fig. (c). Case no. 2 : If the incoming direction is from the top, then precedence for selecting the new empty node is shown in the fig. (b). Case no. 4 : If the incoming direction is from the bottom, then precedence for selecting the new empty node is shown in the fig. (d). Figure (a) Figure (b) Figure (c) Figure (d)

Supportive image for step 2 (fig. 0) 17 Start Finish

Step 2 - Demo 18 Fig. No. Description of the action / interactivity Start Time of the action End Time of the action Audio narrati on On screen text 0. Display the maze shown in the previous slide and jump to fig 1. 0 sec3 sec Problem Statement: Find a path from start to finish by moving either horizontally or vertically without going through the walls. 1.The Start node becomes Live Node. 3 sec4 sec The Start node becomes Live Node. 2.This node becomes E-node. 3. Choose the next node using Precedence case no. 1. (Slide no. 16) and make it the Live Node. Search for empty node scanning clockwise from the top. (Neglect diagonal nodes). This empty node becomes Live Node. 4. This node becomes E-node. The previous node loses its E-node status. The recent Live Node becomes E- node. The previous node loses its E- node status. 5. The next Live Node is chosen using appropriate precedence rule. The next Live Node is chosen by scanning clockwise from the direction that we entered. 6. This node becomes E-node. The previous node loses its E-node status. Note: The nos. in the Fig. no. column represents the fig. no. mentioned in supportive images for step 2

Supportive image for step 2 (fig. 1) 19 Start Finish

Supportive image for step 2 (fig. 2) 20 Start Finish

Supportive image for step 2 (fig. 3) 21 Start Finish

Supportive image for step 2 (fig. 4) 22 Start Finish

Supportive image for step 2 (fig. 5) 23 Start Finish

Supportive image for step 2 (fig. 6) 24 Start Finish

Step 2 – Demo (contd.) 25 Fig. No. Description of the action / interactivity Start Time of the action End Time of the action Audi o narr ation On screen text 7. Application of Precedence case no. 1 results in direction no. 4. So this node becomes Dead Node. The next node which was Live Node becomes E-node now. For this node the outgoing direction is same as incoming direction so the node becomes Dead Node and the next node which was Live Node becomes E-Node now. 8. The next Live Node is chosen using Precedence Rule case no. 3. The direction no. is 1. Again using the same kind of clockwise scanning starting from the incoming direction the next Live Node is the node below the E-Node. 9. This node becomes E-node. The previous node loses its E-node status. 10. The next Live Node is chosen using Precedence Rule case no. 2. The direction no. is 2. (This step is not shown in the example figures but the animator should show it by making the new live node green first *). This node becomes E-node.(only this step is shown in the figure.) Scanning clockwise from right choose the next Live node which is below the current E-Node. 11-22 Refer to Maze Routing algorithm (slide no. 15) and match it with the fig. 11-22 * Note: This is continued in the next slide as well so please create appropriate intermediate figures for remaining steps.

Supportive image for step 2 (fig. 7) 26 Start Finish

Supportive image for step 2 (fig. 8) 27 Start Finish

Supportive image for step 2 (fig. 9) 28 Start Finish

Supportive image for step 2 (fig. 10) 29 Start Finish

Supportive image for step 2 (fig. 11) 30 Start Finish

Supportive image for step 2 (fig. 12) 31 Start Finish

Supportive image for step 2 (fig. 13) 32 Start Finish

Supportive image for step 2 (fig. 14) 33 Start Finish

Supportive image for step 2 (fig. 15) 34 Start Finish

Supportive image for step 2 (fig. 16) 35 Start Finish

Supportive image for step 2 (fig. 17) 36 Start Finish

Supportive image for step 2 (fig. 18) 37 Start Finish

Supportive image for step 2 (fig. 19) 38 Start Finish

Supportive image for step 2 (fig. 20) 39 Start Finish

Supportive image for step 2 (fig. 21) 40 Start Finish

Supportive image for step 2 (fig. 22) 41 Start Finish

Supportive image for step 2 (fig. 23) 42 Start Finish

Question 1: Can a finish node become a Dead Node? Answers: 1. Yes2. No3. Sometimes Correct answer: 2 Feedback/Justification to be displayed: If user clicks correct answer then display: Correct! As soon as the Finish Node becomes Live Node, the algorithm terminates. If user clicks incorrect answer then display Have a look at the animation and Try again! 43

Question 2:When Start Node becomes a Dead Node then Answers: 1.Path is found 2.No path is found 3.Start Node cannot become a Dead Node Correct answer: 2 Feedback/Justification to be displayed: If user clicks correct answer then display Correct! As soon as the Start Node becomes Dead Node, the algorithm terminates. If user clicks incorrect answer then display Have a look at the animation and Try again! 44

Question 3: Consider the situation as shown in the figure, The next E-node is.. Answers: a)1 b)2 c)3 d)4 Correct answer: a 45 1 23 4 Feedback/Justification to be displayed: If user clicks correct answer then display Correct! Make sure you can explain the reasoning! If user clicks incorrect answer then display Scan Clockwise starting from the incoming direction. The direction is from 2 as it the only Live Node other than the E-node.

Question 4: If no path is found, then select the option which will always stand true.. Answers: a)All blocks are either Dead Nodes or walls. b)All blocks which were Live Nodes are Dead. c)There are no Dead Nodes. d)None of the above Correct answer: b 46 Feedback/Justification to be displayed: If user clicks correct answer then display Correct! A node can become a Dead Node only if it leaves E-node from the direction from which it entered. If user clicks incorrect answer then display Have a look at the animation and Try again!

References Website links: http://www.cise.ufl.edu/~sahni/dsaaj/JavaVersions/applications/ratmaze/m aze.htm Books: Data Structures, Algotithms amd Analysis by Sahni and Sartaj. 47

Similar presentations