Mozilla-Campus-Club-Cummins / Hacktoberfest2021_Moz_Cummins

MIT License
1 stars 0 forks source link

Problem_Statement_55 #49

Closed ParnaviKulkarni closed 3 years ago

ParnaviKulkarni commented 3 years ago

A Simple Automaton

Create a finite automaton that has three states. Finite automatons are the same as finite state machines for our purposes. Our simple automaton accepts the language of A, defined as {0, 1} and should have three states: q1, q2, and q3. Here is the description of the states: q1 is our start state, we begin reading commands from here q2 is our accept state, we return true if this is our last state And the transitions: q1 moves to q2 when given a 1, and stays at q1 when given a 0 q2 moves to q3 when given a 0, and stays at q2 when given a 1 q3 moves to q2 when given a 0 or 1 The automaton should return whether we end in our accepted state (q2), or not (true/false).

Your task

You will have to design your state objects, and how your Automaton handles transitions. Also make sure you set up the three states, q1, q2, and q3 for the automaton instance. As an aside, the automaton accepts an array of strings, rather than just numbers, or a number represented as a string, because the language an automaton can accept isn't confined to just numbers. An automaton should be able to accept any 'symbol.'

Example

a = Automaton() a.read_commands([""1"", ""0"", ""0"", ""1"", ""0""]) ==> False We make these transitions: input: [""1"", ""0"", ""0"", ""1"", ""0""] 1: q1 -> q2 0: q2 -> q3 0: q3 -> q2 1: q2 -> q2 0: q2 -> q3 We end in q3 which is not our accept state, so we return false.

Aditi-Bornare commented 3 years ago

Hey, I'm Aditi Bornare from TY. I would like to work on this issue.

ParnaviKulkarni commented 3 years ago

Yes I've assigned this issue to you. All the best!

Shr03mink commented 3 years ago

Hey you are already assigned one issue @Aditi-Bornare . So we wont be assigning this one to you as only 1 issue at a time. You will be assigned another issue only after your first PR gets merged

Aditi-Bornare commented 3 years ago

Okay

Aditi-Bornare commented 3 years ago

Hey, my pr got merged. Could you assign this issue to me?

ParnaviKulkarni commented 3 years ago

Yes I've assigned this issue to you. Just one more thing, mention this issue while submitting solution for this to link the solution to the issue. All the best!

Aditi-Bornare commented 3 years ago

Yes, sure. Thank you!

Shr03mink commented 3 years ago

@Aditi-Bornare you could mention issue no in PR description as that's a better approach. you can delete the above comment and maybe do it the other way :)

ParnaviKulkarni commented 3 years ago

I've merged your PR. Thank you for contributing to Mozilla CCEW. Happy contributing!