Skip to content

Instantly share code, notes, and snippets.

@Montoya
Created November 12, 2017 05:00
Show Gist options
  • Save Montoya/c5bf45e57a2cbeb8f1ded30cbb18c8fc to your computer and use it in GitHub Desktop.
Save Montoya/c5bf45e57a2cbeb8f1ded30cbb18c8fc 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)
filled = 1, hollow = 0, red or green does not matter
*/
var codes = [];
codes.push("1000110");
codes.push("1100000");
codes.push("0010100");
codes.push("0001100");
codes.push("0010011");
codes.push("0100010");
codes.push("1001110");
codes.push("0111011");
/* top row complete */
codes.push("0101010");
codes.push("1111110");
codes.push("1100001");
codes.push("1110100");
codes.push("1011110");
codes.push("0010101");
codes.push("0001110");
codes.push("0110000");
/* 2nd row complete */
codes.push("0111111");
codes.push("0111001");
codes.push("0000111");
codes.push("1110011");
codes.push("0101101");
codes.push("1110100");
codes.push("0011111");
codes.push("1011110");
/* 3rd row complete */
codes.push("1111010");
codes.push("0101110");
codes.push("1100001");
codes.push("0111010");
codes.push("1111110");
codes.push("1101000");
codes.push("0110001");
codes.push("1001010");
codes.push("0011010");
codes.push("0101011");
/* 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