From 5e9a9d07fbc553ac6443669df02dc5c935e9cb71 Mon Sep 17 00:00:00 2001 From: benmcmahon100 Date: Sat, 8 Aug 2015 17:11:11 +0100 Subject: [PATCH 1/6] Update to include OOP & functional programming course layout --- ...t-oriented-and-functional-programming.json | 200 +++++++++++++++++- 1 file changed, 198 insertions(+), 2 deletions(-) diff --git a/challenges/object-oriented-and-functional-programming.json b/challenges/object-oriented-and-functional-programming.json index d3a16ccfdf..dd00934296 100644 --- a/challenges/object-oriented-and-functional-programming.json +++ b/challenges/object-oriented-and-functional-programming.json @@ -1,6 +1,6 @@ { - "name": "Object Oriented and Functional Programming", - "order" : 0.010, + "name": "Object Oriented and Functional Programming - Under Construction From Challenge 4 Onwards", + "order" : 0.009, "challenges": [ { "id": "bd7153d8c44eeddfaeb5bd0f", @@ -114,6 +114,202 @@ "descriptionEs": [], "namePt": "", "descriptionPt": [] + }, + { + "id":"cf1111c1c14feddfaeb4bdef", + "name":"Creating Classes", + "dashedName":"#", + "difficulty":0, + "tests":[ + "assert(1==2, '');" + ], + "challengeSeed":[ + "Under Construction" + ], + "challengeType":0 + }, + { + "id":"cf1111c1c13feddfaeb4bdef", + "name":"Static Properties", + "dashedName":"#", + "difficulty":0, + "tests":[ + "assert(1==2, '');" + ], + "challengeSeed":[ + "Under Construction" + ], + "challengeType":0 + }, + { + "id":"cf1111c1c13feddfaeb5bdef", + "name":"Dynamic Properties", + "dashedName":"#", + "difficulty":0, + "tests":[ + "assert(1==2, '');" + ], + "challengeSeed":[ + "Under Construction" + ], + "challengeType":0 + }, + { + "id":"cf1111c1c13feddfaeb6bdef", + "name":"Instantiation", + "dashedName":"#", + "difficulty":0, + "tests":[ + "assert(1==2, '');" + ], + "challengeSeed":[ + "Under Construction" + ], + "challengeType":0 + }, + { + "id":"cf1111c1c13feddfaeb7bdef", + "name":"Closures", + "dashedName":"#", + "difficulty":0, + "tests":[ + "assert(1==2, '');" + ], + "challengeSeed":[ + "Under Construction" + ], + "challengeType":0 + }, + { + "id":"cf1111c1c13feddfaeb8bdef", + "name":"Public Properties", + "dashedName":"#", + "difficulty":0, + "tests":[ + "assert(1==2, '');" + ], + "challengeSeed":[ + "Under Construction" + ], + "challengeType":0 + }, + { + "id":"cf1111c1c13feddfaeb9bdef", + "name":"Inheritance", + "dashedName":"#", + "difficulty":0, + "tests":[ + "assert(1==2, '');" + ], + "challengeSeed":[ + "Under Construction" + ], + "challengeType":0 + }, + { + "id":"cf1111c1c14feddfaeb1bdef", + "name":"Prototypical Inheritance", + "dashedName":"#", + "difficulty":0, + "tests":[ + "assert(1==2, '');" + ], + "challengeSeed":[ + "Under Construction" + ], + "challengeType":0 + }, + { + "id":"cf1111c1c14feddfaeb2bdef", + "name":"Constructors", + "dashedName":"#", + "difficulty":0, + "tests":[ + "assert(1==2, '');" + ], + "challengeSeed":[ + "Under Construction" + ], + "challengeType":0 + }, + { + "id":"cf1111c1c14feddfaeb3bdef", + "name":"Factories", + "dashedName":"#", + "difficulty":0, + "tests":[ + "assert(1==2, '');" + ], + "challengeSeed":[ + "Under Construction" + ], + "challengeType":0 + }, + { + "id":"cf1111c1c14feddfaeb5bdef", + "name":"Pure Functions", + "Note":"May need a waypoint before each topic to announce what it is :p", + "dashedName":"#", + "difficulty":0, + "tests":[ + "assert(1==2, '');" + ], + "challengeSeed":[ + "Under Construction" + ], + "challengeType":0 + }, + { + "id":"cf1111c1c14feddfaeb6bdef", + "name":"Currying Functions", + "dashedName":"#", + "difficulty":0, + "tests":[ + "assert(1==2, '');" + ], + "challengeSeed":[ + "Under Construction" + ], + "challengeType":0 + }, + { + "id":"cf1111c1c14feddfaeb7bdef", + "name":"Composition", + "dashedName":"#", + "difficulty":0, + "tests":[ + "assert(1==2, '');" + ], + "challengeSeed":[ + "Under Construction" + ], + "challengeType":0 + }, + { + "id":"cf1111c1c14feddfaeb8bdef", + "name":"Functors", + "dashedName":"#", + "difficulty":0, + "tests":[ + "assert(1==2, '');" + ], + "challengeSeed":[ + "Under Construction" + ], + "challengeType":0 + }, + { + "id":"cf1111c1c14feddfaeb9bdef", + "name":"Currying Functions", + "dashedName":"#", + "difficulty":0, + "tests":[ + "assert(1==2, '');" + ], + "challengeSeed":[ + "Under Construction" + ], + "challengeType":0 } ] } From af5633bf6b97caf4b422e2ad9f4c0e7db7d4b297 Mon Sep 17 00:00:00 2001 From: benmcmahon100 Date: Sat, 8 Aug 2015 17:21:13 +0100 Subject: [PATCH 2/6] Removed new incomplete JS Challenges and moved to OOPF branch. --- ...t-oriented-and-functional-programming.json | 196 ------------------ 1 file changed, 196 deletions(-) diff --git a/challenges/object-oriented-and-functional-programming.json b/challenges/object-oriented-and-functional-programming.json index dd00934296..93c85cb4ee 100644 --- a/challenges/object-oriented-and-functional-programming.json +++ b/challenges/object-oriented-and-functional-programming.json @@ -114,202 +114,6 @@ "descriptionEs": [], "namePt": "", "descriptionPt": [] - }, - { - "id":"cf1111c1c14feddfaeb4bdef", - "name":"Creating Classes", - "dashedName":"#", - "difficulty":0, - "tests":[ - "assert(1==2, '');" - ], - "challengeSeed":[ - "Under Construction" - ], - "challengeType":0 - }, - { - "id":"cf1111c1c13feddfaeb4bdef", - "name":"Static Properties", - "dashedName":"#", - "difficulty":0, - "tests":[ - "assert(1==2, '');" - ], - "challengeSeed":[ - "Under Construction" - ], - "challengeType":0 - }, - { - "id":"cf1111c1c13feddfaeb5bdef", - "name":"Dynamic Properties", - "dashedName":"#", - "difficulty":0, - "tests":[ - "assert(1==2, '');" - ], - "challengeSeed":[ - "Under Construction" - ], - "challengeType":0 - }, - { - "id":"cf1111c1c13feddfaeb6bdef", - "name":"Instantiation", - "dashedName":"#", - "difficulty":0, - "tests":[ - "assert(1==2, '');" - ], - "challengeSeed":[ - "Under Construction" - ], - "challengeType":0 - }, - { - "id":"cf1111c1c13feddfaeb7bdef", - "name":"Closures", - "dashedName":"#", - "difficulty":0, - "tests":[ - "assert(1==2, '');" - ], - "challengeSeed":[ - "Under Construction" - ], - "challengeType":0 - }, - { - "id":"cf1111c1c13feddfaeb8bdef", - "name":"Public Properties", - "dashedName":"#", - "difficulty":0, - "tests":[ - "assert(1==2, '');" - ], - "challengeSeed":[ - "Under Construction" - ], - "challengeType":0 - }, - { - "id":"cf1111c1c13feddfaeb9bdef", - "name":"Inheritance", - "dashedName":"#", - "difficulty":0, - "tests":[ - "assert(1==2, '');" - ], - "challengeSeed":[ - "Under Construction" - ], - "challengeType":0 - }, - { - "id":"cf1111c1c14feddfaeb1bdef", - "name":"Prototypical Inheritance", - "dashedName":"#", - "difficulty":0, - "tests":[ - "assert(1==2, '');" - ], - "challengeSeed":[ - "Under Construction" - ], - "challengeType":0 - }, - { - "id":"cf1111c1c14feddfaeb2bdef", - "name":"Constructors", - "dashedName":"#", - "difficulty":0, - "tests":[ - "assert(1==2, '');" - ], - "challengeSeed":[ - "Under Construction" - ], - "challengeType":0 - }, - { - "id":"cf1111c1c14feddfaeb3bdef", - "name":"Factories", - "dashedName":"#", - "difficulty":0, - "tests":[ - "assert(1==2, '');" - ], - "challengeSeed":[ - "Under Construction" - ], - "challengeType":0 - }, - { - "id":"cf1111c1c14feddfaeb5bdef", - "name":"Pure Functions", - "Note":"May need a waypoint before each topic to announce what it is :p", - "dashedName":"#", - "difficulty":0, - "tests":[ - "assert(1==2, '');" - ], - "challengeSeed":[ - "Under Construction" - ], - "challengeType":0 - }, - { - "id":"cf1111c1c14feddfaeb6bdef", - "name":"Currying Functions", - "dashedName":"#", - "difficulty":0, - "tests":[ - "assert(1==2, '');" - ], - "challengeSeed":[ - "Under Construction" - ], - "challengeType":0 - }, - { - "id":"cf1111c1c14feddfaeb7bdef", - "name":"Composition", - "dashedName":"#", - "difficulty":0, - "tests":[ - "assert(1==2, '');" - ], - "challengeSeed":[ - "Under Construction" - ], - "challengeType":0 - }, - { - "id":"cf1111c1c14feddfaeb8bdef", - "name":"Functors", - "dashedName":"#", - "difficulty":0, - "tests":[ - "assert(1==2, '');" - ], - "challengeSeed":[ - "Under Construction" - ], - "challengeType":0 - }, - { - "id":"cf1111c1c14feddfaeb9bdef", - "name":"Currying Functions", - "dashedName":"#", - "difficulty":0, - "tests":[ - "assert(1==2, '');" - ], - "challengeSeed":[ - "Under Construction" - ], - "challengeType":0 } ] } From d3bbed92ede0fb10a2922f561aff8ea188c8ccd3 Mon Sep 17 00:00:00 2001 From: alanmbarr Date: Sat, 8 Aug 2015 21:59:03 -0700 Subject: [PATCH 3/6] Update bootstrap.json --- challenges/bootstrap.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/challenges/bootstrap.json b/challenges/bootstrap.json index 800f64d113..d839ef1c06 100644 --- a/challenges/bootstrap.json +++ b/challenges/bootstrap.json @@ -1435,7 +1435,7 @@ "tests": [ "assert($('div.row:has(input[type=\\'text\\'])').length > 0 && $('div.row:has(button[type=\\'submit\\'])').length > 0, 'Nest your form submission button and text area in a div with class \"row\".')", "assert($('div.col-xs-5:has(button[type=\\'submit\\'])').length > 0, 'Nest your form submission button in a div with the class \"col-xs-5\".')", - "assert($('div.col-xs-7:has(input[type=\\'text\\'])').length > 0, 'Nest your form text area in a div with the class \"col-xs-7\".')", + "assert($('div.col-xs-7:has(input[type=\\'text\\'])').length > 0, 'Nest your form text input in a div with the class \"col-xs-7\".')", "assert(editor.match(/<\\/div>/g) && editor.match(/
/g).length === editor.match(/
div elements has a closing tag.')" ], "challengeSeed": [ From 8a003d1c6ab9896b539241226453e8f1171451dc Mon Sep 17 00:00:00 2001 From: alanmbarr Date: Sat, 8 Aug 2015 22:10:07 -0700 Subject: [PATCH 4/6] other typo text input instead of area for clarity --- challenges/bootstrap.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/challenges/bootstrap.json b/challenges/bootstrap.json index d839ef1c06..985a1fa77b 100644 --- a/challenges/bootstrap.json +++ b/challenges/bootstrap.json @@ -1433,7 +1433,7 @@ "This is the last challenge we'll do for our Cat Photo App for now. We hope you've enjoyed learning Font Awesome, Bootstrap, and responsive design!" ], "tests": [ - "assert($('div.row:has(input[type=\\'text\\'])').length > 0 && $('div.row:has(button[type=\\'submit\\'])').length > 0, 'Nest your form submission button and text area in a div with class \"row\".')", + "assert($('div.row:has(input[type=\\'text\\'])').length > 0 && $('div.row:has(button[type=\\'submit\\'])').length > 0, 'Nest your form submission button and text input in a div with class \"row\".')", "assert($('div.col-xs-5:has(button[type=\\'submit\\'])').length > 0, 'Nest your form submission button in a div with the class \"col-xs-5\".')", "assert($('div.col-xs-7:has(input[type=\\'text\\'])').length > 0, 'Nest your form text input in a div with the class \"col-xs-7\".')", "assert(editor.match(/<\\/div>/g) && editor.match(/
/g).length === editor.match(/
div elements has a closing tag.')" From 30b913b2d8b99769c6c13798a44658f5caf47024 Mon Sep 17 00:00:00 2001 From: Shouvik Roy Date: Mon, 10 Aug 2015 07:32:57 +0530 Subject: [PATCH 5/6] Update basic-javascript.json to fix #1642 Fixed following issues #1639 : Fixed ```description``` to have "In JavaScript" instead of "in JavaScript" and added punctuation. #1640 #1641 Added punctuation and fixed typo to have "perform mathematical functions" instead of "preform mathematical functions". --- challenges/basic-javascript.json | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/challenges/basic-javascript.json b/challenges/basic-javascript.json index b8e088adc0..418a027fbb 100644 --- a/challenges/basic-javascript.json +++ b/challenges/basic-javascript.json @@ -272,9 +272,9 @@ "dashedName": "waypoint-add-two-numbers-with-javascript", "difficulty": "9.98141", "description": [ - "In JavaScript whole numbers (called integers) can be easily used to preform mathematical functions", - "Let's try a few of the most commonly used ones now", - "We use +for addition", + "In JavaScript whole numbers (called integers) can be easily used to perform mathematical functions.", + "Let's try a few of the most commonly used ones now.", + "We use +for addition.", "Replace the 0with correct number to achieve the result in the comment." ], "tests": [ @@ -295,9 +295,9 @@ "dashedName": "waypoint-subtract-one-number-from-another-with-javascript", "difficulty": "9.98142", "description": [ - "In JavaScript whole numbers (called integers) can be easily used to preform mathematical functions", - "Let's try a few of the most commonly used ones now", - "We use -for subtraction", + "In JavaScript whole numbers (called integers) can be easily used to perform mathematical functions.", + "Let's try a few of the most commonly used ones now.", + "We use -for subtraction.", "Replace the 0with correct number to achieve the result in the comment." ], "tests": [ @@ -318,9 +318,9 @@ "dashedName": "waypoint-multiply-two-numbers-with-javascript", "difficulty": "9.98143", "description": [ - "In JavaScript whole numbers (called integers) can be easily used to preform mathematical functions", - "Let's try a few of the most commonly used ones now", - "We use *for multiplication", + "In JavaScript whole numbers (called integers) can be easily used to perform mathematical functions.", + "Let's try a few of the most commonly used ones now.", + "We use *for multiplication.", "Replace the 0with correct number to achieve the result in the comment." ], "tests": [ @@ -341,9 +341,9 @@ "dashedName": "waypoint-divide-one-number-by-another-with-javascript", "difficulty": "9.9814", "description": [ - "In JavaScript whole numbers (called integers) can be easily used to preform mathematical functions", - "Let's try a few of the most commonly used ones now", - "We use /for division", + "In JavaScript whole numbers (called integers) can be easily used to perform mathematical functions.", + "Let's try a few of the most commonly used ones now.", + "We use /for division.", "Replace the 0with correct number to achieve the result in the comment." ], "tests": [ @@ -364,7 +364,7 @@ "dashedName": "waypoint-create-decimal-numbers-with-javascript", "difficulty": "9.9815", "description": [ - "in JavaScript we can can work with decimal numbers", + "In JavaScript we can can work with decimal numbers.", "Let's create a variable myDecimal and give it a decimal value." ], "tests": [ From 6ba77ca9f687117359c66496ebb6bf37ddbdcc5f Mon Sep 17 00:00:00 2001 From: Quincy Larson Date: Sun, 9 Aug 2015 21:26:26 -0700 Subject: [PATCH 6/6] update curriculum structure again --- challenges/advanced-bonfires.json | 297 +++++++++++++---- challenges/expert-bonfires.json | 304 ------------------ ...t-oriented-and-functional-programming.json | 117 +------ challenges/upper-intermediate-bonfires.json | 139 ++++++++ 4 files changed, 372 insertions(+), 485 deletions(-) delete mode 100644 challenges/expert-bonfires.json create mode 100644 challenges/upper-intermediate-bonfires.json diff --git a/challenges/advanced-bonfires.json b/challenges/advanced-bonfires.json index c071bfb8b7..b197aad00f 100644 --- a/challenges/advanced-bonfires.json +++ b/challenges/advanced-bonfires.json @@ -1,46 +1,55 @@ { "name": "Advanced Algorithm Scripting", - "order": 0.011, + "order": 0.013, "challenges": [ { - "id": "a2f1d72d9b908d0bd72bb9f6", - "name": "Bonfire: Make a Person", - "dashedName": "bonfire-make-a-person", - "difficulty": "3.01", + "id": "aff0395860f5d3034dc0bfc9", + "name": "Bonfire: Validate US Telephone Numbers", + "dashedName": "bonfire-validate-us-telephone-numbers", + "difficulty": "4.01", "description": [ - "Fill in the object constructor with the methods specified in the tests.", - "Those methods are getFirstName(), getLastName(), getFullName(), setFirstName(first), setLastName(last), and setFullName(firstAndLast).", - "All functions that take an argument have an arity of 1, and the argument will be a string.", - "These methods must be the only available means for interacting with the object.", + "Return true if the passed string is a valid US phone number", + "The user may fill out the form field any way they choose as long as it is a valid US number. The following are all valid formats for US numbers:", + "555-555-5555, (555)555-5555, (555) 555-5555, 555 555 5555, 5555555555, 1 555 555 5555", + "For this challenge you will be presented with a string such as \"800-692-7753\" or \"8oo-six427676;laskdjf\". Your job is to validate or reject the US phone number based on any combination of the formats provided above. The area code is required. If the country code is provided, you must confirm that the country code is \"1\". Return true if the string is a valid US phone number; otherwise false.", "Remember to use RSAP if you get stuck. Try to pair program. Write your own code." ], - "challengeSeed": [ - "var Person = function(firstAndLast) {", - " return firstAndLast;", - "};", - "", - "var bob = new Person('Bob Ross');", - "bob.getFullName();" - ], "tests": [ - "expect(Object.keys(bob).length).to.eql(6);", - "expect(bob instanceof Person).to.be.true;", - "expect(bob.firstName).to.be.undefined();", - "expect(bob.lastName).to.be.undefined();", - "expect(bob.getFirstName()).to.eql('Bob');", - "expect(bob.getLastName()).to.eql('Ross');", - "expect(bob.getFullName()).to.eql('Bob Ross');", - "bob.setFirstName('Happy');", - "expect(bob.getFirstName()).to.eql('Happy');", - "bob.setLastName('Trees');", - "expect(bob.getLastName()).to.eql('Trees');", - "bob.setFullName('George Carlin');", - "expect(bob.getFullName()).to.eql('George Carlin');", - "bob.setFullName('Bob Ross');" + "expect(telephoneCheck(\"555-555-5555\")).to.be.a(\"boolean\");", + "assert.deepEqual(telephoneCheck(\"1 555-555-5555\"), true);", + "assert.deepEqual(telephoneCheck(\"1 (555) 555-5555\"), true);", + "assert.deepEqual(telephoneCheck(\"5555555555\"), true);", + "assert.deepEqual(telephoneCheck(\"555-555-5555\"), true);", + "assert.deepEqual(telephoneCheck(\"(555)555-5555\"), true);", + "assert.deepEqual(telephoneCheck(\"1(555)555-5555\"), true);", + "assert.deepEqual(telephoneCheck(\"1 555 555 5555\"), true);", + "assert.deepEqual(telephoneCheck(\"555-555-5555\"), true);", + "assert.deepEqual(telephoneCheck(\"1 456 789 4444\"), true);", + "assert.deepEqual(telephoneCheck(\"123**&!!asdf#\"), false);", + "assert.deepEqual(telephoneCheck(\"55555555\"), false);", + "assert.deepEqual(telephoneCheck(\"(6505552368)\"), false);", + "assert.deepEqual(telephoneCheck(\"2 (757) 622-7382\"), false);", + "assert.deepEqual(telephoneCheck(\"0 (757) 622-7382\"), false);", + "assert.deepEqual(telephoneCheck(\"-1 (757) 622-7382\"), false);", + "assert.deepEqual(telephoneCheck(\"2 757 622-7382\"), false);", + "assert.deepEqual(telephoneCheck(\"10 (757) 622-7382\"), false);", + "assert.deepEqual(telephoneCheck(\"27576227382\"), false);", + "assert.deepEqual(telephoneCheck(\"(275)76227382\"), false);", + "assert.deepEqual(telephoneCheck(\"2(757)6227382\"), false);", + "assert.deepEqual(telephoneCheck(\"2(757)622-7382\"), false);" + ], + "challengeSeed": [ + "function telephoneCheck(str) {", + " // Good luck!", + " return true;", + "}", + "", + "", + "", + "telephoneCheck(\"555-555-5555\");" ], "MDNlinks": [ - "Closures", - "Details of the Object Model" + "RegExp" ], "challengeType": 5, "nameCn": "", @@ -55,33 +64,31 @@ "descriptionPt": [] }, { - "id": "af4afb223120f7348cdfc9fd", - "name": "Bonfire: Map the Debris", - "dashedName": "bonfire-map-the-debris", - "difficulty": "3.02", + "id": "a3f503de51cf954ede28891d", + "name": "Bonfire: Symmetric Difference", + "dashedName": "bonfire-symmetric-difference", + "difficulty": "4.02", "description": [ - "Return a new array that transforms the element's average altitude into their orbital periods.", - "The array will contain objects in the format {name: 'name', avgAlt: avgAlt}.", - "You can read about orbital periods on wikipedia.", - "The values should be rounded to the nearest whole number. The body being orbited is Earth.", - "The radius of the earth is 6367.4447 kilometers, and the GM value of earth is 398600.4418", + "Create a function that takes two or more arrays and returns an array of the symmetric difference of the provided arrays.", + "The mathematical term symmetric difference refers to the elements in two sets that are in either the first or second set, but not in both.", "Remember to use RSAP if you get stuck. Try to pair program. Write your own code." ], "challengeSeed": [ - "function orbitalPeriod(arr) {", - " var GM = 398600.4418;", - " var earthRadius = 6367.4447;", - " return arr;", + "function sym(args) {", + " return arguments;", "}", "", - "orbitalPeriod([{name : \"sputnik\", avgAlt : 35873.5553}]);" + "sym([1, 2, 3], [5, 2, 1, 4]);" ], "tests": [ - "expect(orbitalPeriod([{name : \"sputnik\", avgAlt : 35873.5553}])).to.eqls([{name: \"sputnik\", orbitalPeriod: 86400}]);", - "expect(orbitalPeriod([{name: \"iss\", avgAlt: 413.6}, {name: \"hubble\", avgAlt: 556.7}, {name: \"moon\", avgAlt: 378632.553}])).to.eqls([{name : \"iss\", orbitalPeriod: 5557}, {name: \"hubble\", orbitalPeriod: 5734}, {name: \"moon\", orbitalPeriod: 2377399}]);" + "expect(sym([1, 2, 3], [5, 2, 1, 4])).to.equal([3, 5, 4]);", + "assert.deepEqual(sym([1, 2, 5], [2, 3, 5], [3, 4, 5]), [1, 4, 5], 'should return the symmetric difference of the given arrays');", + "assert.deepEqual(sym([1, 1, 2, 5], [2, 2, 3, 5], [3, 4, 5, 5]), [1, 4, 5], 'should return an array of unique values');", + "assert.deepEqual(sym([1, 1]), [1], 'should return an array of unique values');" ], "MDNlinks": [ - "Math.pow()" + "Array.reduce()", + "Symmetric Difference" ], "challengeType": 5, "nameCn": "", @@ -96,32 +103,190 @@ "descriptionPt": [] }, { - "id": "a3f503de51cfab748ff001aa", - "name": "Bonfire: Pairwise", - "dashedName": "bonfire-pairwise", - "difficulty": "3.03", + "id": "aa2e6f85cab2ab736c9a9b24", + "name": "Bonfire: Exact Change", + "dashedName": "bonfire-exact-change", + "difficulty": "4.03", "description": [ - "Return the sum of all indices of elements of 'arr' that can be paired with one other element to form a sum that equals the value in the second argument 'arg'. If multiple sums are possible, return the smallest sum. Once an element has been used, it cannot be reused to pair with another.", - "For example, pairwise([1, 4, 2, 3, 0, 5], 7) should return 11 because 4, 2, 3 and 5 can be paired with each other to equal 7.", - "pairwise([1, 3, 2, 4], 4) would only equal 1, because only the first two elements can be paired to equal 4, and the first element has an index of 0!", + "Design a cash register drawer function that accepts purchase price as the first argument, payment as the second argument, and cash-in-drawer (cid) as the third argument.", + "cid is a 2d array listing available currency.", + "Return the string \"Insufficient Funds\" if cash-in-drawer is less than the change due. Return the string \"Closed\" if cash-in-drawer is equal to the change due.", + "Otherwise, return change in coin and bills, sorted in highest to lowest order.", "Remember to use RSAP if you get stuck. Try to pair program. Write your own code." ], "challengeSeed": [ - "function pairwise(arr, arg) {", - " return arg;", + "function drawer(price, cash, cid) {", + " var change;", + " // Here is your change, ma'am.", + " return change;", "}", "", - "pairwise([1,4,2,3,0,5], 7);" + "// Example cash-in-drawer array:", + "// [['PENNY', 1.01],", + "// ['NICKEL', 2.05],", + "// ['DIME', 3.10],", + "// ['QUARTER', 4.25],", + "// ['ONE', 90.00],", + "// ['FIVE', 55.00],", + "// ['TEN', 20.00],", + "// ['TWENTY', 60.00],", + "// ['ONE HUNDRED', 100.00]]", + "", + "drawer(19.50, 20.00, [['PENNY', 1.01], ['NICKEL', 2.05], ['DIME', 3.10], ['QUARTER', 4.25], ['ONE', 90.00], ['FIVE', 55.00], ['TEN', 20.00], ['TWENTY', 60.00], ['ONE HUNDRED', 100.00]]);" ], "tests": [ - "expect(pairwise([1, 4, 2, 3, 0, 5], 7)).to.equal(11);", - "expect(pairwise([1, 3, 2, 4], 4)).to.equal(1);", - "expect(pairwise([1,1,1], 2)).to.equal(1);", - "expect(pairwise([0, 0, 0, 0, 1, 1], 1)).to.equal(10);", - "expect(pairwise([], 100)).to.equal(0);" + "expect(drawer(19.50, 20.00, [['PENNY', 1.01], ['NICKEL', 2.05], ['DIME', 3.10], ['QUARTER', 4.25], ['ONE', 90.00], ['FIVE', 55.00], ['TEN', 20.00], ['TWENTY', 60.00], ['ONE HUNDRED', 100.00]])).to.be.a('array');", + "expect(drawer(19.50, 20.00, [['PENNY', 0.01], ['NICKEL', 0], ['DIME', 0], ['QUARTER', 0], ['ONE', 0], ['FIVE', 0], ['TEN', 0], ['TWENTY', 0], ['ONE HUNDRED', 0]])).to.be.a('string');", + "expect(drawer(19.50, 20.00, [['PENNY', 0.50], ['NICKEL', 0], ['DIME', 0], ['QUARTER', 0], ['ONE', 0], ['FIVE', 0], ['TEN', 0], ['TWENTY', 0], ['ONE HUNDRED', 0]])).to.be.a('string');", + "assert.deepEqual(drawer(19.50, 20.00, [['PENNY', 1.01], ['NICKEL', 2.05], ['DIME', 3.10], ['QUARTER', 4.25], ['ONE', 90.00], ['FIVE', 55.00], ['TEN', 20.00], ['TWENTY', 60.00], ['ONE HUNDRED', 100.00]]), [['QUARTER', 0.50]], 'return correct change');", + "assert.deepEqual(drawer(3.26, 100.00, [['PENNY', 1.01], ['NICKEL', 2.05], ['DIME', 3.10], ['QUARTER', 4.25], ['ONE', 90.00], ['FIVE', 55.00], ['TEN', 20.00], ['TWENTY', 60.00], ['ONE HUNDRED', 100.00]]), [['TWENTY', 60.00], ['TEN', 20.00], ['FIVE', 15], ['ONE', 1], ['QUARTER', 0.50], ['DIME', 0.20], ['PENNY', 0.04] ], 'return correct change with multiple coins and bills');", + "assert.deepEqual(drawer(19.50, 20.00, [['PENNY', 0.01], ['NICKEL', 0], ['DIME', 0], ['QUARTER', 0], ['ONE', 0], ['FIVE', 0], ['TEN', 0], ['TWENTY', 0], ['ONE HUNDRED', 0]]), 'Insufficient Funds', 'insufficient funds');", + "assert.deepEqual(drawer(19.50, 20.00, [['PENNY', 0.50], ['NICKEL', 0], ['DIME', 0], ['QUARTER', 0], ['ONE', 0], ['FIVE', 0], ['TEN', 0], ['TWENTY', 0], ['ONE HUNDRED', 0]]), \"Closed\", 'cash-in-drawer equals change');" ], "MDNlinks": [ - "Array.reduce()" + "Global Object" + ], + "challengeType": 5, + "nameCn": "", + "descriptionCn": [], + "nameFr": "", + "descriptionFr": [], + "nameRu": "", + "descriptionRu": [], + "nameEs": "", + "descriptionEs": [], + "namePt": "", + "descriptionPt": [] + }, + { + "id": "a56138aff60341a09ed6c480", + "name": "Bonfire: Inventory Update", + "dashedName": "bonfire-inventory-update", + "difficulty": "4.04", + "description": [ + "Compare and update inventory stored in a 2d array against a second 2d array of a fresh delivery. Update current inventory item quantity, and if an item cannot be found, add the new item and quantity into the inventory array in alphabetical order.", + "Remember to use RSAP if you get stuck. Try to pair program. Write your own code." + ], + "challengeSeed": [ + "function inventory(arr1, arr2) {", + " // All inventory must be accounted for or you're fired!", + " return arr1;", + "}", + "", + "// Example inventory lists", + "var curInv = [", + " [21, 'Bowling Ball'],", + " [2, 'Dirty Sock'],", + " [1, 'Hair Pin'],", + " [5, 'Microphone']", + "];", + "", + "var newInv = [", + " [2, 'Hair Pin'],", + " [3, 'Half-Eaten Apple'],", + " [67, 'Bowling Ball'],", + " [7, 'Toothpaste']", + "];", + "", + "inventory(curInv, newInv);" + ], + "tests": [ + "expect(inventory([[21, 'Bowling Ball'], [2, 'Dirty Sock'], [1, 'Hair Pin'], [5, 'Microphone']], [[2, 'Hair Pin'], [3, 'Half-Eaten Apple'], [67, 'Bowling Ball'], [7, 'Toothpaste']])).to.be.a('array');", + "assert.equal(inventory([[21, 'Bowling Ball'], [2, 'Dirty Sock'], [1, 'Hair Pin'], [5, 'Microphone']], [[2, 'Hair Pin'], [3, 'Half-Eaten Apple'], [67, 'Bowling Ball'], [7, 'Toothpaste']]).length, 6);", + "assert.deepEqual(inventory([[21, 'Bowling Ball'], [2, 'Dirty Sock'], [1, 'Hair Pin'], [5, 'Microphone']], [[2, 'Hair Pin'], [3, 'Half-Eaten Apple'], [67, 'Bowling Ball'], [7, 'Toothpaste']]), [[88, 'Bowling Ball'], [2, 'Dirty Sock'], [3, 'Hair Pin'], [3, 'Half-Eaten Apple'], [5, 'Microphone'], [7, 'Toothpaste']]);", + "assert.deepEqual(inventory([[21, 'Bowling Ball'], [2, 'Dirty Sock'], [1, 'Hair Pin'], [5, 'Microphone']], []), [[21, 'Bowling Ball'], [2, 'Dirty Sock'], [1, 'Hair Pin'], [5, 'Microphone']]);", + "assert.deepEqual(inventory([], [[2, 'Hair Pin'], [3, 'Half-Eaten Apple'], [67, 'Bowling Ball'], [7, 'Toothpaste']]), [[67, 'Bowling Ball'], [2, 'Hair Pin'], [3, 'Half-Eaten Apple'], [7, 'Toothpaste']]);", + "assert.deepEqual(inventory([[0, 'Bowling Ball'], [0, 'Dirty Sock'], [0, 'Hair Pin'], [0, 'Microphone']], [[1, 'Hair Pin'], [1, 'Half-Eaten Apple'], [1, 'Bowling Ball'], [1, 'Toothpaste']]), [[1, 'Bowling Ball'], [0, 'Dirty Sock'], [1, 'Hair Pin'], [1, 'Half-Eaten Apple'], [0, 'Microphone'], [1, 'Toothpaste']]);" + ], + "MDNlinks": [ + "Global Array Object" + ], + "challengeType": 5, + "nameCn": "", + "descriptionCn": [], + "nameFr": "", + "descriptionFr": [], + "nameRu": "", + "descriptionRu": [], + "nameEs": "", + "descriptionEs": [], + "namePt": "", + "descriptionPt": [] + }, + { + "id": "a7bf700cd123b9a54eef01d5", + "name": "Bonfire: No repeats please", + "dashedName": "bonfire-no-repeats-please", + "difficulty": "4.05", + "description": [ + "Return the number of total permutations of the provided string that don't have repeated consecutive letters.", + "For example, 'aab' should return 2 because it has 6 total permutations, but only 2 of them don't have the same letter (in this case 'a') repeating.", + "Remember to use RSAP if you get stuck. Try to pair program. Write your own code." + ], + "challengeSeed": [ + "function permAlone(str) {", + " return str;", + "}", + "", + "permAlone('aab');" + ], + "tests": [ + "expect(permAlone('aab')).to.be.a('number');", + "expect(permAlone('aab')).to.equal(2);", + "expect(permAlone('aaa')).to.equal(0);", + "expect(permAlone('aabb')).to.equal(8);", + "expect(permAlone('abcdefa')).to.equal(3600);", + "expect(permAlone('abfdefa')).to.equal(2640);", + "expect(permAlone('zzzzzzzz')).to.equal(0);" + ], + "MDNlinks": [ + "Permutations", + "RegExp" + ], + "challengeType": 5, + "nameCn": "", + "descriptionCn": [], + "nameFr": "", + "descriptionFr": [], + "nameRu": "", + "descriptionRu": [], + "nameEs": "", + "descriptionEs": [], + "namePt": "", + "descriptionPt": [] + }, + { + "id": "a19f0fbe1872186acd434d5a", + "name": "Bonfire: Friendly Date Ranges", + "dashedName": "bonfire-friendly-date-ranges", + "difficulty": "4.06", + "description": [ + "Implement a way of converting two dates into a more friendly date range that could be presented to a user.", + "It must not show any redundant information in the date range.", + "For example, if the year and month are the same then only the day range should be displayed.", + "Secondly, if the starting year is the current year, and the ending year can be inferred by the reader, the year should be omitted.", + "Input date is formatted as YYYY-MM-DD", + "Remember to use RSAP if you get stuck. Try to pair program. Write your own code." + ], + "challengeSeed": [ + "function friendly(str) {", + " return str;", + "}", + "", + "friendly(['2015-07-01', '2015-07-04']);" + ], + "tests": [ + "assert.deepEqual(friendly(['2015-07-01', '2015-07-04']), ['July 1st','4th'], 'ending month should be omitted since it is already mentioned');", + "assert.deepEqual(friendly(['2015-12-01', '2016-02-03']), ['December 1st','February 3rd'], 'two months apart can be inferred if it is the next year');", + "assert.deepEqual(friendly(['2015-12-01', '2017-02-03']), ['December 1st, 2015','February 3rd, 2017']);", + "assert.deepEqual(friendly(['2016-03-01', '2016-05-05']), ['March 1st','May 5th'], 'one month apart can be inferred it is the same year');", + "assert.deepEqual(friendly(['2017-01-01', '2017-01-01']), ['January 1st, 2017'], 'since we do not duplicate only return once');", + "assert.deepEqual(friendly(['2022-09-05', '2023-09-04']), ['September 5th, 2022','September 4th, 2023']);" + ], + "MDNlinks": [ + "String.split()", + "String.substr()", + "parseInt()" ], "challengeType": 5, "nameCn": "", diff --git a/challenges/expert-bonfires.json b/challenges/expert-bonfires.json deleted file mode 100644 index 50bbe89de2..0000000000 --- a/challenges/expert-bonfires.json +++ /dev/null @@ -1,304 +0,0 @@ -{ - "name": "Expert Algorithm Scripting", - "order": 0.013, - "challenges": [ - { - "id": "aff0395860f5d3034dc0bfc9", - "name": "Bonfire: Validate US Telephone Numbers", - "dashedName": "bonfire-validate-us-telephone-numbers", - "difficulty": "4.01", - "description": [ - "Return true if the passed string is a valid US phone number", - "The user may fill out the form field any way they choose as long as it is a valid US number. The following are all valid formats for US numbers:", - "555-555-5555, (555)555-5555, (555) 555-5555, 555 555 5555, 5555555555, 1 555 555 5555", - "For this challenge you will be presented with a string such as \"800-692-7753\" or \"8oo-six427676;laskdjf\". Your job is to validate or reject the US phone number based on any combination of the formats provided above. The area code is required. If the country code is provided, you must confirm that the country code is \"1\". Return true if the string is a valid US phone number; otherwise false.", - "Remember to use RSAP if you get stuck. Try to pair program. Write your own code." - ], - "tests": [ - "expect(telephoneCheck(\"555-555-5555\")).to.be.a(\"boolean\");", - "assert.deepEqual(telephoneCheck(\"1 555-555-5555\"), true);", - "assert.deepEqual(telephoneCheck(\"1 (555) 555-5555\"), true);", - "assert.deepEqual(telephoneCheck(\"5555555555\"), true);", - "assert.deepEqual(telephoneCheck(\"555-555-5555\"), true);", - "assert.deepEqual(telephoneCheck(\"(555)555-5555\"), true);", - "assert.deepEqual(telephoneCheck(\"1(555)555-5555\"), true);", - "assert.deepEqual(telephoneCheck(\"1 555 555 5555\"), true);", - "assert.deepEqual(telephoneCheck(\"555-555-5555\"), true);", - "assert.deepEqual(telephoneCheck(\"1 456 789 4444\"), true);", - "assert.deepEqual(telephoneCheck(\"123**&!!asdf#\"), false);", - "assert.deepEqual(telephoneCheck(\"55555555\"), false);", - "assert.deepEqual(telephoneCheck(\"(6505552368)\"), false);", - "assert.deepEqual(telephoneCheck(\"2 (757) 622-7382\"), false);", - "assert.deepEqual(telephoneCheck(\"0 (757) 622-7382\"), false);", - "assert.deepEqual(telephoneCheck(\"-1 (757) 622-7382\"), false);", - "assert.deepEqual(telephoneCheck(\"2 757 622-7382\"), false);", - "assert.deepEqual(telephoneCheck(\"10 (757) 622-7382\"), false);", - "assert.deepEqual(telephoneCheck(\"27576227382\"), false);", - "assert.deepEqual(telephoneCheck(\"(275)76227382\"), false);", - "assert.deepEqual(telephoneCheck(\"2(757)6227382\"), false);", - "assert.deepEqual(telephoneCheck(\"2(757)622-7382\"), false);" - ], - "challengeSeed": [ - "function telephoneCheck(str) {", - " // Good luck!", - " return true;", - "}", - "", - "", - "", - "telephoneCheck(\"555-555-5555\");" - ], - "MDNlinks": [ - "RegExp" - ], - "challengeType": 5, - "nameCn": "", - "descriptionCn": [], - "nameFr": "", - "descriptionFr": [], - "nameRu": "", - "descriptionRu": [], - "nameEs": "", - "descriptionEs": [], - "namePt": "", - "descriptionPt": [] - }, - { - "id": "a3f503de51cf954ede28891d", - "name": "Bonfire: Symmetric Difference", - "dashedName": "bonfire-symmetric-difference", - "difficulty": "4.02", - "description": [ - "Create a function that takes two or more arrays and returns an array of the symmetric difference of the provided arrays.", - "The mathematical term symmetric difference refers to the elements in two sets that are in either the first or second set, but not in both.", - "Remember to use RSAP if you get stuck. Try to pair program. Write your own code." - ], - "challengeSeed": [ - "function sym(args) {", - " return arguments;", - "}", - "", - "sym([1, 2, 3], [5, 2, 1, 4]);" - ], - "tests": [ - "expect(sym([1, 2, 3], [5, 2, 1, 4])).to.equal([3, 5, 4]);", - "assert.deepEqual(sym([1, 2, 5], [2, 3, 5], [3, 4, 5]), [1, 4, 5], 'should return the symmetric difference of the given arrays');", - "assert.deepEqual(sym([1, 1, 2, 5], [2, 2, 3, 5], [3, 4, 5, 5]), [1, 4, 5], 'should return an array of unique values');", - "assert.deepEqual(sym([1, 1]), [1], 'should return an array of unique values');" - ], - "MDNlinks": [ - "Array.reduce()", - "Symmetric Difference" - ], - "challengeType": 5, - "nameCn": "", - "descriptionCn": [], - "nameFr": "", - "descriptionFr": [], - "nameRu": "", - "descriptionRu": [], - "nameEs": "", - "descriptionEs": [], - "namePt": "", - "descriptionPt": [] - }, - { - "id": "aa2e6f85cab2ab736c9a9b24", - "name": "Bonfire: Exact Change", - "dashedName": "bonfire-exact-change", - "difficulty": "4.03", - "description": [ - "Design a cash register drawer function that accepts purchase price as the first argument, payment as the second argument, and cash-in-drawer (cid) as the third argument.", - "cid is a 2d array listing available currency.", - "Return the string \"Insufficient Funds\" if cash-in-drawer is less than the change due. Return the string \"Closed\" if cash-in-drawer is equal to the change due.", - "Otherwise, return change in coin and bills, sorted in highest to lowest order.", - "Remember to use RSAP if you get stuck. Try to pair program. Write your own code." - ], - "challengeSeed": [ - "function drawer(price, cash, cid) {", - " var change;", - " // Here is your change, ma'am.", - " return change;", - "}", - "", - "// Example cash-in-drawer array:", - "// [['PENNY', 1.01],", - "// ['NICKEL', 2.05],", - "// ['DIME', 3.10],", - "// ['QUARTER', 4.25],", - "// ['ONE', 90.00],", - "// ['FIVE', 55.00],", - "// ['TEN', 20.00],", - "// ['TWENTY', 60.00],", - "// ['ONE HUNDRED', 100.00]]", - "", - "drawer(19.50, 20.00, [['PENNY', 1.01], ['NICKEL', 2.05], ['DIME', 3.10], ['QUARTER', 4.25], ['ONE', 90.00], ['FIVE', 55.00], ['TEN', 20.00], ['TWENTY', 60.00], ['ONE HUNDRED', 100.00]]);" - ], - "tests": [ - "expect(drawer(19.50, 20.00, [['PENNY', 1.01], ['NICKEL', 2.05], ['DIME', 3.10], ['QUARTER', 4.25], ['ONE', 90.00], ['FIVE', 55.00], ['TEN', 20.00], ['TWENTY', 60.00], ['ONE HUNDRED', 100.00]])).to.be.a('array');", - "expect(drawer(19.50, 20.00, [['PENNY', 0.01], ['NICKEL', 0], ['DIME', 0], ['QUARTER', 0], ['ONE', 0], ['FIVE', 0], ['TEN', 0], ['TWENTY', 0], ['ONE HUNDRED', 0]])).to.be.a('string');", - "expect(drawer(19.50, 20.00, [['PENNY', 0.50], ['NICKEL', 0], ['DIME', 0], ['QUARTER', 0], ['ONE', 0], ['FIVE', 0], ['TEN', 0], ['TWENTY', 0], ['ONE HUNDRED', 0]])).to.be.a('string');", - "assert.deepEqual(drawer(19.50, 20.00, [['PENNY', 1.01], ['NICKEL', 2.05], ['DIME', 3.10], ['QUARTER', 4.25], ['ONE', 90.00], ['FIVE', 55.00], ['TEN', 20.00], ['TWENTY', 60.00], ['ONE HUNDRED', 100.00]]), [['QUARTER', 0.50]], 'return correct change');", - "assert.deepEqual(drawer(3.26, 100.00, [['PENNY', 1.01], ['NICKEL', 2.05], ['DIME', 3.10], ['QUARTER', 4.25], ['ONE', 90.00], ['FIVE', 55.00], ['TEN', 20.00], ['TWENTY', 60.00], ['ONE HUNDRED', 100.00]]), [['TWENTY', 60.00], ['TEN', 20.00], ['FIVE', 15], ['ONE', 1], ['QUARTER', 0.50], ['DIME', 0.20], ['PENNY', 0.04] ], 'return correct change with multiple coins and bills');", - "assert.deepEqual(drawer(19.50, 20.00, [['PENNY', 0.01], ['NICKEL', 0], ['DIME', 0], ['QUARTER', 0], ['ONE', 0], ['FIVE', 0], ['TEN', 0], ['TWENTY', 0], ['ONE HUNDRED', 0]]), 'Insufficient Funds', 'insufficient funds');", - "assert.deepEqual(drawer(19.50, 20.00, [['PENNY', 0.50], ['NICKEL', 0], ['DIME', 0], ['QUARTER', 0], ['ONE', 0], ['FIVE', 0], ['TEN', 0], ['TWENTY', 0], ['ONE HUNDRED', 0]]), \"Closed\", 'cash-in-drawer equals change');" - ], - "MDNlinks": [ - "Global Object" - ], - "challengeType": 5, - "nameCn": "", - "descriptionCn": [], - "nameFr": "", - "descriptionFr": [], - "nameRu": "", - "descriptionRu": [], - "nameEs": "", - "descriptionEs": [], - "namePt": "", - "descriptionPt": [] - }, - { - "id": "a56138aff60341a09ed6c480", - "name": "Bonfire: Inventory Update", - "dashedName": "bonfire-inventory-update", - "difficulty": "4.04", - "description": [ - "Compare and update inventory stored in a 2d array against a second 2d array of a fresh delivery. Update current inventory item quantity, and if an item cannot be found, add the new item and quantity into the inventory array in alphabetical order.", - "Remember to use RSAP if you get stuck. Try to pair program. Write your own code." - ], - "challengeSeed": [ - "function inventory(arr1, arr2) {", - " // All inventory must be accounted for or you're fired!", - " return arr1;", - "}", - "", - "// Example inventory lists", - "var curInv = [", - " [21, 'Bowling Ball'],", - " [2, 'Dirty Sock'],", - " [1, 'Hair Pin'],", - " [5, 'Microphone']", - "];", - "", - "var newInv = [", - " [2, 'Hair Pin'],", - " [3, 'Half-Eaten Apple'],", - " [67, 'Bowling Ball'],", - " [7, 'Toothpaste']", - "];", - "", - "inventory(curInv, newInv);" - ], - "tests": [ - "expect(inventory([[21, 'Bowling Ball'], [2, 'Dirty Sock'], [1, 'Hair Pin'], [5, 'Microphone']], [[2, 'Hair Pin'], [3, 'Half-Eaten Apple'], [67, 'Bowling Ball'], [7, 'Toothpaste']])).to.be.a('array');", - "assert.equal(inventory([[21, 'Bowling Ball'], [2, 'Dirty Sock'], [1, 'Hair Pin'], [5, 'Microphone']], [[2, 'Hair Pin'], [3, 'Half-Eaten Apple'], [67, 'Bowling Ball'], [7, 'Toothpaste']]).length, 6);", - "assert.deepEqual(inventory([[21, 'Bowling Ball'], [2, 'Dirty Sock'], [1, 'Hair Pin'], [5, 'Microphone']], [[2, 'Hair Pin'], [3, 'Half-Eaten Apple'], [67, 'Bowling Ball'], [7, 'Toothpaste']]), [[88, 'Bowling Ball'], [2, 'Dirty Sock'], [3, 'Hair Pin'], [3, 'Half-Eaten Apple'], [5, 'Microphone'], [7, 'Toothpaste']]);", - "assert.deepEqual(inventory([[21, 'Bowling Ball'], [2, 'Dirty Sock'], [1, 'Hair Pin'], [5, 'Microphone']], []), [[21, 'Bowling Ball'], [2, 'Dirty Sock'], [1, 'Hair Pin'], [5, 'Microphone']]);", - "assert.deepEqual(inventory([], [[2, 'Hair Pin'], [3, 'Half-Eaten Apple'], [67, 'Bowling Ball'], [7, 'Toothpaste']]), [[67, 'Bowling Ball'], [2, 'Hair Pin'], [3, 'Half-Eaten Apple'], [7, 'Toothpaste']]);", - "assert.deepEqual(inventory([[0, 'Bowling Ball'], [0, 'Dirty Sock'], [0, 'Hair Pin'], [0, 'Microphone']], [[1, 'Hair Pin'], [1, 'Half-Eaten Apple'], [1, 'Bowling Ball'], [1, 'Toothpaste']]), [[1, 'Bowling Ball'], [0, 'Dirty Sock'], [1, 'Hair Pin'], [1, 'Half-Eaten Apple'], [0, 'Microphone'], [1, 'Toothpaste']]);" - ], - "MDNlinks": [ - "Global Array Object" - ], - "challengeType": 5, - "nameCn": "", - "descriptionCn": [], - "nameFr": "", - "descriptionFr": [], - "nameRu": "", - "descriptionRu": [], - "nameEs": "", - "descriptionEs": [], - "namePt": "", - "descriptionPt": [] - }, - { - "id": "a7bf700cd123b9a54eef01d5", - "name": "Bonfire: No repeats please", - "dashedName": "bonfire-no-repeats-please", - "difficulty": "4.05", - "description": [ - "Return the number of total permutations of the provided string that don't have repeated consecutive letters.", - "For example, 'aab' should return 2 because it has 6 total permutations, but only 2 of them don't have the same letter (in this case 'a') repeating.", - "Remember to use RSAP if you get stuck. Try to pair program. Write your own code." - ], - "challengeSeed": [ - "function permAlone(str) {", - " return str;", - "}", - "", - "permAlone('aab');" - ], - "tests": [ - "expect(permAlone('aab')).to.be.a('number');", - "expect(permAlone('aab')).to.equal(2);", - "expect(permAlone('aaa')).to.equal(0);", - "expect(permAlone('aabb')).to.equal(8);", - "expect(permAlone('abcdefa')).to.equal(3600);", - "expect(permAlone('abfdefa')).to.equal(2640);", - "expect(permAlone('zzzzzzzz')).to.equal(0);" - ], - "MDNlinks": [ - "Permutations", - "RegExp" - ], - "challengeType": 5, - "nameCn": "", - "descriptionCn": [], - "nameFr": "", - "descriptionFr": [], - "nameRu": "", - "descriptionRu": [], - "nameEs": "", - "descriptionEs": [], - "namePt": "", - "descriptionPt": [] - }, - { - "id": "a19f0fbe1872186acd434d5a", - "name": "Bonfire: Friendly Date Ranges", - "dashedName": "bonfire-friendly-date-ranges", - "difficulty": "4.06", - "description": [ - "Implement a way of converting two dates into a more friendly date range that could be presented to a user.", - "It must not show any redundant information in the date range.", - "For example, if the year and month are the same then only the day range should be displayed.", - "Secondly, if the starting year is the current year, and the ending year can be inferred by the reader, the year should be omitted.", - "Input date is formatted as YYYY-MM-DD", - "Remember to use RSAP if you get stuck. Try to pair program. Write your own code." - ], - "challengeSeed": [ - "function friendly(str) {", - " return str;", - "}", - "", - "friendly(['2015-07-01', '2015-07-04']);" - ], - "tests": [ - "assert.deepEqual(friendly(['2015-07-01', '2015-07-04']), ['July 1st','4th'], 'ending month should be omitted since it is already mentioned');", - "assert.deepEqual(friendly(['2015-12-01', '2016-02-03']), ['December 1st','February 3rd'], 'two months apart can be inferred if it is the next year');", - "assert.deepEqual(friendly(['2015-12-01', '2017-02-03']), ['December 1st, 2015','February 3rd, 2017']);", - "assert.deepEqual(friendly(['2016-03-01', '2016-05-05']), ['March 1st','May 5th'], 'one month apart can be inferred it is the same year');", - "assert.deepEqual(friendly(['2017-01-01', '2017-01-01']), ['January 1st, 2017'], 'since we do not duplicate only return once');", - "assert.deepEqual(friendly(['2022-09-05', '2023-09-04']), ['September 5th, 2022','September 4th, 2023']);" - ], - "MDNlinks": [ - "String.split()", - "String.substr()", - "parseInt()" - ], - "challengeType": 5, - "nameCn": "", - "descriptionCn": [], - "nameFr": "", - "descriptionFr": [], - "nameRu": "", - "descriptionRu": [], - "nameEs": "", - "descriptionEs": [], - "namePt": "", - "descriptionPt": [] - } - ] -} diff --git a/challenges/object-oriented-and-functional-programming.json b/challenges/object-oriented-and-functional-programming.json index 93c85cb4ee..54b46060a3 100644 --- a/challenges/object-oriented-and-functional-programming.json +++ b/challenges/object-oriented-and-functional-programming.json @@ -1,119 +1,6 @@ { - "name": "Object Oriented and Functional Programming - Under Construction From Challenge 4 Onwards", - "order" : 0.009, + "name": "Object Oriented and Functional Programming - Coming Soon", + "order" : 0.010, "challenges": [ - { - "id": "bd7153d8c44eeddfaeb5bd0f", - "name": "Waypoint: Learn Scope Chains and Closures", - "dashedName": "waypoint-learn-scope-chains-and-closures", - "difficulty": 0.01, - "challengeSeed": ["133316031"], - "description": [ - "We'll build this Waypoint on Cloud 9, a powerful online code editor with a full Ubuntu Linux workspace, all running in the cloud.", - "If you don't already have Cloud 9 account, create one now at http://c9.io.", - "Open up http://c9.io and sign in to your account.", - "Click on Create New Workspace at the top right of the c9.io page, then click on the \"Create a new workspace\" popup that appears below it the button after you click on it.", - "Give your workspace a name.", - "Choose Node.js in the selection area below the name field.", - "Click the Create button. Then click into your new workspace.", - "In the lower right hand corner you should see a terminal window. In this window use the following commands. You don't need to know what these mean at this point.", - "Install scope-chains-closures with this command: npm install -g scope-chains-closures", - "Now start the tutorial by running scope-chains-closures.", - "Note that you can resize the c9.io's windows by dragging their borders.", - "Make sure that you are always in your project's \"workspace\" directory. You can always navigate back to this directory by running this command: cd ~/workspace.", - "You can view this Node School module's source code on GitHub at https://github.com/jesstelford/scope-chains-closures.", - "Complete \"Scopes\"", - "Complete \"Scope Chains\"", - "Complete \"Global Scope and Shadowing\"", - "Complete \"Closures\"", - "Complete \"Garbage Collection\"", - "Once you've completed these steps, move on to our next challenge." - ], - "challengeType": 2, - "tests": [], - "nameCn": "", - "descriptionCn": [], - "nameFr": "", - "descriptionFr": [], - "nameRu": "", - "descriptionRu": [], - "nameEs": "", - "descriptionEs": [], - "namePt": "", - "descriptionPt": [] - }, - { - "id": "bd7153d8b44eeddfaeb5bd0f", - "name": "Waypoint: Use Prototypes for Inheriting Properties", - "dashedName": "waypoint-use-prototypes-for-inheriting-properties", - "difficulty": 0.02, - "challengeSeed": ["133316036"], - "description": [ - "We'll build this Waypoint on Cloud 9, a powerful online code editor with a full Ubuntu Linux workspace, all running in the cloud.", - "If you don't already have Cloud 9 account, create one now at http://c9.io.", - "Open up http://c9.io and sign in to your account.", - "Click on Create New Workspace at the top right of the c9.io page, then click on the \"Create a new workspace\" popup that appears below it the button after you click on it.", - "Give your workspace a name.", - "Choose Node.js in the selection area below the name field.", - "Click the Create button. Then click into your new workspace.", - "In the lower right hand corner you should see a terminal window. In this window use the following commands. You don't need to know what these mean at this point.", - "Install planetproto with this command: npm install -g planetproto", - "Now start the tutorial by running planetproto.", - "Note that you can resize the c9.io's windows by dragging their borders.", - "Make sure that you are always in your project's \"workspace\" directory. You can always navigate back to this directory by running this command: cd ~/workspace.", - "You can view this Node School module's source code on GitHub at https://github.com/sporto/planetproto.", - "Complete \"Simple Objects\"", - "Complete \"Proto\"", - "Complete \"Dynamic Lookups\"", - "Complete \"Property Assignments\"", - "Complete \"Arrays and Objects\"", - "Complete \"Object Create\"", - "Complete \"Dot New\"", - "Complete \"Constructor Functions\"", - "Complete \"Implicit This\"", - "Note that you can skip the last challenge.", - "Once you've completed these steps, move on to our next challenge." - ], - "challengeType": 2, - "tests": [], - "nameCn": "", - "descriptionCn": [], - "nameFr": "", - "descriptionFr": [], - "nameRu": "", - "descriptionRu": [], - "nameEs": "", - "descriptionEs": [], - "namePt": "", - "descriptionPt": [] - }, - { - "id": "bd7129d8c441eddfbeb5bddf", - "name": "Waypoint: Practice Functional Programming", - "dashedName": "waypoint-practice-functional-programming", - "difficulty": 0.01, - "challengeSeed": ["129169463"], - "description": [ - "Functional programming holds the key to unlocking JavaScript's powerful asynchronous features.", - "Jafar Husain's interactive Functional Programming course will familiarize you with the various ways you can recombine these functions.", - "Functional programming in JavaScript involves using five key functions: \"map\", \"reduce\", \"filter\", \"concatAll\", and \"zip\".", - "Click here to go to the challenge: http://jhusain.github.io/learnrx/.", - "You only need to complete the first 27 steps of this tutorial.", - "This challenge will take several hours, but don't worry. Jafar's website will save your progress (using your browser's local storage) so you don't need to finish it in one sitting.", - "If you've spent several minutes on one of these challenges, and still can't figure out its correct answer, you can click \"show answer\", then click \"run\" to advance to the next challenge. Be sure to read the correct answer and make sure you understand it before moving on." - ], - "challengeType": 2, - "tests": [], - "nameCn": "", - "descriptionCn": [], - "nameFr": "", - "descriptionFr": [], - "nameRu": "", - "descriptionRu": [], - "nameEs": "", - "descriptionEs": [], - "namePt": "", - "descriptionPt": [] - } ] } diff --git a/challenges/upper-intermediate-bonfires.json b/challenges/upper-intermediate-bonfires.json new file mode 100644 index 0000000000..bfd765facb --- /dev/null +++ b/challenges/upper-intermediate-bonfires.json @@ -0,0 +1,139 @@ +{ + "name": "Upper Intermediate Algorithm Scripting", + "order": 0.011, + "challenges": [ + { + "id": "a2f1d72d9b908d0bd72bb9f6", + "name": "Bonfire: Make a Person", + "dashedName": "bonfire-make-a-person", + "difficulty": "3.01", + "description": [ + "Fill in the object constructor with the methods specified in the tests.", + "Those methods are getFirstName(), getLastName(), getFullName(), setFirstName(first), setLastName(last), and setFullName(firstAndLast).", + "All functions that take an argument have an arity of 1, and the argument will be a string.", + "These methods must be the only available means for interacting with the object.", + "Remember to use RSAP if you get stuck. Try to pair program. Write your own code." + ], + "challengeSeed": [ + "var Person = function(firstAndLast) {", + " return firstAndLast;", + "};", + "", + "var bob = new Person('Bob Ross');", + "bob.getFullName();" + ], + "tests": [ + "expect(Object.keys(bob).length).to.eql(6);", + "expect(bob instanceof Person).to.be.true;", + "expect(bob.firstName).to.be.undefined();", + "expect(bob.lastName).to.be.undefined();", + "expect(bob.getFirstName()).to.eql('Bob');", + "expect(bob.getLastName()).to.eql('Ross');", + "expect(bob.getFullName()).to.eql('Bob Ross');", + "bob.setFirstName('Happy');", + "expect(bob.getFirstName()).to.eql('Happy');", + "bob.setLastName('Trees');", + "expect(bob.getLastName()).to.eql('Trees');", + "bob.setFullName('George Carlin');", + "expect(bob.getFullName()).to.eql('George Carlin');", + "bob.setFullName('Bob Ross');" + ], + "MDNlinks": [ + "Closures", + "Details of the Object Model" + ], + "challengeType": 5, + "nameCn": "", + "descriptionCn": [], + "nameFr": "", + "descriptionFr": [], + "nameRu": "", + "descriptionRu": [], + "nameEs": "", + "descriptionEs": [], + "namePt": "", + "descriptionPt": [] + }, + { + "id": "af4afb223120f7348cdfc9fd", + "name": "Bonfire: Map the Debris", + "dashedName": "bonfire-map-the-debris", + "difficulty": "3.02", + "description": [ + "Return a new array that transforms the element's average altitude into their orbital periods.", + "The array will contain objects in the format {name: 'name', avgAlt: avgAlt}.", + "You can read about orbital periods on wikipedia.", + "The values should be rounded to the nearest whole number. The body being orbited is Earth.", + "The radius of the earth is 6367.4447 kilometers, and the GM value of earth is 398600.4418", + "Remember to use RSAP if you get stuck. Try to pair program. Write your own code." + ], + "challengeSeed": [ + "function orbitalPeriod(arr) {", + " var GM = 398600.4418;", + " var earthRadius = 6367.4447;", + " return arr;", + "}", + "", + "orbitalPeriod([{name : \"sputnik\", avgAlt : 35873.5553}]);" + ], + "tests": [ + "expect(orbitalPeriod([{name : \"sputnik\", avgAlt : 35873.5553}])).to.eqls([{name: \"sputnik\", orbitalPeriod: 86400}]);", + "expect(orbitalPeriod([{name: \"iss\", avgAlt: 413.6}, {name: \"hubble\", avgAlt: 556.7}, {name: \"moon\", avgAlt: 378632.553}])).to.eqls([{name : \"iss\", orbitalPeriod: 5557}, {name: \"hubble\", orbitalPeriod: 5734}, {name: \"moon\", orbitalPeriod: 2377399}]);" + ], + "MDNlinks": [ + "Math.pow()" + ], + "challengeType": 5, + "nameCn": "", + "descriptionCn": [], + "nameFr": "", + "descriptionFr": [], + "nameRu": "", + "descriptionRu": [], + "nameEs": "", + "descriptionEs": [], + "namePt": "", + "descriptionPt": [] + }, + { + "id": "a3f503de51cfab748ff001aa", + "name": "Bonfire: Pairwise", + "dashedName": "bonfire-pairwise", + "difficulty": "3.03", + "description": [ + "Return the sum of all indices of elements of 'arr' that can be paired with one other element to form a sum that equals the value in the second argument 'arg'. If multiple sums are possible, return the smallest sum. Once an element has been used, it cannot be reused to pair with another.", + "For example, pairwise([1, 4, 2, 3, 0, 5], 7) should return 11 because 4, 2, 3 and 5 can be paired with each other to equal 7.", + "pairwise([1, 3, 2, 4], 4) would only equal 1, because only the first two elements can be paired to equal 4, and the first element has an index of 0!", + "Remember to use RSAP if you get stuck. Try to pair program. Write your own code." + ], + "challengeSeed": [ + "function pairwise(arr, arg) {", + " return arg;", + "}", + "", + "pairwise([1,4,2,3,0,5], 7);" + ], + "tests": [ + "expect(pairwise([1, 4, 2, 3, 0, 5], 7)).to.equal(11);", + "expect(pairwise([1, 3, 2, 4], 4)).to.equal(1);", + "expect(pairwise([1,1,1], 2)).to.equal(1);", + "expect(pairwise([0, 0, 0, 0, 1, 1], 1)).to.equal(10);", + "expect(pairwise([], 100)).to.equal(0);" + ], + "MDNlinks": [ + "Array.reduce()" + ], + "challengeType": 5, + "nameCn": "", + "descriptionCn": [], + "nameFr": "", + "descriptionFr": [], + "nameRu": "", + "descriptionRu": [], + "nameEs": "", + "descriptionEs": [], + "namePt": "", + "descriptionPt": [] + } + ] +}