For this challenge, you will create a simple Finite State Machine.
- 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.
You may wish to refer to FAQs related to forking and cloning.
Implement SubwayGate
, a function that represents a finite-state machine. In this scenario our machine is the gate at the subway and can only exist in two states: open
and closed
. The gate only opens for the following reasons:
- a Charlie Card is tapped on the gate
- a ticket is inserted into the gate with enough money to get on the T ($2.25)
- a person is exiting the station If the gate is open, then tapping the card again will not transition the state to closed. The state transitions to closed upon a person walking through the gates.
Developers should run these often!
grunt nag
or justgrunt
: 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 ongrunt build
.
- 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 legal@ga.co.