Advent of Code 2016 - Day 8

Size
4,236 Kb
Views
46,552

How do I make an advent of code 2016 - day 8?

My solution for http://adventofcode.com/2016/day/8. What is a advent of code 2016 - day 8? How do you make a advent of code 2016 - day 8? This script and codes were developed by Christian Stuff on 01 August 2022, Monday.

Advent of Code 2016 - Day 8 Previews

Advent of Code 2016 - Day 8 - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Advent of Code 2016 - Day 8</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <pre id="screen"></pre>
<input type="number" min="0" max="300" id="pixels" /> <script src="js/index.js"></script>
</body>
</html>

Advent of Code 2016 - Day 8 - Script Codes CSS Codes

body { background: #000;
}
#screen { border: 10px solid #a1a1a1; border-radius: 10px; font-size: 1.75vw; left: 50%; line-height: 1; position: absolute; top: 50%; transform: translate3d(-50%, -50%, 0);
}
#pixels { background: #000; border: 3px solid #a1a1a1; border-radius: 3px; color: green; font-family: monospace; padding: 0; text-align: center; vertical-align: top; width: 3em;
}
#pixels::-webkit-inner-spin-button { display: none;
}

Advent of Code 2016 - Day 8 - Script Codes JS Codes

'use strict';
var input = 'rect 1x1\nrotate row y=0 by 5\nrect 1x1\nrotate row y=0 by 5\nrect 1x1\nrotate row y=0 by 5\nrect 1x1\nrotate row y=0 by 5\nrect 1x1\nrotate row y=0 by 2\nrect 1x1\nrotate row y=0 by 2\nrect 1x1\nrotate row y=0 by 3\nrect 1x1\nrotate row y=0 by 3\nrect 2x1\nrotate row y=0 by 2\nrect 1x1\nrotate row y=0 by 3\nrect 2x1\nrotate row y=0 by 2\nrect 1x1\nrotate row y=0 by 3\nrect 2x1\nrotate row y=0 by 5\nrect 4x1\nrotate row y=0 by 5\nrotate column x=0 by 1\nrect 4x1\nrotate row y=0 by 10\nrotate column x=5 by 2\nrotate column x=0 by 1\nrect 9x1\nrotate row y=2 by 5\nrotate row y=0 by 5\nrotate column x=0 by 1\nrect 4x1\nrotate row y=2 by 5\nrotate row y=0 by 5\nrotate column x=0 by 1\nrect 4x1\nrotate column x=40 by 1\nrotate column x=27 by 1\nrotate column x=22 by 1\nrotate column x=17 by 1\nrotate column x=12 by 1\nrotate column x=7 by 1\nrotate column x=2 by 1\nrotate row y=2 by 5\nrotate row y=1 by 3\nrotate row y=0 by 5\nrect 1x3\nrotate row y=2 by 10\nrotate row y=1 by 7\nrotate row y=0 by 2\nrotate column x=3 by 2\nrotate column x=2 by 1\nrotate column x=0 by 1\nrect 4x1\nrotate row y=2 by 5\nrotate row y=1 by 3\nrotate row y=0 by 3\nrect 1x3\nrotate column x=45 by 1\nrotate row y=2 by 7\nrotate row y=1 by 10\nrotate row y=0 by 2\nrotate column x=3 by 1\nrotate column x=2 by 2\nrotate column x=0 by 1\nrect 4x1\nrotate row y=2 by 13\nrotate row y=0 by 5\nrotate column x=3 by 1\nrotate column x=0 by 1\nrect 4x1\nrotate row y=3 by 10\nrotate row y=2 by 10\nrotate row y=0 by 5\nrotate column x=3 by 1\nrotate column x=2 by 1\nrotate column x=0 by 1\nrect 4x1\nrotate row y=3 by 8\nrotate row y=0 by 5\nrotate column x=3 by 1\nrotate column x=2 by 1\nrotate column x=0 by 1\nrect 4x1\nrotate row y=3 by 17\nrotate row y=2 by 20\nrotate row y=0 by 15\nrotate column x=13 by 1\nrotate column x=12 by 3\nrotate column x=10 by 1\nrotate column x=8 by 1\nrotate column x=7 by 2\nrotate column x=6 by 1\nrotate column x=5 by 1\nrotate column x=3 by 1\nrotate column x=2 by 2\nrotate column x=0 by 1\nrect 14x1\nrotate row y=1 by 47\nrotate column x=9 by 1\nrotate column x=4 by 1\nrotate row y=3 by 3\nrotate row y=2 by 10\nrotate row y=1 by 8\nrotate row y=0 by 5\nrotate column x=2 by 2\nrotate column x=0 by 2\nrect 3x2\nrotate row y=3 by 12\nrotate row y=2 by 10\nrotate row y=0 by 10\nrotate column x=8 by 1\nrotate column x=7 by 3\nrotate column x=5 by 1\nrotate column x=3 by 1\nrotate column x=2 by 1\nrotate column x=1 by 1\nrotate column x=0 by 1\nrect 9x1\nrotate row y=0 by 20\nrotate column x=46 by 1\nrotate row y=4 by 17\nrotate row y=3 by 10\nrotate row y=2 by 10\nrotate row y=1 by 5\nrotate column x=8 by 1\nrotate column x=7 by 1\nrotate column x=6 by 1\nrotate column x=5 by 1\nrotate column x=3 by 1\nrotate column x=2 by 2\nrotate column x=1 by 1\nrotate column x=0 by 1\nrect 9x1\nrotate column x=32 by 4\nrotate row y=4 by 33\nrotate row y=3 by 5\nrotate row y=2 by 15\nrotate row y=0 by 15\nrotate column x=13 by 1\nrotate column x=12 by 3\nrotate column x=10 by 1\nrotate column x=8 by 1\nrotate column x=7 by 2\nrotate column x=6 by 1\nrotate column x=5 by 1\nrotate column x=3 by 1\nrotate column x=2 by 1\nrotate column x=1 by 1\nrotate column x=0 by 1\nrect 14x1\nrotate column x=39 by 3\nrotate column x=35 by 4\nrotate column x=20 by 4\nrotate column x=19 by 3\nrotate column x=10 by 4\nrotate column x=9 by 3\nrotate column x=8 by 3\nrotate column x=5 by 4\nrotate column x=4 by 3\nrotate row y=5 by 5\nrotate row y=4 by 5\nrotate row y=3 by 33\nrotate row y=1 by 30\nrotate column x=48 by 1\nrotate column x=47 by 5\nrotate column x=46 by 5\nrotate column x=45 by 1\nrotate column x=43 by 1\nrotate column x=38 by 3\nrotate column x=37 by 3\nrotate column x=36 by 5\nrotate column x=35 by 1\nrotate column x=33 by 1\nrotate column x=32 by 5\nrotate column x=31 by 5\nrotate column x=30 by 1\nrotate column x=23 by 4\nrotate column x=22 by 3\nrotate column x=21 by 3\nrotate column x=20 by 1\nrotate column x=12 by 2\nrotate column x=11 by 2\nrotate column x=3 by 5\nrotate column x=2 by 5\nrotate column x=1 by 3\nrotate column x=0 by 4'.split('\n');
var width = 50;
var height = 6;
var screen = [];
var offChar = '◻️';
var onChar = '◼️';
var $screen = document.getElementById('screen');
var $pixels = document.getElementById('pixels');
for (var h = 0; h < height; h++) { screen[h] = []; for (var w = 0; w < width; w++) { screen[h][w] = offChar; }
}
function printScreen() { var output = ''; screen.forEach(function (row) { output += row.join('') + '\n'; }); $screen.innerHTML = output;
}
function arrayRotate(arr, count) { count -= arr.length * Math.floor(count / arr.length); arr.push.apply(arr, arr.splice(0, count)); return arr;
}
function createRect(width, height) { for (var h = 0; h < height; h++) { for (var w = 0; w < width; w++) { screen[h][w] = onChar; } }
}
function rotateRow(row, shift) { screen[row] = arrayRotate(screen[row], -shift);
}
function rotateColumn(column, shift) { var colCopy = []; for (var h = 0; h < height; h++) { colCopy.push(screen[h][column]); } colCopy = arrayRotate(colCopy, -shift); for (var h = 0; h < height; h++) { screen[h][column] = colCopy[h]; }
}
function exec(cmd) { var args = cmd.split(' '); if (args[0] === 'rect') { var dims = args[1].split('x'); createRect(dims[0], dims[1]); } if (args[0] === 'rotate') { if (args[1] === 'row') { var row = parseInt(args[2].split('=')[1]); rotateRow(row, parseInt(args[4])); } if (args[1] === 'column') { var column = parseInt(args[2].split('=')[1]); rotateColumn(column, parseInt(args[4])); } } printScreen();
}
function pixels() { var lidPixels = 0; for (var h = 0; h < height; h++) { for (var w = 0; w < width; w++) { if (screen[h][w] === onChar) { lidPixels++; } } } $pixels.value = lidPixels;
}
printScreen();
var cmdIndex = 0;
var interval = setInterval(function () { exec(input[cmdIndex]); pixels(); cmdIndex++; if (cmdIndex == input.length) { clearInterval(interval); }
}, 50);
Advent of Code 2016 - Day 8 - Script Codes
Advent of Code 2016 - Day 8 - Script Codes
Home Page Home
Developer Christian Stuff
Username Regaddi
Uploaded August 01, 2022
Rating 3
Size 4,236 Kb
Views 46,552
Do you need developer help for Advent of Code 2016 - Day 8?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Christian Stuff (Regaddi) Script Codes
Create amazing SEO content with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!