Mind boggling card trick: Difference between revisions
→{{header|Javascript}}: Updated output formatting, refreshed sample output
(→{{header|Javascript}}: Added a JS version) |
(→{{header|Javascript}}: Updated output formatting, refreshed sample output) |
||
Line 356:
rs = take(nSwap, bs_).concat(drop(nSwap, rs_)),
// CHECKED
rrs = filter(c => 'R' === c, rs).join(''),
bbs = filter(c => 'B' === c, bs).join('');
Line 362:
'Discarded: ' + discards.join(''),
'Swapped: ' + nSwap,
'Red pile: ' + rs.join(''),
'Black pile: ' + bs.join(''),
rrs + ' = Red cards in the red pile',
bbs + ' = Black cards in the black pile',
Line 474:
})();</lang>
{{Out}}
<pre>Discarded:
Swapped:
Red pile:
Black pile:
RRRRRRRR = Red cards in the red pile
BBBBBBBB = Black cards in the black pile
|