diff --git a/challenges/basic-javascript.json b/challenges/basic-javascript.json index 8696a13b94..15b2df6a43 100644 --- a/challenges/basic-javascript.json +++ b/challenges/basic-javascript.json @@ -1544,6 +1544,176 @@ ], "type": "waypoint", "challengeType": 0 + }, + { + "id":"cf1111c1c11feddfaeb1bdff", + "title": "Give your JavaScript Slot Machine some stylish images", + "difficulty":"9.9901", + "description":[ + "Now that we can detect when the player wins we are going to add an image to each slot depending on the random values we generate", + "$($('.slot')[0]).html('<img src = \"' + images[slotOne-1] + '\">');" + ], + "tests":[ + "assert(editor.match(/\\$\\(\\$\\(\\'\\.slot\\'\\)\\[\\d\\]\\)\\.html\\(\\'\\\\'\\);/gi) && editor.match(/\\$\\(\\$\\(\\'\\.slot\\'\\)\\[\\d\\]\\)\\.html\\(\\'\\\\'\\);/gi).length >= 3, 'Use the provided code three times. One for each slot');", + "assert(editor.match(/slotOne/gi) && editor.match(/slotOne/gi).length >= 7, 'You should have used the slotOne value at least once');", + "assert(editor.match(/slotTwo/gi) && editor.match(/slotTwo/gi).length >=8, 'You should have used the slotTwo value at least once');", + "assert(editor.match(/slotThree/gi) && editor.match(/slotThree/gi).length >= 7, 'You should have used the slotThree value at least once');" + ], + "challengeSeed":[ + "fccss", + " function runSlots(){", + " var slotOne;", + " var slotTwo;", + " var slotThree;", + " ", + " //Placeholder", + " var images = ['https://www.evernote.com/l/AlxaOC8QrXlBjpTdGMe3mBwLN3Yjm-KB5yQB/image.png','https://www.evernote.com/l/AlyXbeIS8axEspbwXD8RzmsaCUIf10snmzgB/image.png','https://www.evernote.com/l/AlxMveeWtopKaajUmTVrnv92mqA_s2uzW-8B/image.png','https://www.evernote.com/l/AlyyRP_Kh_dCG7t8b4JRnwMNCa1JThI_5gQB/image.png', 'https://www.evernote.com/l/Alx64952qUxEhJnBteZvJgxib1qlwQcw9G0B/image.png'];", + " ", + " slotOne = Math.floor(Math.random() * (5 - 1 + 1)) + 1;", + " slotTwo = Math.floor(Math.random() * (5 - 1 + 1)) + 1;", + " slotThree = Math.floor(Math.random() * (5 - 1 + 1)) + 1;", + " ", + " $('.logger').html('');", + " $('.logger').html('Not A Win')", + " ", + " /*Don't modify above here*/", + " ", + " ", + " ", + " /*Don't modify below here*/", + " ", + " if(slotOne != slotTwo || slotTwo != slotThree){", + " return(null);", + " }", + " ", + " if(slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined){", + " $('.logger').html(slotOne);", + " $('.logger').append(' ' + slotTwo);", + " $('.logger').append(' ' + slotThree);", + " }", + " ", + " return([slotOne, slotTwo, slotThree]);", + " }", + "", + " $(document).ready(function(){", + " $('.go').click(function(){", + " runSlots();", + " });", + " });", + "fcces", + " ", + "
", + "
", + "
", + " ", + "

FCC Slot Machine

", + "
", + "
", + "
", + " ", + "
", + "
", + " ", + "
", + "
", + " ", + "
", + "
", + "
", + "
", + " ", + "
", + "
", + "
", + " ", + "
", + "
", + "
", + "", + "" + ], + "type": "waypoint", + "challengeType": 0 } ] } diff --git a/challenges/object-oriented-and-functional-programming.json b/challenges/object-oriented-and-functional-programming.json index eba3c45b57..ac85a3d5ac 100644 --- a/challenges/object-oriented-and-functional-programming.json +++ b/challenges/object-oriented-and-functional-programming.json @@ -2,7 +2,12 @@ "name": "Object Oriented and Functional Programming \n - \n Under Construction From Challenge 4 Onwards", "order" : 0.009, "note": [ - "inheritance" + "Waypoint: Closures", + "Waypoint: Factories", + "Waypoint: Pure Functions", + "Waypoint: Currying Functions", + "Waypoint: Functors", + "Waypoint: Currying Functions" ], "challenges": [ { @@ -74,9 +79,9 @@ "We can also create variables and functions that aren't accessible from outside the Object" ], "tests":[ - "assert(answers.Q1===true, 'The number Gear is Publicly Accessible');", - "assert(answers.Q2===true, 'The function getGear is Publicly Accessible');", - "assert(answers.Q3===false, 'The function addStyle is not Publicly Accessible');" + "assert(typeof(myBike.getSpeed)!=='undefined' && typeof(myBike.getSpeed) === 'function', 'The method getSpeed of myBike should be accessible outside the Object');", + "assert(typeof(myBike.speed) === 'undefined', 'We should not been able');", + "assert(typeof(myBike.addUnit === 'undefined'), '');" ], "challengeSeed":[ "//Let's create an object with a two functions. One attached as a property and one not.", @@ -90,33 +95,30 @@ " };", "};", "", - "//Quick Quiz!", - "//Say whether the follow statements are true or false in the answers object below", + "//Make the function getSpeed of Bike publicly accessible", "", - "//Statement One", - "//The number gear publicly accessible", - "", - "//Statement Two", - "//The function getGear publicly accessible", - "", - "//Statement Three", - "//The function addStyle publicly accessible", - "", - "var answers = {", - " 'Q1':false,", - " 'Q2':false,", - " 'Q3':false", + "var Bike = function(){", + " speed = 100;", + " function addUnit(value){", + " return(value + \"KM/H\");", + " }", + " ", + " getSpeed = function (){", + " return(addUnit(speed));", + " };", + " ", "};", "", "//Instantiated Here", "var myCar = new Car();", + "var myBike = new Bike();", "", - "(function(){return(JSON.stringify(answers));})();" + "if(myBike.hasOwnProperty('getSpeed')){(function(){return(JSON.stringify(myBike.getSpeed()));})();};" ], "challengeType":1 }, { - "id":"cf1111c1c13feddfaeb6bdef", + "id":"cf1111c1c15feddfaeb4bdef", "title":"Waypoint: Instantiation", "difficulty":0, "description":[ @@ -144,7 +146,7 @@ "challengeType":1 }, { - "id":"cf1111c1c13feddfaeb9bdef", + "id":"cf1111c1c15feddfaeb5bdef", "title":"Waypoint: Inheritance", "difficulty":0, "description":[ @@ -159,7 +161,7 @@ "challengeType":1 }, { - "id":"cf1111c1c14feddfaeb1bdef", + "id":"cf1111c1c15feddfaeb6bdef", "title":"Waypoint: Prototypical Inheritance", "difficulty":0, "description":[ @@ -174,8 +176,8 @@ "challengeType":1 }, { - "id":"cf1111c1c13feddfaeb7bdef", - "title":"Waypoint: Closures", + "id":"cf1111c1c15feddfaeb7bdef", + "title":"Waypoint: Using .map", "difficulty":0, "description":[ "" @@ -189,8 +191,8 @@ "challengeType":1 }, { - "id":"cf1111c1c14feddfaeb3bdef", - "title":"Waypoint: Factories", + "id":"cf1111c1c15feddfaeb8bdef", + "title":"Waypoint: Using .reduce", "difficulty":0, "description":[ "" @@ -204,9 +206,8 @@ "challengeType":1 }, { - "id":"cf1111c1c14feddfaeb5bdef", - "title":"Waypoint: Pure Functions", - "Note":"May need a waypoint before each topic to announce what it is :p", + "id":"cf1111c1c15feddfaeb9bdef", + "title":"Waypoint: Using .filter", "difficulty":0, "description":[ "" @@ -220,8 +221,8 @@ "challengeType":1 }, { - "id":"cf1111c1c14feddfaeb6bdef", - "title":"Waypoint: Currying Functions", + "id":"cf1111c1c16feddfaeb1bdef", + "title":"Waypoint: Using .sort", "difficulty":0, "description":[ "" @@ -235,53 +236,34 @@ "challengeType":1 }, { - "id":"cf1111c1c14feddfaeb7bdef", - "title":"Waypoint: Composition", - "difficulty":0, - "description":[ + "id": "cf1111c1c16feddfaeb2bdef", + "title": "Waypoint: Using .reverse", + "difficulty": 0, + "description": [ "" ], - "tests":[ + "tests": [ "assert(1==2, '');" ], - "challengeSeed":[ + "challengeSeed": [ "Under Construction" ], - "challengeType":1 + "challengeType": 1 }, { - "id":"cf1111c1c14feddfaeb8bdef", - "title":"Waypoint: Functors", - "difficulty":0, - "description":[ + "id": "cf1111c1c16feddfaeb3bdef", + "title": "Waypoint: Using .concat", + "difficulty": 0, + "description": [ "" ], - "tests":[ + "tests": [ "assert(1==2, '');" ], - "challengeSeed":[ + "challengeSeed": [ "Under Construction" ], - "challengeType":1 - }, - { - "id":"cf1111c1c14feddfaeb9bdef", - "title":"Waypoint: Currying Functions", - "Notes":[ - "", - "" - ], - "difficulty":0, - "description":[ - "" - ], - "tests":[ - "assert(1==2, '');" - ], - "challengeSeed":[ - "Under Construction" - ], - "challengeType":1 + "challengeType": 1 } ] }