Skip to content

Instantly share code, notes, and snippets.

@Montoya
Created November 1, 2017 03:44
Show Gist options
  • Save Montoya/5cca2f45f80c2a0781f13de7f269cf0b to your computer and use it in GitHub Desktop.
Save Montoya/5cca2f45f80c2a0781f13de7f269cf0b to your computer and use it in GitHub Desktop.
<!doctype>
<html>
<body>
<script type="text/javascript">
/* by m0nt0y4 */
function binaryAgent(arr) {
var charcoded = [],
finalStr = '',
i;
for (i = 0; i < arr.length; i++) {
finalStr += String.fromCharCode((parseInt(arr[i], 2)));
}
return finalStr;
}
/*
monitor by monitor
each monitor is actually two codes (each code is 7 digits of binary)
green = 1, red = 0, hollow or filled does not matter
*/
var codes = [];
codes.push("1010110"); // V
codes.push("1101001"); // i
codes.push("1001100"); // L
codes.push("1101110"); // n
codes.push("0110110"); // 6
codes.push("1001110"); // N
codes.push("1010001"); // Q
codes.push("1111000"); // x
/* top row complete */
codes.push("1000010");
codes.push("1110011");
codes.push("1110010");
codes.push("0110011");
codes.push("1010011");
codes.push("1100100");
codes.push("1001110");
codes.push("1111000");
/* 2nd row complete */
codes.push("1000101");
codes.push("1001010");
codes.push("1101111");
codes.push("1011000");
codes.push("1110000");
codes.push("0110011");
codes.push("1101111");
codes.push("1101101");
/* 3rd row complete */
codes.push("1010100");
codes.push("0110101");
codes.push("1100010");
codes.push("1000100");
codes.push("1101111");
codes.push("1101011");
codes.push("1000001");
codes.push("1010111");
codes.push("1000010");
codes.push("1011010");
/* final row complete */
console.log(binaryAgent(codes));
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment