JS Finite State Machine Challenge
For this challenge, you will create a simple Finite-State Machine, represented by a
- Fork and clone this repository.
- Change into the new directory.
- Install dependencies.
- Create and checkout a new branch to work on.
- Fulfill the listed requirements.
Starter code is available in
lib/challenge.js. A pull request is not required, but it is necessary if you want a code review.
SubwayGate constructor function that represents a Finite-State Machine. Each instance should have its own
state that starts as
closed. Each instance of
SubwayGate should have access to four methods:
state should transition to
open under three circumstances:
trueis tapped on the gate
charlieTicketwith a high enough
value($2.25) is inserted into the gate
- a person is
exiting the station
state should only transition to
closed when the
walkThrough method is invoked.
While the gate's state is
open, tapping a card or inserting a ticket should not transition the state to
closed, also no further
value should be deducted from the ticket.
The tests will handle the creation of the
charlieTicket, you should use them as parameters to your methods. They will be objects and their keys are mentioned above.
Developers should run these often!
grunt nagor just
grunt: runs code quality analysis tools on your code and complains.
grunt make-standard: reformats all your code in a standard style.
grunt test: runs any automated tests; may depend on
- All content is licensed under a CCBYNCSA 4.0 license.
- All software code is licensed under GNU GPLv3. For commercial use or alternative licensing, please contact email@example.com.