Skip to content

Commit

Permalink
update to new input
Browse files Browse the repository at this point in the history
  • Loading branch information
keegandonley committed Jun 5, 2020
1 parent e8eb0b4 commit c5dfea5
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import * as modelMap from './models.ts';
import DFA, { IDFAInput, EPSILON } from './automaton.ts';
import { AutomatonOutput } from './output.ts';
import InputLoop from 'https://raw.githubusercontent.com/keegandonley/deno-input/master/index.ts';
import InputLoop from 'https://raw.githubusercontent.com/keegandonley/deno-input/1.0.3/index.ts';


let inputString = '';
Expand Down Expand Up @@ -41,27 +41,27 @@ if (args[0] === 'interactive') {
const result = await input.choose(mainQuestions, true);

if (result[0]) {
const nodeName = await input.question('Enter the label for the node:');
const nodeName = await input.question('Enter the label for the node: ', false);
const accepting = await input.choose(["Accepting node", "Non-accepting node"]);

automaton.addNode(nodeName, accepting[0]);
console.log(automaton.getStructure())
} else if (result[1]) {
const nodeA = await input.question('Enter the source node:');
const nodeB = await input.question('Enter the target node:');
const nodeA = await input.question('Enter the source node: ', false);
const nodeB = await input.question('Enter the target node: ', false);
const edgeType = await input.choose(["Labeled edge", `${EPSILON} edge`]);

if (edgeType[0]) {
const edgeLabel = await input.question('Enter the edge label:');
const edgeLabel = await input.question('Enter the edge label:', false);
automaton.addEdge(nodeA, nodeB, edgeLabel);
} else {
automaton.addEdge(nodeA, nodeB, EPSILON);
}
} else if (result[2]) {
const startingNode = await input.question('Enter the starting node:');
const startingNode = await input.question('Enter the starting node: ', false);
automaton.start(startingNode);
} else if (result[3]) {
const inputString = await input.question('Input to test:');
const inputString = await input.question('Input to test: ', false);
const { accepted, path } = automaton.process(inputString);
output.printResult(accepted);
if (accepted) {
Expand Down

0 comments on commit c5dfea5

Please sign in to comment.