.

Monday, October 7, 2019

Game Programming Assignment Example | Topics and Well Written Essays - 2500 words

Game Programming - Assignment Example What A* does is generate and process the successor states in a certain way. Whenever it is looking for the next state to process, A-star employs a heuristic function to try to pick the best state to process next. If heuristic function is good, not only will A-star find a solution quickly, but it can also find the best solution possible. Brief Description:: The A* algorithm maintains two sets or ordered lists OPEN and CLOSED. OPEN list keeps a track of those nodes that need to be examined. CLOSED list keeps track of those nodes that have already been examined. Initially, OPEN list contains just the initial node. Start with initial node and insert it in ordered list OPEN list. Create a list CLOSED. This is initially an empty list. Each node 'n' maintains the following: g(n) = the cost of getting from the natal node to 'n' h(n) = the estimate, according to the heuristic function, of the cost of getting from n to the goal node. f(n) = g(n) + h(n); intuitively, this is the estimate of the best solution that goes through n. If OPEN is empty, exit with failure in algorithm. Select first node on OPEN. Remove it from OPEN and put it on CLOSED. This is node 'n'. If 'n' is goal node, exit the program. The solution is obtained by treating a path backwards along arcs in the tree from the node to n. Expand node n. This will generate successors. Read the list OPEN according to heuristic and go back to step 4. Each node maintains a pointer to its parent node, so that later on the best solution if founded can be retrieved. If n is goal node then we are done with solution given by backtracking. For each successor node n, if it is already in CLOSED list and the copy there has an equal or lower 'f' estimate,...Thus, the depths of the graph are first examined. For DFS, a stack can be maintained to keep a record of all the visited nodes, to ease the backtracking process. Given a suitable problem, we represent the initial conditions of the problem with an appropriate initial state, and the goal conditions as the goal state. For each action that is performed, generate successor states to represent the effects of the action. If this continues, at some point one of the generated successor states is the goal state, then the path from the initial state to the goal state is the solution to the problem. What A* does is generate and process the successor states in a certain way. Whenever it is looking for the next state to process, A-star employs a heuristic function to try to pick the best state to process next. If heuristic function is good, not only will A-star find a solution quickly, but it can also find the best solution possible. For each successor node n, if it is already in CLOSED list and the copy there has an equal or lower 'f' estimate, we can safely discard the newly generated n and move on. Similarly if n is already in the OPEN list and the copy there has an equal or lower 'f' estimate, we can discard the newly generated n and move on. If no better version of n exists on either the CLOSED or OPEN lists, we remove the inferior copies from the two lists and set n as the pare

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.