Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function solve (params) {
- let regex = /^([#$%*&]+)([A-Za-z]+)\1=(\d+)!!(.+)$/
- for (let param of params) {
- let match = param.match(regex)
- if (match) {
- let length = +match[3]
- if (length === match[4].length) {
- let decrypted = match[4]
- .split('')
- .map(x => String.fromCharCode(x.charCodeAt(0) + length))
- .join('')
- console.log(`Coordinates found! ${match[2]} -> ${decrypted}`)
- break
- } else {
- console.log(`Nothing found!`)
- }
- } else {
- console.log(`Nothing found!`)
- }
- }
- }
- solve([
- '%GiacomoAgostini%=7!!hbqw',
- '&GeoffDuke*=6!!vjh]zi',
- 'JoeyDunlop=10!!lkd,rwazdr',
- 'Mike??Hailwood=5!![pliu',
- '#SteveHislop#=16!!df%TU[Tj(h!!TT[S'
- ])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement