Starting from:

$30

CS373-Programming Assignment 2 Solved

Construct a DFA using JFLAP that simulates the following game (modified problem 2.3 from Hopcroft/Ullman). We drop a marble down the chute labeled A or B. If the last marble that we drop down the chutes comes out one of the chutes labeled C or F, then we loose. If the last marble that we drop down the chutes comes out one of the chutes labeled D or E, then we win.

To simulate this we have an input alphabet of {0, 1}. An input symbol of '0' simulates dropping a marble down chute A and an input symbol of '1' simulates dropping a marble down chute B. Each time a marble touches a gate it toggles the gate to the other direction and the marble goes in the direction that the gate was set to prior to being toggled. Initially all of the gates are configured to the left (as shown in the diagram). As an example, if all of the gates are positioned to the left, then dropping a marble down chute A results in the marble exiting gate C and toggling gates X1 and X3 to the right. If the gates are configured as X1 and X2 to the right, and X3, X4, and X5 to the left, then dropping a marble down chute A results in the marble exiting chute D and toggling gates X1 to the left and X4 to the right.

 

You are to construct a DFA using JFLAP that simulates this marble game, with the DFA accepting those strings that result in winning and rejecting those strings that result in loosing.

More products