Skip to content

Check that for dfa all states must be present in transition map #2

@Devorein

Description

@Devorein
const { DeterministicFiniteAutomaton } = require('fauton');

const startsWithBC = new DeterministicFiniteAutomaton(
	(inputString) => inputString.startsWith('bc'),
	{
		alphabets: ['a', 'b'],
		states: ['A', 'B', 'C'],
		transitions: {
			A: ['B', 'A'],
			B: ['A', 'B'],
		},
	}
);

Transition for state 'C' is not present, but no error is thrown. Ideally, the user should provide all the states in the transition map, but if not an error should be generated as that's the condition of a dfa.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions