javascript(omcb-server-clocks): Play around with clock decoding
Signed-off-by: prescientmoon <git@moonythm.dev>
This commit is contained in:
commit
d65b929b9a
3 changed files with 40 additions and 0 deletions
javascript/omcb-server-clocks
34
javascript/omcb-server-clocks/script.js
Normal file
34
javascript/omcb-server-clocks/script.js
Normal file
|
@ -0,0 +1,34 @@
|
|||
const fs = require("node:fs");
|
||||
|
||||
const data = fs.readFileSync("./data.txt", "utf8");
|
||||
|
||||
const numbers = [];
|
||||
for (const line of data.split("\n")) {
|
||||
if (line.trim() === "") continue;
|
||||
const numberLine = [];
|
||||
numbers.push(numberLine);
|
||||
|
||||
for (const segment of line.split(" ")) {
|
||||
if (segment.startsWith("?")) continue;
|
||||
const isMid = segment.endsWith(".");
|
||||
const num = parseInt(segment);
|
||||
// if (isMid) numberLine.push((num - 1) * 2 + 1);
|
||||
// else numberLine.push((num - 1) * 2);
|
||||
if (isMid) numberLine.push(12 + num - 1);
|
||||
else numberLine.push(num - 1);
|
||||
}
|
||||
}
|
||||
|
||||
const alphabet = "abcdefghijklmnopqrstuvwxyz";
|
||||
|
||||
for (let shift = 0; shift < alphabet.length; shift++) {
|
||||
for (const line of numbers) {
|
||||
let res = "";
|
||||
for (const num of line) {
|
||||
res += alphabet[(num + shift) % alphabet.length];
|
||||
}
|
||||
for (let i = 0; i < res.length; i++)
|
||||
if (res.substr(i).startsWith("doit")) console.log(res);
|
||||
}
|
||||
console.log(" ");
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue