Introduction to the algorithm classic sixth chapter example 6-14 Abbott Revenge (Abbott's Revenge) BFS algorithm implementation

Source: Internet
Author: User
Sample Input

3 1 N 3 3
1 1 WL NR *
1 2 WLF NR ER *
1 3 NL ER *
2 1 SL WR NF *
2 2 SL WF ELF *
2 3 SFR EL *
0

Sample Output

(3,1) (2,1) (2,2) (2,3) (1,3) (+) (2,1)
(2,2) (1,3) (2,3) (3,3)

Analysis

The main idea of the topic is to enter the starting point, leaving the starting point and the end point, to find a shortest.
At each coordinate, there is the direction at which the coordinates are entered, that is news. News shows on, right, left, down, LFR, respectively, left, straight, right. For example, you input, 1 1 NR EL, corresponding to the figure (1, 1) coordinate point, said: When you enter (at the time) of the turn of N, that is, when you go upward, then you can only r, that is, turn right; When you enter the direction of E, that is left, then you can only L, then left Combined with graphic understanding!

Introduction to the algorithm classic sixth chapter example 6-14 Abbott Revenge (Abbott's Revenge) BFS algorithm implementation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.