Skip to content

Commit 9fd6a0d

Browse files
committed
adding vic20 gif
1 parent 76b643f commit 9fd6a0d

File tree

4 files changed

+19
-1
lines changed

4 files changed

+19
-1
lines changed

2024/Day17/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,7 @@ _lowest few bits_ of the input. Then the input gets shifted by a small amount, a
2020
There is _some interconnection_ between the consecutive numbers, so one cannot just calculate the result independently
2121
for each. But I was able to come up with a _recursive solution_ that generates the input _backwards_. Once we know the
2222
higher bits, we can try all combinations for the next 3 bits, and so on down to the first bit.
23+
24+
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.
25+
26+
![vic20.gif](vic20.gif)

2024/Day17/vic20.gif

9.99 MB
Loading

docs/build.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ const path = require('path');
33
const marked = require('marked');
44

55

6+
function media(dir){
7+
const files = fs.readdirSync(dir);
8+
return files.filter(file => path.extname(file).toLowerCase() === '.gif').map(file => path.join(dir, file));
9+
}
10+
611
function* findReadmes(dir) {
712
const entries = fs.readdirSync(dir, { withFileTypes: true });
813

@@ -37,6 +42,7 @@ function* findReadmes(dir) {
3742
}
3843
}
3944

45+
4046
yield {
4147
year,
4248
day,
@@ -45,6 +51,7 @@ function* findReadmes(dir) {
4551
notes: marked.parse(lines.join('\n')),
4652
code: fs.readFileSync(solutionPath, 'utf8'),
4753
illustration: fs.existsSync(illustrationPath) ? illustrationPath : 'docs/elf.jpeg',
54+
media: media(fullPath)
4855
};
4956
}
5057
}
@@ -153,7 +160,7 @@ fs.writeFileSync(path.join('build', 'index.html'), filledRedirectTemplate);
153160

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

docs/template.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,10 @@
216216
/* hyphens: auto; */
217217
}
218218

219+
.content img {
220+
width: 70%;
221+
}
222+
219223

220224
@media (max-width: 1024px) {
221225
.main {

0 commit comments

Comments
 (0)