Move Caesers Cipher to Bonfires
This commit is contained in:
parent
28eeab5aef
commit
50696d3553
@ -808,6 +808,51 @@
|
||||
],
|
||||
"namePt": "",
|
||||
"descriptionPt": []
|
||||
},
|
||||
{
|
||||
"id": "56533eb9ac21ba0edf2244e2",
|
||||
"title": "Caesar's Cipher",
|
||||
"description": [
|
||||
"One of the simplest and most widely known <dfn>ciphers</dfn> is a <code>Caesar cipher</code>, also known as a <code>shift cipher</code>. In a <code>shift cipher</code> the meanings of the letters are shifted by some set amount.",
|
||||
"A common modern use is the <a href=\"https://en.wikipedia.org/wiki/ROT13\">ROT13</a> cipher, where the values of the letters are shifted by 13 places. Thus 'A' ↔ 'N', 'B' ↔ 'O' and so on.",
|
||||
"Write a function which takes a <code>ROT13</code> encoded string as input and returns a decoded string. All letters will be uppercase. Do not transform any non-alphabetic character (i.e. spaces, punctuation), but do pass them on.",
|
||||
"The provided code transforms the input into an array for you, <code>codeArr</code>. Place the decoded values into the <code>decodedArr</code> array where the provided code will transform it back into a string."
|
||||
],
|
||||
"releasedOn": "January 1, 2016",
|
||||
"challengeSeed": [
|
||||
"function rot13(encodedStr) {",
|
||||
" var codeArr = encodedStr.split(\"\"); // String to Array",
|
||||
" var decodedArr = []; // Your Result goes here",
|
||||
" // Only change code below this line",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" // Only change code above this line",
|
||||
" return decodedArr.join(\"\"); // Array to String",
|
||||
"}",
|
||||
"",
|
||||
"// Change the inputs below to test",
|
||||
"rot13(\"SERR PBQR PNZC\");"
|
||||
],
|
||||
"tail": [
|
||||
""
|
||||
],
|
||||
"solutions": [
|
||||
"var lookup = {\n 'A': 'N','B': 'O','C': 'P','D': 'Q',\n 'E': 'R','F': 'S','G': 'T','H': 'U',\n 'I': 'V','J': 'W','K': 'X','L': 'Y',\n 'M': 'Z','N': 'A','O': 'B','P': 'C',\n 'Q': 'D','R': 'E','S': 'F','T': 'G',\n 'U': 'H','V': 'I','W': 'J','X': 'K',\n 'Y': 'L','Z': 'M' \n};\n\nfunction rot13(encodedStr) {\n var codeArr = encodedStr.split(\"\"); // String to Array\n var decodedArr = []; // Your Result goes here\n // Only change code below this line\n \n decodedArr = codeArr.map(function(letter) {\n if(lookup.hasOwnProperty(letter)) {\n letter = lookup[letter];\n }\n return letter;\n });\n\n // Only change code above this line\n return decodedArr.join(\"\"); // Array to String\n}"
|
||||
],
|
||||
"tests": [
|
||||
"assert(rot13(\"SERR PBQR PNZC\") === \"FREE CODE CAMP\", 'message: <code>rot13(\"SERR PBQR PNZC\")</code> should decode to <code>\"FREE CODE CAMP\"</code>');",
|
||||
"assert(rot13(\"SERR CVMMN!\") === \"FREE PIZZA!\", 'message: <code>rot13(\"SERR CVMMN!\")</code> should decode to <code>\"FREE PIZZA!\"</code>');",
|
||||
"assert(rot13(\"SERR YBIR?\") === \"FREE LOVE?\", 'message: <code>rot13(\"SERR YBIR?\")</code> should decode to <code>\"FREE LOVE?\"</code>');",
|
||||
"assert(rot13(\"GUR DHVPX OEBJA QBT WHZCRQ BIRE GUR YNML SBK.\") === \"THE QUICK BROWN DOG JUMPED OVER THE LAZY FOX.\", 'message: <code>rot13(\"GUR DHVPX OEBJA QBT WHZCRQ BIRE GUR YNML SBK.\")</code> should decode to <code>\"THE QUICK BROWN DOG JUMPED OVER THE LAZY FOX.\"</code>');"
|
||||
],
|
||||
"type": "bonfire",
|
||||
"challengeType": "5",
|
||||
"nameCn": "",
|
||||
"nameFr": "",
|
||||
"nameRu": "",
|
||||
"nameEs": "",
|
||||
"namePt": ""
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -4208,51 +4208,6 @@
|
||||
"type": "waypoint",
|
||||
"challengeType": "1"
|
||||
},
|
||||
{
|
||||
"id": "56533eb9ac21ba0edf2244e2",
|
||||
"title": "Caesar's Cipher",
|
||||
"description": [
|
||||
"One of the simplest and most widely known <dfn>ciphers</dfn> is a <code>Caesar cipher</code>, also known as a <code>shift cipher</code>. In a <code>shift cipher</code> the meanings of the letters are shifted by some set amount.",
|
||||
"A common modern use is the <a href=\"https://en.wikipedia.org/wiki/ROT13\">ROT13</a> cipher, where the values of the letters are shifted by 13 places. Thus 'A' ↔ 'N', 'B' ↔ 'O' and so on.",
|
||||
"Write a function which takes a <code>ROT13</code> encoded string as input and returns a decoded string. All letters will be uppercase. Do not transform any non-alphabetic character (i.e. spaces, punctuation), but do pass them on.",
|
||||
"The provided code transforms the input into an array for you, <code>codeArr</code>. Place the decoded values into the <code>decodedArr</code> array where the provided code will transform it back into a string."
|
||||
],
|
||||
"releasedOn": "January 1, 2016",
|
||||
"challengeSeed": [
|
||||
"function rot13(encodedStr) {",
|
||||
" var codeArr = encodedStr.split(\"\"); // String to Array",
|
||||
" var decodedArr = []; // Your Result goes here",
|
||||
" // Only change code below this line",
|
||||
" ",
|
||||
" ",
|
||||
" ",
|
||||
" // Only change code above this line",
|
||||
" return decodedArr.join(\"\"); // Array to String",
|
||||
"}",
|
||||
"",
|
||||
"// Change the inputs below to test",
|
||||
"rot13(\"SERR PBQR PNZC\");"
|
||||
],
|
||||
"tail": [
|
||||
""
|
||||
],
|
||||
"solutions": [
|
||||
"var lookup = {\n 'A': 'N','B': 'O','C': 'P','D': 'Q',\n 'E': 'R','F': 'S','G': 'T','H': 'U',\n 'I': 'V','J': 'W','K': 'X','L': 'Y',\n 'M': 'Z','N': 'A','O': 'B','P': 'C',\n 'Q': 'D','R': 'E','S': 'F','T': 'G',\n 'U': 'H','V': 'I','W': 'J','X': 'K',\n 'Y': 'L','Z': 'M' \n};\n\nfunction rot13(encodedStr) {\n var codeArr = encodedStr.split(\"\"); // String to Array\n var decodedArr = []; // Your Result goes here\n // Only change code below this line\n \n decodedArr = codeArr.map(function(letter) {\n if(lookup.hasOwnProperty(letter)) {\n letter = lookup[letter];\n }\n return letter;\n });\n\n // Only change code above this line\n return decodedArr.join(\"\"); // Array to String\n}"
|
||||
],
|
||||
"tests": [
|
||||
"assert(rot13(\"SERR PBQR PNZC\") === \"FREE CODE CAMP\", 'message: <code>rot13(\"SERR PBQR PNZC\")</code> should decode to <code>\"FREE CODE CAMP\"</code>');",
|
||||
"assert(rot13(\"SERR CVMMN!\") === \"FREE PIZZA!\", 'message: <code>rot13(\"SERR CVMMN!\")</code> should decode to <code>\"FREE PIZZA!\"</code>');",
|
||||
"assert(rot13(\"SERR YBIR?\") === \"FREE LOVE?\", 'message: <code>rot13(\"SERR YBIR?\")</code> should decode to <code>\"FREE LOVE?\"</code>');",
|
||||
"assert(rot13(\"GUR DHVPX OEBJA QBT WHZCRQ BIRE GUR YNML SBK.\") === \"THE QUICK BROWN DOG JUMPED OVER THE LAZY FOX.\", 'message: <code>rot13(\"GUR DHVPX OEBJA QBT WHZCRQ BIRE GUR YNML SBK.\")</code> should decode to <code>\"THE QUICK BROWN DOG JUMPED OVER THE LAZY FOX.\"</code>');"
|
||||
],
|
||||
"type": "waypoint",
|
||||
"challengeType": "1",
|
||||
"nameCn": "",
|
||||
"nameFr": "",
|
||||
"nameRu": "",
|
||||
"nameEs": "",
|
||||
"namePt": ""
|
||||
},
|
||||
{
|
||||
"id": "cf1111c1c11feddfaeb9bdef",
|
||||
"title": "Generate Random Fractions with JavaScript",
|
||||
|
Loading…
x
Reference in New Issue
Block a user