30 Chuan's state Machine road (creative, not timed upload)

Source: Internet
Author: User
Tags fsm

Chuan's first dry goods, will be told from FSM (finite state machine) begins.

Chuan First Contact state machine This kind of thing, also have to go back to the first to swim work, cracked the code of other games (game program is so no moral integrity and the bottom line, eh! Only to know that there is such a thing. Although the university has studied related ideas, but the first time to see the real material is still very shocking (please forgive me to use " shock " the word, because my ideal program, it should be the same as the mechanical division of work clearly, Before the results can be run correctly).

Now there are a lot of arguments, of course, only a few specific circumstances, the finite state machine is outdated, Feel inefficient and unable to fully implement functionality (such as a few recent articles, about the game ai Everyone seems to have used the FSM to achieve a few views). But just like the sorting algorithm, fast and fast, but also have to write the choice of the sort of people (just for example, not to be with me to break the speed and choice of fast and the application scenario I can not do). FSM FSM You can clearly articulate the program's running flow (note " comparison " because I've also seen a total logical divide into Span style= "Font-family:times New Roman" >2-30 A state, that's a heavenly book.

So, let's look at a core question: what is a finite state machine? Chuan didn't want to go online to carry a bunch of definitions of finite state machines, they were all right, but not my mind.

FSM ( finite-state Machine ) is the abbreviation of the finite state machine, the name of the Machine , that's a machine, hey! So what do you think,FSM is a code-building machine AH (I have to say, I have been to engineering cartography, beautiful mechanical drawings in my eyes is art)! Since it is a machine, it will work to accomplish the task it has been given after it has been designed and manufactured. To give a chestnut: the city Road are willing to open automatic block (because of the easy son Ah, the face of traffic jams when the foot of the clutch is absolutely a powerful exercise on the left leg), its gearbox is a machine, it needs to be in our driving according to our road conditions, speed change different gear (otherwise, the engine will not move the car, Or just wait for the oil to burn, haha).

All right, pull a bunch of them. state machine is in different states under different conditions, to carry out the corresponding state or condition of the code of the machine (if necessary, please understand, Bay stretched out).

30 Chuan's state Machine road (creative, not timed upload)

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.