Writing Bonfire challenges is a great way to exercise your own problem solving and testing abilities. Follow this process closely to maximize the chances of us accepting your bonfire.
- Fork the Free Code Camp repository and open
seed_data/bonfires.json to become familiar with the format of our bonfires.
- Regardless of your bonfire's difficulty, put it as the last bonfire in the JSON file. Change one of the numbers in the ID to ensure that your bonfire has a unique ID.
- In the terminal, run
node seed_data/seed.js. Run
gulp. You should be able to navigate to your new bonfire in the challenge map. Whenever you make a change to bonfire.json, you'll need to reseed in order to see these changes in the browser.
- Solve your own Bonfire. Confirm that your tests work as expected and that your instructions are sufficiently clear.
- Submit a pull request to Free Code Camp's Staging branch and in the pull request body, link to a gist that has your algorithmic solution.
Here is a description of each of the Bonfires' fields.
- Name - The name of your challenge. It's OK for this to be humorous but it must be brief and relevant to the task.
- Difficulty - Attempt to rate difficulty compared against existing bonfire challenges. A good proxy for the difficulty of a bonfire is how long it takes you to solve it. For every 15 minutes it takes, increase the difficulty. For example, a one-hour bonfire should probably be a 4.
- Description- Separate paragraphs with a line break. Only the first paragraph is visible prior to a user before they click the the 'More information' button. All necessary information must be included in the first paragraph. Write this first paragraph as succinctly as possible. Subsequent paragraphs should offer hints or details if needed. If your subject matter warrants deeper understanding, you may link to Wikipedia.
- Challenge Seed - This is where you set up what will be in the editor when the camper starts the bonfire.
- Tests - These tests are what bring your challenge to life. Without them, we cannot confirm the accuracy of a user's submitted answer. Choose your tests wisely. Bonfire tests are written using the Chai.js assertion library. Please use the should and expect syntax for end user readability. As an example of what not do to, many of the original Bonfire challenges are written with assert syntax and many of the test cases are difficult to read. If your bonfire question has a lot of edge cases, you will need to write many tests for full coverage. If you find yourself writing more tests than you desire, you may consider simplifying the requirements of your bonfire challenge. For difficulty level 1 through 3, you will generally only need 2 to 4 tests.
- MDNlinks- Take a look at
seed_data/bonfireMDNlinks.js. If any of these concepts are relevant to your bonfire, be sure to include them. If you know of an MDN article that isn't linked here, you can add it to the bonfireMDNlinks.js file before adding it to your bonfire.
:pencil: read more about what the style guide for bonfires is on the FCC Wiki