Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create MachineOne, that has three states, A, B, and C, and accepts inputs f (for forward) and b (for back). The states transition on inputs

Create MachineOne, that has three states, A, B, and C, and accepts inputs f (for forward) and b (for back). The states transition on inputs according to:

the states are considered to be in a circular order, A then B then C then back to A, and so on. on input f, the state is advanced. I.e. from A to B, from B to C, and from C to A. on input b, the state retreats. I.e. from A to C, from B to A, and from C to B.

Replace the pass statement with code to implement MachineOne.

The machine begins in state A.

class MachineOne: def __init__(self): pass def signal(self,message): pass def get_state(self): pass return ''

Pass this test, and other tests that you can think of.

def run_tests_one(): tests = ['fffbbfbfbbffbbbf'] results = ['ABCACBCBCBABCBACA']

verdict = 'PASS' for t, r in zip(tests,results): if test_machine(MachineOne(), t) != r: verdict = 'FAIL' print(verdict) run_tests_one()

FAIL

Please either show brief code of python implementation or at least give me some ideas on how to pass the test.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Lab Manual For Database Development

Authors: Rachelle Reese

1st Custom Edition

1256741736, 978-1256741732

More Books

Students also viewed these Databases questions

Question

Ty e2y Evaluate the integral dy

Answered: 1 week ago

Question

8. Describe the steps in the development planning process.

Answered: 1 week ago