Merge branch 'staging' of github.com:FreeCodeCamp/freecodecamp into staging

This commit is contained in:
Quincy Larson
2015-08-01 08:26:07 -07:00

View File

@ -1042,7 +1042,7 @@
"id":"cf1111c1c12feddfaeb8bdef", "id":"cf1111c1c12feddfaeb8bdef",
"name":"Finding WhiteSpace", "name":"Finding WhiteSpace",
"dashedName":"waypoint-finding-whitespace", "dashedName":"waypoint-finding-whitespace",
"difficulty":"9.987", "difficulty":"9.986",
"description":[ "description":[
"", "",
"We can also use selectors like <code>\\s</code> to find spaces in a string", "We can also use selectors like <code>\\s</code> to find spaces in a string",
@ -1073,20 +1073,20 @@
"id":"cf1111c1c12feddfaeb9bdef", "id":"cf1111c1c12feddfaeb9bdef",
"name":"Creating a slots machine", "name":"Creating a slots machine",
"dashedName":"creating-a-slots-machine", "dashedName":"creating-a-slots-machine",
"difficulty":"9.987", "difficulty":"9.988",
"description":[ "description":[
"", "",
"We are now going to try and combine some of the stuff we've just learnt abd create the logic for a slot machine game", "We are now going to try and combine some of the stuff we've just learnt abd create the logic for a slot machine game",
"For this we will need to generate three random numbers between <code>1</code> and <code>5</code> to represent the possible values of each individual slot", "For this we will need to generate three random numbers between <code>1</code> and <code>5</code> to represent the possible values of each individual slot",
"Store the three random numbers in <code>slotOne</code>, <code>slotTwo</code> and <code>slotThree</code>", "Store the three random numbers in <code>slotOne</code>, <code>slotTwo</code> and <code>slotThree</code>",
"Generate the random numbers by using the system we used earlier in /challenges/random-whole-numbers-in-a-range", "Generate the random numbers by using the system we used earlier in /challenges/random-whole-numbers-in-a-range",
"<code> Math.floor(Math.random() * (5 - 1 + 1)) + 1; </code>" "<code> Math.floor(Math.random() * (5 - 1 + 1)) + 1; </code>."
], ],
"tests":[ "tests":[
"assert(typeof(runSlots($('.slot'))[0]) == 'number', 'SlotOne should be a random number');", "assert(typeof(runSlots($('.slot'))[0]) == 'number', 'SlotOne should be a random number');",
"assert(typeof(runSlots($('.slot'))[1]) == 'number', 'SlotTwo should be a random number');", "assert(typeof(runSlots($('.slot'))[1]) == 'number', 'SlotTwo should be a random number');",
"assert(typeof(runSlots($('.slot'))[2]) == 'number', 'SlotThree should be a random number');", "assert(typeof(runSlots($('.slot'))[2]) == 'number', 'SlotThree should be a random number');",
"assert(editorValue.match(/Math.floor\\(Math.random\\(\\) \\* \\(5 \\- 1 \\+ 1\\)\\) \\+ 1/g).length === 3);" "assert((function(){if(editor.match(/Math.floor\\(Math\\.random\\(\\)\\s\\*\\s\\(5\\s\\-\\s1\\s\\+\\s1\\)\\)\\s\\+\\s1;/gi) !== null){return(editor.match(/Math.floor\\(Math\\.random\\(\\)\\s\\*\\s\\(5\\s\\-\\s1\\s\\+\\s1\\)\\)\\s\\+\\s1;/gi).length >= 3);}else{return(false);}})(), 'You should have used Math.floor(Math.random() * (5 - 1 + 1)) + 1; three times to generate your random numbers');"
], ],
"challengeSeed":[ "challengeSeed":[
"fccss", "fccss",
@ -1103,6 +1103,9 @@
" ", " ",
" /*Don't modify below here*/", " /*Don't modify below here*/",
" ", " ",
" $('.logger').html('');",
" $('.logger').html('Not A Win')",
" ",
" if(slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined){", " if(slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined){",
" $('.logger').html(slotOne + ' ' + slotTwo + ' ' + slotThree);", " $('.logger').html(slotOne + ' ' + slotTwo + ' ' + slotThree);",
" }", " }",
@ -1119,6 +1122,7 @@
"<div>", "<div>",
" <div class = 'container inset'>", " <div class = 'container inset'>",
" <div class = 'header inset'>", " <div class = 'header inset'>",
" <img src='https://s3.amazonaws.com/freecodecamp/freecodecamp_logo.svg.gz' alt='learn to code javascript at Free Code Camp logo' class='img-responsive nav-logo'>",
" <h2>FCC Slot Machine</h2>", " <h2>FCC Slot Machine</h2>",
" </div>", " </div>",
" <div class = 'slots inset'>", " <div class = 'slots inset'>",
@ -1145,54 +1149,59 @@
" </div>", " </div>",
"</div>", "</div>",
"", "",
"<link href='http://fonts.googleapis.com/css?family=Lobster' rel='stylesheet' type='text/css'>",
"",
"<style>", "<style>",
" .container {", " .container {",
" background-color: darkred;", " background-color: #4a2b0f;",
" height: 400px;", " height: 400px;",
" width: 260px;", " width: 260px;",
" margin: 50px auto;", " margin: 50px auto;",
" border-radius: 4px;", " border-radius: 4px;",
" }", " }",
" .header {", " .header {",
" border: 2px solid gold;", " border: 2px solid #fff;",
" border-radius: 4px;", " border-radius: 4px;",
" height: 50px;", " height: 55px;",
" margin: 14px auto;", " margin: 14px auto;",
" background-color: #457f86",
" }", " }",
" .header h2 {", " .header h2 {",
" font-size: 24px;", " height: 30px;",
" margin: 10px 30px;", " margin: auto;",
" }",
" .header h2 {",
" font-size: 14px;",
" margin: 0 0;",
" padding: 0;", " padding: 0;",
" font-family: lobster;", " color: #fff;",
" color: gold;", " text-align: center;",
" }", " }",
" .slots{", " .slots{",
" display: flex;", " display: flex;",
" background-color: rgb(90, 1, 1);", " background-color: #457f86;",
" border-radius: 6px;", " border-radius: 6px;",
" border: 2px solid #fff;",
" }", " }",
" .slot{", " .slot{",
" flex: 1 0 auto;", " flex: 1 0 auto;",
" background: white;", " background: white;",
" height: 75px;", " height: 75px;",
" margin: 8px;", " margin: 8px;",
" border: 2px solid brown;", " border: 2px solid #215f1e;",
" border-radius: 4px;", " border-radius: 4px;",
" }", " }",
" .go {", " .go {",
" width: 100%;", " width: 100%;",
" color: gold;", " color: #fff;",
" background-color: rgb(90, 1, 1);", " background-color: #457f86;",
" border: 2px solid gold;", " border: 2px solid #fff;",
" border-radius: 2px;", " border-radius: 2px;",
" box-sizing: none;", " box-sizing: none;",
" outline: none!important;", " outline: none!important;",
" }", " }",
" .foot {", " .foot {",
" height: 150px;", " height: 150px;",
" background-color: rgb(90,1,1);", " background-color: 457f86;",
" border: 2px solid #fff;",
" }", " }",
" ", " ",
" .logger {", " .logger {",
@ -1219,20 +1228,23 @@
"id":"cf1111c1c13feddfaeb1bdef", "id":"cf1111c1c13feddfaeb1bdef",
"name":"Setting Up The Slot Machine Slots", "name":"Setting Up The Slot Machine Slots",
"dashedName":"setting-up-the-slot-machine-slots", "dashedName":"setting-up-the-slot-machine-slots",
"difficulty":"9.987", "difficulty":"9.989",
"description":[ "description":[
"", "",
"Now that we have our random numbers we need to go and check for when they are all the same that means we should count it as a win", "Now that we have our random numbers we need to go and check for when they are all the same that means we should count it as a win",
"Different numbers will have different values so we need to return the matched number or null", "Different numbers will have different values so we need to return the matched number or null",
"If we get a match we should change the value of win to the number that we have three of or leave it as null", "If we get a match we should change the value of win to the number that we have three of or leave it as null",
"Let's create an if statement with multiple conditions to check that all the numbers are equal" "Let's create an if statement with multiple conditions to check that all the numbers are equal",
"<code>if(slotOne !== slotTwo || slotTwo !== slotThree){",
" return(null);",
"}</code>"
], ],
"tests":[ "tests":[
"assert((function(){var data = runSlots();if(data == null){return(true)}else{if(data[0] == data[1] && data[1] == data[2]){return(true);}else{return(false);}}})(), 'If all three of our random numbers are the same we should return that number. Otherwise we should return null');" "assert((function(){var data = runSlots();if(data == null){return(true)}else{if(data[0] == data[1] && data[1] == data[2]){return(true);}else{return(false);}}})(), 'If all three of our random numbers are the same we should return that number. Otherwise we should return null');"
], ],
"challengeSeed":[ "challengeSeed":[
"fccss", "fccss",
" function runSlots(slots){", " function runSlots(){",
" var slotOne;", " var slotOne;",
" var slotTwo;", " var slotTwo;",
" var slotThree;", " var slotThree;",
@ -1244,6 +1256,7 @@
" slotThree = Math.floor(Math.random() * (5 - 1 + 1)) + 1;", " slotThree = Math.floor(Math.random() * (5 - 1 + 1)) + 1;",
" ", " ",
" $('.logger').html('');", " $('.logger').html('');",
" $('.logger').html('Not A Win')",
" ", " ",
" /*Don't modify above here*/", " /*Don't modify above here*/",
" ", " ",
@ -1261,7 +1274,7 @@
"", "",
" $(document).ready(function(){", " $(document).ready(function(){",
" $('.go').click(function(){", " $('.go').click(function(){",
" runSlots(slots);", " runSlots();",
" });", " });",
" });", " });",
"fcces", "fcces",
@ -1269,6 +1282,7 @@
"<div>", "<div>",
" <div class = 'container inset'>", " <div class = 'container inset'>",
" <div class = 'header inset'>", " <div class = 'header inset'>",
" <img src='https://s3.amazonaws.com/freecodecamp/freecodecamp_logo.svg.gz' alt='learn to code javascript at Free Code Camp logo' class='img-responsive nav-logo'>",
" <h2>FCC Slot Machine</h2>", " <h2>FCC Slot Machine</h2>",
" </div>", " </div>",
" <div class = 'slots inset'>", " <div class = 'slots inset'>",
@ -1295,56 +1309,59 @@
" </div>", " </div>",
"</div>", "</div>",
"", "",
"<link href='http://fonts.googleapis.com/css?family=Lobster' rel='stylesheet' type='text/css'>",
"",
"<style>", "<style>",
" .container {", " .container {",
" background-color: darkred;", " background-color: #4a2b0f;",
" height: 400px;", " height: 400px;",
" width: 260px;", " width: 260px;",
" margin: 50px auto;", " margin: 50px auto;",
" border-radius: 4px;", " border-radius: 4px;",
" }", " }",
" .header {", " .header {",
" border: 2px solid gold;", " border: 2px solid #fff;",
" border-radius: 4px;", " border-radius: 4px;",
" height: 50px;", " height: 55px;",
" margin: 14px auto;", " margin: 14px auto;",
" background-color: #457f86",
" }", " }",
" .header h2 {", " .header h2 {",
" font-size: 24px;", " height: 30px;",
" margin: 10px 30px;", " margin: auto;",
" }",
" .header h2 {",
" font-size: 14px;",
" margin: 0 0;",
" padding: 0;", " padding: 0;",
" font-family: lobster;", " color: #fff;",
" color: gold;", " text-align: center;",
" }", " }",
" .slots{", " .slots{",
" display: flex;", " display: flex;",
" background-color: rgb(90, 1, 1);", " background-color: #457f86;",
" border-radius: 6px;", " border-radius: 6px;",
" border: 2px solid #fff;",
" }", " }",
" .slot{", " .slot{",
" flex: 1 0 auto;", " flex: 1 0 auto;",
" background: white;", " background: white;",
" height: 75px;", " height: 75px;",
" margin: 8px;", " margin: 8px;",
" border: 2px solid brown;", " border: 2px solid #215f1e;",
" border-radius: 4px;", " border-radius: 4px;",
" text-align: center;",
" padding-top: 25px;",
" }", " }",
" .go {", " .go {",
" width: 100%;", " width: 100%;",
" color: gold;", " color: #fff;",
" background-color: rgb(90, 1, 1);", " background-color: #457f86;",
" border: 2px solid gold;", " border: 2px solid #fff;",
" border-radius: 2px;", " border-radius: 2px;",
" box-sizing: none;", " box-sizing: none;",
" outline: none!important;", " outline: none!important;",
" }", " }",
" .foot {", " .foot {",
" height: 150px;", " height: 150px;",
" background-color: rgb(90,1,1);", " background-color: 457f86;",
" border: 2px solid #fff;",
" }", " }",
" ", " ",
" .logger {", " .logger {",
@ -1371,7 +1388,7 @@
"id":"cf1111c1c13feddfaeb2bdef", "id":"cf1111c1c13feddfaeb2bdef",
"name":"Giving The Slot Machine Life", "name":"Giving The Slot Machine Life",
"dashedName":"giving-the-slot-machine-life", "dashedName":"giving-the-slot-machine-life",
"difficulty":"9.987", "difficulty":"9.990",
"description":[ "description":[
"", "",
"Now we can detect a win let's get the slot machine to look like it works", "Now we can detect a win let's get the slot machine to look like it works",
@ -1382,11 +1399,12 @@
"Use the above selector to display each number in the corresponding slot" "Use the above selector to display each number in the corresponding slot"
], ],
"tests":[ "tests":[
"assert((function(){if($($('.slot')[0]).html() !== '' && $($('.slot')[1]).html() !== '' $($('.slot')[2]).html() !== ''){return(true);}else{return(false);}})(), '');" "assert((function(){runSlots();if($($('.slot')[0]).html().replace(/\\s/gi, '') !== '' && $($('.slot')[1]).html().replace(/\\s/gi, '') !== '' && $($('.slot')[2]).html().replace(/\\s/gi, '') !== ''){return(true);}else{return(false);}})(), 'You should be displaying the result of the slot numbers in the corresponding slots');",
"assert((function(){if(editor.match( /\\$\\(\\$\\(\\'\\.slot\\'\\)\\[\\d\\]\\)/gi )){if(editor.match( /\\$\\(\\$\\(\\'\\.slot\\'\\)\\[\\d\\]\\)/gi ).length >= 3 && editor.match( /\\.html\\(slotOne\\);/gi ) && editor.match( /\\.html\\(slotTwo\\);/gi ) && editor.match( /\\.html\\(slotThree\\);/gi )){return(true);}else{return(false);}}else{return(false);}})(), 'You should have used the the selector given in the description to select each slot and assign it the value of slotOne&#44; slotTwo and slotThree respectively');"
], ],
"challengeSeed":[ "challengeSeed":[
"fccss", "fccss",
" function runSlots(slots){", " function runSlots(){",
" var slotOne;", " var slotOne;",
" var slotTwo;", " var slotTwo;",
" var slotThree;", " var slotThree;",
@ -1399,10 +1417,7 @@
" slotThree = Math.floor(Math.random() * (5 - 1 + 1)) + 1;", " slotThree = Math.floor(Math.random() * (5 - 1 + 1)) + 1;",
" ", " ",
" $('.logger').html('');", " $('.logger').html('');",
" ", " $('.logger').html('Not A Win')",
" if(slotOne != slotTwo || slotTwo != slotThree){",
" return(null);",
" }",
" ", " ",
" /*Don't modify above here*/", " /*Don't modify above here*/",
" ", " ",
@ -1410,17 +1425,22 @@
" ", " ",
" /*Don't modify below here*/", " /*Don't modify below here*/",
" ", " ",
" if(slotOne != slotTwo || slotTwo != slotThree){",
" return(null);",
" }",
" ",
" if(slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined){", " if(slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined){",
" $('.logger').html(slotOne);", " $('.logger').html(slotOne);",
" $('.logger').append(' ' + slotTwo);", " $('.logger').append(' ' + slotTwo);",
" $('.logger').append(' ' + slotThree);", " $('.logger').append(' ' + slotThree);",
" }", " }",
" ",
" return([slotOne, slotTwo, slotThree]);", " return([slotOne, slotTwo, slotThree]);",
" }", " }",
"", "",
" $(document).ready(function(){", " $(document).ready(function(){",
" $('.go').click(function(){", " $('.go').click(function(){",
" runSlots(slots);", " runSlots();",
" });", " });",
" });", " });",
"fcces", "fcces",
@ -1428,6 +1448,7 @@
"<div>", "<div>",
" <div class = 'container inset'>", " <div class = 'container inset'>",
" <div class = 'header inset'>", " <div class = 'header inset'>",
" <img src='https://s3.amazonaws.com/freecodecamp/freecodecamp_logo.svg.gz' alt='learn to code javascript at Free Code Camp logo' class='img-responsive nav-logo'>",
" <h2>FCC Slot Machine</h2>", " <h2>FCC Slot Machine</h2>",
" </div>", " </div>",
" <div class = 'slots inset'>", " <div class = 'slots inset'>",
@ -1454,56 +1475,61 @@
" </div>", " </div>",
"</div>", "</div>",
"", "",
"<link href='http://fonts.googleapis.com/css?family=Lobster' rel='stylesheet' type='text/css'>",
"",
"<style>", "<style>",
" .container {", " .container {",
" background-color: darkred;", " background-color: #4a2b0f;",
" height: 400px;", " height: 400px;",
" width: 260px;", " width: 260px;",
" margin: 50px auto;", " margin: 50px auto;",
" border-radius: 4px;", " border-radius: 4px;",
" }", " }",
" .header {", " .header {",
" border: 2px solid gold;", " border: 2px solid #fff;",
" border-radius: 4px;", " border-radius: 4px;",
" height: 50px;", " height: 55px;",
" margin: 14px auto;", " margin: 14px auto;",
" background-color: #457f86",
" }", " }",
" .header h2 {", " .header h2 {",
" font-size: 24px;", " height: 30px;",
" margin: 10px 30px;", " margin: auto;",
" }",
" .header h2 {",
" font-size: 14px;",
" margin: 0 0;",
" padding: 0;", " padding: 0;",
" font-family: lobster;", " color: #fff;",
" color: gold;", " text-align: center;",
" }", " }",
" .slots{", " .slots{",
" display: flex;", " display: flex;",
" background-color: rgb(90, 1, 1);", " background-color: #457f86;",
" border-radius: 6px;", " border-radius: 6px;",
" border: 2px solid #fff;",
" }", " }",
" .slot{", " .slot{",
" flex: 1 0 auto;", " flex: 1 0 auto;",
" background: white;", " background: white;",
" height: 75px;", " height: 75px;",
" margin: 8px;", " margin: 8px;",
" border: 2px solid brown;", " border: 2px solid #215f1e;",
" border-radius: 4px;", " border-radius: 4px;",
" text-align: center;", " text-align: center;",
" padding-top: 25px;", " padding-top: 25px;",
" }", " }",
" .go {", " .go {",
" width: 100%;", " width: 100%;",
" color: gold;", " color: #fff;",
" background-color: rgb(90, 1, 1);", " background-color: #457f86;",
" border: 2px solid gold;", " border: 2px solid #fff;",
" border-radius: 2px;", " border-radius: 2px;",
" box-sizing: none;", " box-sizing: none;",
" outline: none!important;", " outline: none!important;",
" }", " }",
" .foot {", " .foot {",
" height: 150px;", " height: 150px;",
" background-color: rgb(90,1,1);", " background-color: 457f86;",
" border: 2px solid #fff;",
" }", " }",
" ", " ",
" .logger {", " .logger {",