Created
September 25, 2023 16:01
-
-
Save tkgstrator/8c4652675c332ceeef0759d4636ed2a6 to your computer and use it in GitHub Desktop.
Code breaker of 7days to end with you
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const map: Record<string, string> = { | |
XLIS: 'THEO', | |
GTEQJ: '', | |
YMJE: 'THEY', | |
RQH: 'ONE', | |
YCT: 'TWO', | |
XLVII: 'THREE', | |
KTZW: 'FOUR', | |
ILYH: 'FIVE', | |
WMC: 'SIX', | |
XJBJS: 'SEVEN', | |
IMKLX: 'EIGHT', | |
CNN: 'ALL', | |
CICKP: 'AGAIN', | |
QERD: 'MANY', | |
LOXYZ: 'FIRST', | |
SJDY: 'NEXT', | |
PEWX: 'LAST', | |
TGF: 'RED', | |
EOXH: 'BLUE', | |
KVIIR: 'GREEN', | |
GLSSVE: 'YELLOW', | |
XLMW: 'THIS', | |
WSQI: 'SOME', | |
CFYJW: 'WATER', | |
IODPH: 'FLAME', | |
PHDW: 'MEAT', | |
SPXCVY: 'LIQUOR', | |
HVMPO: 'DRINK', | |
IRRG: 'FOOD', | |
IUUQOTM: 'COOKING', | |
TPYYVY: 'MIRROR', | |
VNUZU: 'PHOTO', | |
ERRN: 'BOOK', | |
PCOG: 'NAME', | |
IRUANKY: 'CLOTHES', | |
LYQER: 'HUMAN', | |
FPSSH: 'BLOOD', | |
ERQH: 'BONE', | |
IFBE: 'HEAD', | |
FSHD: 'BODY', | |
NKHG: 'LIFE', | |
TLTVYG: 'MEMORY', | |
CWOMCPMZ: 'TOGETHER', | |
EPSRI: 'ALONE', | |
GHDWK: 'DEATH', | |
PSAI: 'LOVE', | |
YTTQ: 'TOOL', | |
SGZKXOGR: 'MATERIAL', | |
KYVCIQVMZ: 'CONTAINER', | |
FKDLU: 'CHAIR', | |
MTAXJ: 'HOUSE', | |
UQFSY: 'PLANT', | |
LRUDKX: 'FLOWER', | |
CTWI: 'WORD', | |
QIERW: 'MEANS', | |
WJHTWI: 'RECORD', | |
FQHMJRE: 'ALCHEMY', | |
YJRUQJ: 'TEMPLE', | |
ADU: 'WAR', | |
CODECKSXE: 'RESTRAINT', | |
WCUPZO: 'PUNISH', | |
XMQI: 'TIME', | |
RSB: 'NOW', | |
FCB: 'DAY', | |
RTSYM: 'MONTH', | |
YTIFE: 'TODAY', | |
FZXZDDZI: 'TOMORROW', | |
STTS: 'NOON', | |
KCKTOTM: 'EVENING', | |
RMKLX: 'NIGHT', | |
EP: 'DO', | |
XKYKGXIN: 'RESEARCH', | |
KFNQAWJ: 'FAILURE', | |
ZCJJLZZ: 'SUCCESS', | |
VKXLKIZ: 'PERFECT', | |
XIPP: 'TELL', | |
EUHDN: 'BREAK', | |
XZWCMKC: 'PROTECT', | |
HMWET: 'DISAP', | |
IQ: 'GO', | |
YTAHM: 'TOUCH', | |
PSSO: 'LOOK', | |
EWMNBCDJW: 'UNDERSTAN', | |
JLYH: 'GIVE', | |
BWZZH: 'SORRY', | |
PHHW: 'MEET', | |
CFSY: 'WANT', | |
KTWLJY: 'FORGET', | |
YAGXA: 'START', | |
YZUV: 'STOP', | |
XKSKSHKX: 'REMEMBER', | |
YMNSP: 'THINK', | |
KRSH: 'HOPE', | |
BEMX: 'WAIT', | |
HTRUFWJ: 'COMPARE', | |
TVYUPUN: 'MORNING', | |
WPIIT: 'SLEEP', | |
OWWLVQOPC: 'GOODNIGHT', | |
ZNGTQY: 'THANKS', | |
LIPPS: 'HELLO', | |
MFUUE: 'HAPPY', | |
RUTKRF: 'LONELY', | |
BEVQ: 'WARM', | |
WQEPP: 'SMALL', | |
BYBGR: 'USUAL', | |
CJH: 'BIG', | |
HERKIV: 'DANGER', | |
QM: 'OK', | |
DIW: 'YES', | |
PQ: 'NO', | |
EXW: 'BUT', | |
VR: 'SO', | |
}; | |
function decode(input: string, shift: number): string { | |
const alphabet = [...'ABCDEFGHIJKLMNOPQRSTUVWXYZ']; | |
const inputArray = [...input]; | |
return inputArray | |
.map((input) => { | |
const index: number = (alphabet.indexOf(input)! + shift) % 25; | |
return alphabet[index]; | |
}) | |
.join(''); | |
} | |
Object.entries(map).forEach(([key, value]) => { | |
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24].forEach((shift) => { | |
if (value === '') { | |
console.log(`Shift: ${shift} | Input: ${key} | Output: ${decode(key, shift)}`); | |
} | |
if (decode(key, shift) === value) { | |
console.log(`Shift: ${shift} | Input: ${key} | Output: ${value}`); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment