Skip to content

Commit

Permalink
Make it possible to have both our inputs running
Browse files Browse the repository at this point in the history
  • Loading branch information
MinThaMie committed Nov 25, 2023
1 parent abe6849 commit 62ee42e
Show file tree
Hide file tree
Showing 77 changed files with 154 additions and 79 deletions.
4 changes: 2 additions & 2 deletions app/components/day.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
</div>
<div class="container">
<div class="solution1">
Solution 1 is {{if this.input @solution1 @example1}}
Part 1:<br> {{if this.input @solution1 @example1}}
<CodeSnippet @name="day{{ @number}}-solution1.js"/>
</div>
<div class="solution2">
Solution 2 is {{if this.input @solution2 @example2}}
Part 2:<br> {{if this.input @solution2 @example2}}
<CodeSnippet @name="day{{ @number}}-solution2.js"/>
</div>
<div class="description">
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/puzzles/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ export default class PuzzlesBaseController extends Controller {
return this.solve1(this.model.example);
}
get solution1() {
return this.solve1(this.model.full);
return `MinThaMie's solution: ${this.solve1(this.model.fullMinThaMie)} <br><br> LiuLangZhe's solution: ${this.solve1(this.model.fullLiuLangzhe)}`;;
}
get example2() {
return this.solve2(this.model.example);
}
get solution2() {
return this.solve2(this.model.full);
return `MinThaMie's solution: ${this.solve2(this.model.fullMinThaMie)} <br><br> LiuLangZhe's solution: ${this.solve2(this.model.fullLiuLangzhe)}`;
}
}
9 changes: 6 additions & 3 deletions app/routes/puzzles/1.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ export default class Puzzles1Route extends Route {
async model() {
const resIntro = await fetch('/inputs/day1/intro.txt');
const introFile = await resIntro.text();
const res = await fetch('/inputs/day1/full.txt');
const fullFile = await res.text();
const resMinThamie = await fetch('/inputs/day1/full-minthamie.txt');
const resLiuLangZhe = await fetch('/inputs/day1/full-liulangzhe.txt');
const fullMinThamieFile = await resMinThamie.text();
const fullLiuLangzheFile = await resLiuLangZhe.text();
return {
example: this.parseInput(introFile),
full: this.parseInput(fullFile),
fullMinThaMie: this.parseInput(fullMinThamieFile),
fullLiuLangzhe: this.parseInput(fullLiuLangzheFile),
};
}
}
9 changes: 6 additions & 3 deletions app/routes/puzzles/10.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ export default class Puzzles10Route extends Route {
async model() {
const resIntro = await fetch('/inputs/day10/intro.txt');
const introFile = await resIntro.text();
const res = await fetch('/inputs/day10/full.txt');
const fullFile = await res.text();
const resMinThamie = await fetch('/inputs/day10/full-minthamie.txt');
const resLiuLangZhe = await fetch('/inputs/day10/full-liulangzhe.txt');
const fullMinThamieFile = await resMinThamie.text();
const fullLiuLangzheFile = await resLiuLangZhe.text();
return {
example: this.parseInput(introFile),
full: this.parseInput(fullFile),
fullMinThaMie: this.parseInput(fullMinThamieFile),
fullLiuLangzhe: this.parseInput(fullLiuLangzheFile),
};
}
}
9 changes: 6 additions & 3 deletions app/routes/puzzles/11.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ export default class Puzzles11Route extends Route {
async model() {
const resIntro = await fetch('/inputs/day11/intro.txt');
const introFile = await resIntro.text();
const res = await fetch('/inputs/day11/full.txt');
const fullFile = await res.text();
const resMinThamie = await fetch('/inputs/day11/full-minthamie.txt');
const resLiuLangZhe = await fetch('/inputs/day11/full-liulangzhe.txt');
const fullMinThamieFile = await resMinThamie.text();
const fullLiuLangzheFile = await resLiuLangZhe.text();
return {
example: this.parseInput(introFile),
full: this.parseInput(fullFile),
fullMinThaMie: this.parseInput(fullMinThamieFile),
fullLiuLangzhe: this.parseInput(fullLiuLangzheFile),
};
}
}
9 changes: 6 additions & 3 deletions app/routes/puzzles/12.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ export default class Puzzles12Route extends Route {
async model() {
const resIntro = await fetch('/inputs/day12/intro.txt');
const introFile = await resIntro.text();
const res = await fetch('/inputs/day12/full.txt');
const fullFile = await res.text();
const resMinThamie = await fetch('/inputs/day12/full-minthamie.txt');
const resLiuLangZhe = await fetch('/inputs/day12/full-liulangzhe.txt');
const fullMinThamieFile = await resMinThamie.text();
const fullLiuLangzheFile = await resLiuLangZhe.text();
return {
example: this.parseInput(introFile),
full: this.parseInput(fullFile),
fullMinThaMie: this.parseInput(fullMinThamieFile),
fullLiuLangzhe: this.parseInput(fullLiuLangzheFile),
};
}
}
9 changes: 6 additions & 3 deletions app/routes/puzzles/13.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ export default class Puzzles13Route extends Route {
async model() {
const resIntro = await fetch('/inputs/day13/intro.txt');
const introFile = await resIntro.text();
const res = await fetch('/inputs/day13/full.txt');
const fullFile = await res.text();
const resMinThamie = await fetch('/inputs/day13/full-minthamie.txt');
const resLiuLangZhe = await fetch('/inputs/day13/full-liulangzhe.txt');
const fullMinThamieFile = await resMinThamie.text();
const fullLiuLangzheFile = await resLiuLangZhe.text();
return {
example: this.parseInput(introFile),
full: this.parseInput(fullFile),
fullMinThaMie: this.parseInput(fullMinThamieFile),
fullLiuLangzhe: this.parseInput(fullLiuLangzheFile),
};
}
}
9 changes: 6 additions & 3 deletions app/routes/puzzles/14.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ export default class Puzzles14Route extends Route {
async model() {
const resIntro = await fetch('/inputs/day14/intro.txt');
const introFile = await resIntro.text();
const res = await fetch('/inputs/day14/full.txt');
const fullFile = await res.text();
const resMinThamie = await fetch('/inputs/day14/full-minthamie.txt');
const resLiuLangZhe = await fetch('/inputs/day14/full-liulangzhe.txt');
const fullMinThamieFile = await resMinThamie.text();
const fullLiuLangzheFile = await resLiuLangZhe.text();
return {
example: this.parseInput(introFile),
full: this.parseInput(fullFile),
fullMinThaMie: this.parseInput(fullMinThamieFile),
fullLiuLangzhe: this.parseInput(fullLiuLangzheFile),
};
}
}
9 changes: 6 additions & 3 deletions app/routes/puzzles/15.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ export default class Puzzles15Route extends Route {
async model() {
const resIntro = await fetch('/inputs/day15/intro.txt');
const introFile = await resIntro.text();
const res = await fetch('/inputs/day15/full.txt');
const fullFile = await res.text();
const resMinThamie = await fetch('/inputs/day15/full-minthamie.txt');
const resLiuLangZhe = await fetch('/inputs/day15/full-liulangzhe.txt');
const fullMinThamieFile = await resMinThamie.text();
const fullLiuLangzheFile = await resLiuLangZhe.text();
return {
example: this.parseInput(introFile),
full: this.parseInput(fullFile),
fullMinThaMie: this.parseInput(fullMinThamieFile),
fullLiuLangzhe: this.parseInput(fullLiuLangzheFile),
};
}
}
9 changes: 6 additions & 3 deletions app/routes/puzzles/16.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ export default class Puzzles16Route extends Route {
async model() {
const resIntro = await fetch('/inputs/day16/intro.txt');
const introFile = await resIntro.text();
const res = await fetch('/inputs/day16/full.txt');
const fullFile = await res.text();
const resMinThamie = await fetch('/inputs/day16/full-minthamie.txt');
const resLiuLangZhe = await fetch('/inputs/day16/full-liulangzhe.txt');
const fullMinThamieFile = await resMinThamie.text();
const fullLiuLangzheFile = await resLiuLangZhe.text();
return {
example: this.parseInput(introFile),
full: this.parseInput(fullFile),
fullMinThaMie: this.parseInput(fullMinThamieFile),
fullLiuLangzhe: this.parseInput(fullLiuLangzheFile),
};
}
}
9 changes: 6 additions & 3 deletions app/routes/puzzles/17.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ export default class Puzzles17Route extends Route {
async model() {
const resIntro = await fetch('/inputs/day17/intro.txt');
const introFile = await resIntro.text();
const res = await fetch('/inputs/day17/full.txt');
const fullFile = await res.text();
const resMinThamie = await fetch('/inputs/day17/full-minthamie.txt');
const resLiuLangZhe = await fetch('/inputs/day17/full-liulangzhe.txt');
const fullMinThamieFile = await resMinThamie.text();
const fullLiuLangzheFile = await resLiuLangZhe.text();
return {
example: this.parseInput(introFile),
full: this.parseInput(fullFile),
fullMinThaMie: this.parseInput(fullMinThamieFile),
fullLiuLangzhe: this.parseInput(fullLiuLangzheFile),
};
}
}
9 changes: 6 additions & 3 deletions app/routes/puzzles/18.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ export default class Puzzles18Route extends Route {
async model() {
const resIntro = await fetch('/inputs/day18/intro.txt');
const introFile = await resIntro.text();
const res = await fetch('/inputs/day18/full.txt');
const fullFile = await res.text();
const resMinThamie = await fetch('/inputs/day18/full-minthamie.txt');
const resLiuLangZhe = await fetch('/inputs/day18/full-liulangzhe.txt');
const fullMinThamieFile = await resMinThamie.text();
const fullLiuLangzheFile = await resLiuLangZhe.text();
return {
example: this.parseInput(introFile),
full: this.parseInput(fullFile),
fullMinThaMie: this.parseInput(fullMinThamieFile),
fullLiuLangzhe: this.parseInput(fullLiuLangzheFile),
};
}
}
9 changes: 6 additions & 3 deletions app/routes/puzzles/19.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ export default class Puzzles19Route extends Route {
async model() {
const resIntro = await fetch('/inputs/day19/intro.txt');
const introFile = await resIntro.text();
const res = await fetch('/inputs/day19/full.txt');
const fullFile = await res.text();
const resMinThamie = await fetch('/inputs/day19/full-minthamie.txt');
const resLiuLangZhe = await fetch('/inputs/day19/full-liulangzhe.txt');
const fullMinThamieFile = await resMinThamie.text();
const fullLiuLangzheFile = await resLiuLangZhe.text();
return {
example: this.parseInput(introFile),
full: this.parseInput(fullFile),
fullMinThaMie: this.parseInput(fullMinThamieFile),
fullLiuLangzhe: this.parseInput(fullLiuLangzheFile),
};
}
}
9 changes: 6 additions & 3 deletions app/routes/puzzles/2.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ export default class Puzzles2Route extends Route {
async model() {
const resIntro = await fetch('/inputs/day2/intro.txt');
const introFile = await resIntro.text();
const res = await fetch('/inputs/day2/full.txt');
const fullFile = await res.text();
const resMinThamie = await fetch('/inputs/day2/full-minthamie.txt');
const resLiuLangZhe = await fetch('/inputs/day2/full-liulangzhe.txt');
const fullMinThamieFile = await resMinThamie.text();
const fullLiuLangzheFile = await resLiuLangZhe.text();
return {
example: this.parseInput(introFile),
full: this.parseInput(fullFile),
fullMinThaMie: this.parseInput(fullMinThamieFile),
fullLiuLangzhe: this.parseInput(fullLiuLangzheFile),
};
}
}
9 changes: 6 additions & 3 deletions app/routes/puzzles/20.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ export default class Puzzles20Route extends Route {
async model() {
const resIntro = await fetch('/inputs/day20/intro.txt');
const introFile = await resIntro.text();
const res = await fetch('/inputs/day20/full.txt');
const fullFile = await res.text();
const resMinThamie = await fetch('/inputs/day20/full-minthamie.txt');
const resLiuLangZhe = await fetch('/inputs/day20/full-liulangzhe.txt');
const fullMinThamieFile = await resMinThamie.text();
const fullLiuLangzheFile = await resLiuLangZhe.text();
return {
example: this.parseInput(introFile),
full: this.parseInput(fullFile),
fullMinThaMie: this.parseInput(fullMinThamieFile),
fullLiuLangzhe: this.parseInput(fullLiuLangzheFile),
};
}
}
9 changes: 6 additions & 3 deletions app/routes/puzzles/21.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ export default class Puzzles21Route extends Route {
async model() {
const resIntro = await fetch('/inputs/day21/intro.txt');
const introFile = await resIntro.text();
const res = await fetch('/inputs/day21/full.txt');
const fullFile = await res.text();
const resMinThamie = await fetch('/inputs/day21/full-minthamie.txt');
const resLiuLangZhe = await fetch('/inputs/day21/full-liulangzhe.txt');
const fullMinThamieFile = await resMinThamie.text();
const fullLiuLangzheFile = await resLiuLangZhe.text();
return {
example: this.parseInput(introFile),
full: this.parseInput(fullFile),
fullMinThaMie: this.parseInput(fullMinThamieFile),
fullLiuLangzhe: this.parseInput(fullLiuLangzheFile),
};
}
}
9 changes: 6 additions & 3 deletions app/routes/puzzles/22.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ export default class Puzzles22Route extends Route {
async model() {
const resIntro = await fetch('/inputs/day22/intro.txt');
const introFile = await resIntro.text();
const res = await fetch('/inputs/day22/full.txt');
const fullFile = await res.text();
const resMinThamie = await fetch('/inputs/day22/full-minthamie.txt');
const resLiuLangZhe = await fetch('/inputs/day22/full-liulangzhe.txt');
const fullMinThamieFile = await resMinThamie.text();
const fullLiuLangzheFile = await resLiuLangZhe.text();
return {
example: this.parseInput(introFile),
full: this.parseInput(fullFile),
fullMinThaMie: this.parseInput(fullMinThamieFile),
fullLiuLangzhe: this.parseInput(fullLiuLangzheFile),
};
}
}
9 changes: 6 additions & 3 deletions app/routes/puzzles/23.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ export default class Puzzles23Route extends Route {
async model() {
const resIntro = await fetch('/inputs/day23/intro.txt');
const introFile = await resIntro.text();
const res = await fetch('/inputs/day23/full.txt');
const fullFile = await res.text();
const resMinThamie = await fetch('/inputs/day23/full-minthamie.txt');
const resLiuLangZhe = await fetch('/inputs/day23/full-liulangzhe.txt');
const fullMinThamieFile = await resMinThamie.text();
const fullLiuLangzheFile = await resLiuLangZhe.text();
return {
example: this.parseInput(introFile),
full: this.parseInput(fullFile),
fullMinThaMie: this.parseInput(fullMinThamieFile),
fullLiuLangzhe: this.parseInput(fullLiuLangzheFile),
};
}
}
9 changes: 6 additions & 3 deletions app/routes/puzzles/24.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ export default class Puzzles24Route extends Route {
async model() {
const resIntro = await fetch('/inputs/day24/intro.txt');
const introFile = await resIntro.text();
const res = await fetch('/inputs/day24/full.txt');
const fullFile = await res.text();
const resMinThamie = await fetch('/inputs/day24/full-minthamie.txt');
const resLiuLangZhe = await fetch('/inputs/day24/full-liulangzhe.txt');
const fullMinThamieFile = await resMinThamie.text();
const fullLiuLangzheFile = await resLiuLangZhe.text();
return {
example: this.parseInput(introFile),
full: this.parseInput(fullFile),
fullMinThaMie: this.parseInput(fullMinThamieFile),
fullLiuLangzhe: this.parseInput(fullLiuLangzheFile),
};
}
}
9 changes: 6 additions & 3 deletions app/routes/puzzles/25.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ export default class Puzzles25Route extends Route {
async model() {
const resIntro = await fetch('/inputs/day25/intro.txt');
const introFile = await resIntro.text();
const res = await fetch('/inputs/day25/full.txt');
const fullFile = await res.text();
const resMinThamie = await fetch('/inputs/day25/full-minthamie.txt');
const resLiuLangZhe = await fetch('/inputs/day25/full-liulangzhe.txt');
const fullMinThamieFile = await resMinThamie.text();
const fullLiuLangzheFile = await resLiuLangZhe.text();
return {
example: this.parseInput(introFile),
full: this.parseInput(fullFile),
fullMinThaMie: this.parseInput(fullMinThamieFile),
fullLiuLangzhe: this.parseInput(fullLiuLangzheFile),
};
}
}
9 changes: 6 additions & 3 deletions app/routes/puzzles/3.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ export default class Puzzles3Route extends Route {
async model() {
const resIntro = await fetch('/inputs/day3/intro.txt');
const introFile = await resIntro.text();
const res = await fetch('/inputs/day3/full.txt');
const fullFile = await res.text();
const resMinThamie = await fetch('/inputs/day3/full-minthamie.txt');
const resLiuLangZhe = await fetch('/inputs/day3/full-liulangzhe.txt');
const fullMinThamieFile = await resMinThamie.text();
const fullLiuLangzheFile = await resLiuLangZhe.text();
return {
example: this.parseInput(introFile),
full: this.parseInput(fullFile),
fullMinThaMie: this.parseInput(fullMinThamieFile),
fullLiuLangzhe: this.parseInput(fullLiuLangzheFile),
};
}
}
9 changes: 6 additions & 3 deletions app/routes/puzzles/4.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ export default class Puzzles4Route extends Route {
async model() {
const resIntro = await fetch('/inputs/day4/intro.txt');
const introFile = await resIntro.text();
const res = await fetch('/inputs/day4/full.txt');
const fullFile = await res.text();
const resMinThamie = await fetch('/inputs/day4/full-minthamie.txt');
const resLiuLangZhe = await fetch('/inputs/day4/full-liulangzhe.txt');
const fullMinThamieFile = await resMinThamie.text();
const fullLiuLangzheFile = await resLiuLangZhe.text();
return {
example: this.parseInput(introFile),
full: this.parseInput(fullFile),
fullMinThaMie: this.parseInput(fullMinThamieFile),
fullLiuLangzhe: this.parseInput(fullLiuLangzheFile),
};
}
}
Loading

0 comments on commit 62ee42e

Please sign in to comment.