Beta
Finite automation 1: DFA Runner
55aland97
Loading description...
Fundamentals
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
That's not correct. I think. Add an extra 1 and you end up in state 2, which is the accepted state. Or am I missing something here?
yes string "0001" accepted, but "000" is not. If you add new character its not same string.
I see. So 'when characters are over' means 'when there's no characters left'. Nice Kata, btw.
The Example tests are pretty much useless: they pass both
() => false
and() => true
. Also, they haveactual
andexpected
in the wrong order and they haveit
nested init
.Were they updated when the Submit tests were, or was that overlooked? ( Yes, I
reset
the Trainer. )fixed
This kata is effectively a duplicate of any FNS executor, e.g. this one - the addition of a couple
if (curState not in X) return false
statements doesn't make it novel or unique.if that was the only difference I would agree
but in the indicated kata all transitions and state hardcoded
Is this a joke? Turning a hard-coded value into a function parameter changes absolutely nothing about the task or the algorithm.
Are you also going to tell me that these are 2 completely different things, and by adding another parameter you're "generalizing" something?
yes this is how it works
I'd say this kata is in the grey zone of being a duplicate. As it's the first kata of a series of kata's that get harder and harder, I would opt to keep this one.
imo, it's too much of a duplicate, yes. The series can still exist, it would just need to put the
#1
on the next one.Hi,
The description is extremly convoluted, using different notations to denote the same thing (code/description), changing the oprder from time to time, the inputs aren't clearly described (at least not when it would be appropriate), sometimes using "qi" sometimes talking about numbers, most of the actual arguments name aren't even showing up explicitely in the description, ...
You're doing your best at losing the reader, there. :s
I agree with you. I'm really bad in the descriptions)) tried to improve. If it does not bother you, could you give specific advice on increasing readability.
Actual specs, including any encodings, for the function arguments would help.
Does the DFA input need to be consumed exactly completely?
i hope it's more clear now
ex on this one:
Prefere to use the arguments names in the descirption:
Sstart
stringinput
(and there you realize that an argument named input is rather unfortunate)English wording is helping too, or at least something closer to english (if I see the mistakes, that's a bad sign x) ;o )
A title section is missing before that line =>
### Example
=> Succession of states for the
input
"0011", starting in statestart
generally, you put the example at the end (before any "notes"), or at the very least, once you've described the actual task.
Made changes, I hope I didn't miss anything
=> A starting state
startState
fromQ
=> The set of final accepted states
acceptStates
, a subset of Qdone)
.
describe
andit
blocks correctlyit
-block;it
-blocks can be wrapped in any number ( including zero ) ofdescribe
-blocks.Anybody who believes
describe
is not optional is invited to provide a reference.and why do you feel that urge for breaking the homogeneity of the practices further...? I still don't get that.
This comment has been hidden.
I cannot use 'it' for every string, there are too many of them. But i use 'describe' for separetateing example and random tests, and provide information about DFA and input on fail. I think this is enough to cover the first two points of issue. If you agree, please close it and open new for third point.
Done.
I'm not breaking homogeneity. Haskell has exactly the same wrapping rules.
describe
is a no-op in terms of testing; all it does is group.Please note I'm not getting notifications for this thread and probably won't come across it in the future. You can reach me on Gitter.
I haven't tried this one, but is it a duplicate? https://www.codewars.com/kata/5268acac0d3f019add000203
not quite, there is a given number of states and predefined transitions. This kata is more general, and is rather needed to close the gap in the series of kata about finite automata.
I have planned 5 kata about regex, DFA and NFA
No, it's pretty much the same unless you're saying that throwing in 2 small
if
statements makes your kata any novel. Implying that the list of transitions being provided as an argument instead of being hardcoded makes any difference would be ridiculous.Needed by whom and why?
The third fixed test case (the
Should work for /a(aa|bb)*b/
one) is invalid: input is00
but the states areab
. It's not mentioned that such cases needs to be handled.how i missed it (( thank you!
It's not been applied to the test fixture yet though, only the sample tests have been fixed.
fixed)
Now it seems that both test cases are back to not working again...
i am sure everything is ok now
if I understood you correctly
Random tests generate transition tables that violate this condition:
There can be only one transition for each "s1" and "a".
my bad
Fixed
The input can be modified by the user.
Fixed