[英]Deterministic Finite Automata on JFLAP
I have a DFA problem and I need to use JFLAP to create a diagram for the automata.我有一个 DFA 问题,我需要使用 JFLAP 为自动机创建图表。 I have successfully done a more simple problem, however I just can't figure out how to solve this one:
我已经成功地完成了一个更简单的问题,但是我不知道如何解决这个问题:
"A DFA that receives sequences of "1" and "2" values, accepting only sequences that result in 4. Any other combinations that result in more than or less than 4 are to be rejected." “一个接收“1”和“2”值序列的 DFA,只接受结果为 4 的序列。任何其他结果大于或小于 4 的组合都将被拒绝。
The alphabet is {1,2} and as far as I know these are the possible combinations that will be accepted:字母表是 {1,2},据我所知,这些是可以接受的可能组合:
1111, 22, 121, 112, 211
1111、22、121、112、211
Any help will be very much appreciated.任何帮助将不胜感激。 Thank you.
谢谢你。
A DFA for this finite language could look a lot like this:这种有限语言的 DFA 可能看起来很像这样:
1 1 1 1
----->q----->q1----->q11----->q111----->q1111
| | | | |
| 2 | 2 | 1 | 2 | 1,2
| | | | |
V 1 V 1 V | |
q2----->q21----->q211 | |
| | | | |
| 2 | 2 | 1,2 | |
| | | | |
V | | | |
q22 | | | |
| | | | |
| 1,2 | | | | +-----+
| | | | | | | 1,2
V V V V V V |
+-------+--------+------+---------+--------->qDead----+
Another approach would be just to remember the current sum:另一种方法是记住当前的总和:
1
----->q0----->q1
| /|
| / |
| / |
2 | 1 / | 2
| / |
| / |
| / |
|/ |
V 1 V
q2----->q3
| /|
| / |
| / |
2 | 1 / | 2
| / |
| / |
| / |
|/ |
V 1,2 V
q4----->qDead
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.