Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
"Morse Clock" solution in Clear category for [old] Morse Clock by capback250
"use strict";
const lengths = {'00':2, '01':4, '10':3, '11':4, '20':3, '21':4}
function morseClock(data) {
let times = data.split(':').map(e=> e.length < 2 ? '0'+e : e).map(e=> e.split('').map(z=>+z));
return times.map((time, index) => time.map((e, i) => ('0'.repeat(lengths[`${index}${i}`] - e.toString(2).length) + e.toString(2))
.replace(/0/g, '.')
.replace(/1/g, '-')))
.map(e=>e.join(' '))
.join(' : ')
}
May 16, 2017