Skip to content

Commit

Permalink
adding vic20 gif
Browse files Browse the repository at this point in the history
  • Loading branch information
encse committed Dec 17, 2024
1 parent 76b643f commit 9fd6a0d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
4 changes: 4 additions & 0 deletions 2024/Day17/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ _lowest few bits_ of the input. Then the input gets shifted by a small amount, a
There is _some interconnection_ between the consecutive numbers, so one cannot just calculate the result independently
for each. But I was able to come up with a _recursive solution_ that generates the input _backwards_. Once we know the
higher bits, we can try all combinations for the next 3 bits, and so on down to the first bit.

As an added bonus I implemented (part of) the emulator in [VIC-20 BASIC](https://hu.wikipedia.org/wiki/Commodore_VIC-20). This is how it runs the second sample that prints out its own source code.

![vic20.gif](vic20.gif)
Binary file added 2024/Day17/vic20.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 11 additions & 1 deletion docs/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ const path = require('path');
const marked = require('marked');


function media(dir){
const files = fs.readdirSync(dir);
return files.filter(file => path.extname(file).toLowerCase() === '.gif').map(file => path.join(dir, file));
}

function* findReadmes(dir) {
const entries = fs.readdirSync(dir, { withFileTypes: true });

Expand Down Expand Up @@ -37,6 +42,7 @@ function* findReadmes(dir) {
}
}


yield {
year,
day,
Expand All @@ -45,6 +51,7 @@ function* findReadmes(dir) {
notes: marked.parse(lines.join('\n')),
code: fs.readFileSync(solutionPath, 'utf8'),
illustration: fs.existsSync(illustrationPath) ? illustrationPath : 'docs/elf.jpeg',
media: media(fullPath)
};
}
}
Expand Down Expand Up @@ -153,7 +160,7 @@ fs.writeFileSync(path.join('build', 'index.html'), filledRedirectTemplate);

const currentYear = new Date().getFullYear();
// Iterate over readme.md files and print filled templates
for (const { year, day, name, notes, code, illustration } of findReadmes('.')) {
for (const { year, day, name, notes, code, illustration, media } of findReadmes('.')) {
const filledHtml = fillTemplate(template, {
url: `https://aoc.csokavar.hu/${year}/${day}/`,
'problem-id': `${year}/${day}`,
Expand All @@ -168,5 +175,8 @@ for (const { year, day, name, notes, code, illustration } of findReadmes('.')) {
fs.mkdirSync(dst, { recursive: true });
fs.writeFileSync(path.join(dst, 'index.html'), filledHtml);
fs.copyFileSync(illustration, path.join(dst, 'illustration.jpeg'));
for(let file of media) {
fs.copyFileSync(file, path.join(dst, path.basename(file)));
}
}

4 changes: 4 additions & 0 deletions docs/template.html
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,10 @@
/* hyphens: auto; */
}

.content img {
width: 70%;
}


@media (max-width: 1024px) {
.main {
Expand Down

0 comments on commit 9fd6a0d

Please sign in to comment.