Presentation is loading. Please wait.

Presentation is loading. Please wait.

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.

Similar presentations


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:

1 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

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

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

4 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 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

6 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

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

8 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

9 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.

10 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)

11 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 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.

12 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.

13 Supportive image for step 1 13 Start Finish

14 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.

15 Maze Routing Algorithm 15 1.Begin from the start node. 2.Start node becomes live node. 3.Now this live node will become the E-node. 4.For start node apply the Precedence Rule no A. If empty node does not exist then Print No path found and jump to step 10. B. Else make the new empty node as live node. 6.A. If this node is the finish node then we have successfully routed the maze. Jump to step 10. B. Else this node becomes our E-node. 7.Apply precedence rule to this E-node. 8.A. If precedence no. 4 is selected then E-node becomes dead node. (This node was already made live node previously). i. If the E-node is start node. then print No path found. Jump to step 10. B. Else make the new empty node live node. 9.Jump to step End. Note: 1. A live node will remain alive unless it becomes dead. 2. There is only one E-node at any instant. 3. For Precedence Rule refer next slide.

16 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)

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

18 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

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

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

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

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

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

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

25 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 Refer to Maze Routing algorithm (slide no. 15) and match it with the fig * Note: This is continued in the next slide as well so please create appropriate intermediate figures for remaining steps.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

43 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

44 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

45 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 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.

46 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!

47 References Website links: aze.htm Books: Data Structures, Algotithms amd Analysis by Sahni and Sartaj. 47


Download ppt "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."

Similar presentations


Ads by Google