Answer the question
In order to leave comments, you need to log in
Finite automata and their practical application?
Good afternoon! We have a section on the site with logic. After the user programs it (by setting the parameters he needs), he proceeds to a small test. When he enters the answer to the question "aaa", then depending on the given parameters, he will go to the question "2. q" or somewhere else. There can be any number of such blocks. They are connected using the logical OR.
[]
(aaa == qa || aaa == qb || ... || aaa === qw) => 2. q
[]
(...) => 3. w
[]
(...) => 4. d
[]
...
[]
(...) = x. что-то
[{
"conditions": [{
"expected": "FC3fbfZiRMxCL7Aq8"
}, {
"type": "or",
"expected": "5zEsXWBLLRGEH9p2D"
}, {
"type": "or",
"expected": "MqNeEER2KT662ySdR"
}, {
"type": "or",
"expected": "HgyiSGnxTn8vEqp9t"
}],
"next": "SJkQW7phpwKomnSuz"
}, {
"conditions": [{
"expected": "38mpdXFf6p85LjENb"
}, {
"type": "and",
"expected": "mht4gaX4CrJqGKRN2"
}, {
"type": "or",
"expected": "Sg3AzPCoZ5aHJ6jCL"
}, {
"type": "or",
"expected": "yCBMdkyTv626BJpxW"
}],
"next": "N4TAxk5crpLSoHzTx"
}]
Answer the question
In order to leave comments, you need to log in
So you have already organized the state machine, where your MqNeEER2KT662ySdR
, HgyiSGnxTn8vEqp9t
, SJkQW7phpwKomnSuz
are its states, and the transitions between them are:
You just need to be careful about who can make what transitions. For example, let's say you're building a site with quizzes. Your site server should only make its own transitions and should not be responsible for the user, and the user, on the contrary, can only answer questions, but cannot switch between them himself. Naturally, with a different original intention, the rules may be different.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question