freeCodeCamp / arcade-mode

A repo for algorithm and data structures interview practice app
BSD 3-Clause "New" or "Revised" License
25 stars 33 forks source link

Convert as many of these Rosetta Code tasks as possible into coding challenges #6

Open QuincyLarson opened 7 years ago

QuincyLarson commented 7 years ago

http://rosettacode.org/wiki/Category:Programming_Tasks

Look at the tasks individually, and if you can envision them working well as a coding challenge (no HTML/CSS - just runnable JavaScript), then port them to a coding challenge and add tests.

timolawl commented 7 years ago

We are tracking progress on this Google spreadsheet.

timolawl commented 7 years ago

CONTRIBUTING README for issue #6: Converting RosettaCode tasks to in-house challenges.

If you would like to contribute, please check the spreadsheet to find a task-to-challenge that has not been worked on yet. Once you have decided on a letter, please add your GitHub username to the Contributor section and note the decision wip so that others know you are working on it. If you have been vetted by Quincy/Michael, you will be granted write access to the spreadsheet.

Details: Please refer to this directory.

Workflow steps:

  1. In considering a raw RosettaCode task for conversion, check if it passes the following exclusion criteria test (exclude if):

    • There exists no JavaScript solution
    • It is a trivial task (e.g., it is not asking for A + B)
    • It requires HTML to implement (e.g., requires <canvas>) For other exclusion considerations, refer to the spreadsheet.
  2. If suitable, copy the raw file to its respective formatted letter directory, but replace the .raw extension with .js.

  3. Conversion process:

    • Update the challenge description such that it asks the user to create a function to solve the challenge.
    • In formatting the challenge seed and solution, they should take the form of:
      function <APT_NAME_FOR_CHALLENGE_FN> (<ANY_ARGS>) {
      // Good luck!
      return <APT_RETURN_VALUE>;
      }
    • Visual formatting (i.e., does the challenge look acceptable when viewed in the browser?)
    • Add tests using Chai's assert.
    • The /// tail: section appends code above the /// test: phase. If you find you need to add additional code for testing, it goes in the tail section.
    • If you believe the challenge is benchmark worthy, you can add a benchmark call under /// benchmark:. Otherwise, remove the /// benchmark: and its subsequent line entirely for the time being.
    • Assign a difficulty number between 1 (easiest) and 9 (hardest) given your best estimate.
  4. Lastly, be sure to test the challenge:

    • via unit testing with npm run test:rosetta (be sure that public/json/challenges-rosetta.json has been regenerated with the updated file content before running the test as it relies on this file)
    • via the app itself

If you run into an issue or have questions on the porting process, the first and best method would be to refer to already completed ports; see currently formatted challenges in the directories 0-C and T-Z for reference. If that does not resolve your issue or question, leave a comment below and we will get back to you as soon as we can. If the issue is more general or of a different nature, please create a separate issue. You can also reach us at our Gitter.

Miscellaneous:

  1. There may occasionally be RosettaCode challenges that ask the user to solve multiple tasks. We do not want users to become confused as a result of all the tasks. In these scenarios, please make the best attempt to cut down the number of tasks to one or at most two. The task description will likely have to be rewritten to a degree.

  2. For aesthetics and formatting, refer to other already formatted challenges (e.g., formatted challenges in A-C) and the Rosetta Code task itself.

Thank you for your help!