Slot Machine false positives

The 'Add your JavaScript Slot Machine Slots' waypoint would
throw false positives if all slot numbers were the same, effectively
allowing the campers to pass the test without having written any code.
pull/3229/head
ahstro 2015-09-21 23:10:13 +02:00
parent 13d79f8a4f
commit d9d558a8a9
1 changed files with 7 additions and 5 deletions

View File

@ -1302,7 +1302,7 @@
"<code>}</code>" "<code>}</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 <code>null</code>.')" "assert((function(){var data = runSlots();return data === null || data.toString().length === 1;})(), 'If all three of our random numbers are the same we should return that number. Otherwise we should return <code>null</code>.')"
], ],
"challengeSeed":[ "challengeSeed":[
"fccss", "fccss",
@ -1485,9 +1485,10 @@
" ", " ",
" // Only change code above this line.", " // Only change code above this line.",
" ", " ",
" if(slotOne !== slotTwo || slotTwo !== slotThree){", " if(slotOne === slotTwo && slotTwo === slotThree){",
" return null;", " return slotOne;",
" }", " }",
" return null;",
" ", " ",
" if(slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined){", " if(slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined){",
" $(\".logger\").html(slotOne);", " $(\".logger\").html(slotOne);",
@ -1655,9 +1656,10 @@
" ", " ",
" // Only change code above this line.", " // Only change code above this line.",
" ", " ",
" if(slotOne !== slotTwo || slotTwo !== slotThree){", " if(slotOne === slotTwo && slotTwo === slotThree){",
" return null;", " return slotOne;",
" }", " }",
" return null;",
" ", " ",
" if(slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined){", " if(slotOne !== undefined && slotTwo !== undefined && slotThree !== undefined){",
" $('.logger').html(slotOne);", " $('.logger').html(slotOne);",