-
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update docs on Thu Dec 12 14:18:43 UTC 2024
- Loading branch information
0 parents
commit 95534b2
Showing
505 changed files
with
93,521 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,301 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png"> | ||
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png"> | ||
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png"> | ||
<link rel="manifest" href="/site.webmanifest"> | ||
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5"> | ||
<meta name="msapplication-TileColor" content="#da532c"> | ||
<meta name="theme-color" content="#ffffff"> | ||
<link href='https://fonts.googleapis.com/css?family=Noto Sans' rel='stylesheet'> | ||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/a11y-dark.min.css"> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script> | ||
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/languages/csharp.min.js"></script> | ||
<title>Advent of Code 2015/1 'Not Quite Lisp'' in C# by encse</title> | ||
|
||
<head> | ||
<meta property="og:title" content="Advent of Code 2015/1 'Not Quite Lisp' in C# by encse<"> | ||
<meta property="og:description" content="C# solution to the 'Not Quite Lisp' Advent of Code problem."> | ||
<meta property="og:image" content="https://aoc.csokavar.hu/2015/1//illustration.jpeg"> | ||
<meta property="og:url" content="https://aoc.csokavar.hu/2015/1/"> | ||
<meta property="og:type" content="website"> | ||
</head> | ||
|
||
|
||
<style> | ||
html { | ||
--theme-background-color: #2b2b2b; | ||
--theme-background-color2: #0d1117; | ||
} | ||
|
||
* { | ||
box-sizing: border-box; | ||
/* text is too big without these in my iphone */ | ||
-moz-text-size-adjust: none; | ||
-webkit-text-size-adjust: none; | ||
text-size-adjust: none; | ||
} | ||
|
||
@media (min-width:2000px) { | ||
html { | ||
font-size: 1.9em; | ||
} | ||
} | ||
|
||
a { | ||
color: inherit; | ||
} | ||
|
||
body { | ||
background: var(--theme-background-color); | ||
margin: 0; | ||
padding: 0; | ||
font-family: 'Noto Sans', 'Arial', sans-serif; | ||
color: white; | ||
} | ||
|
||
.main { | ||
width: 100ch; | ||
display: flex; | ||
flex-direction: column; | ||
padding: 1em; | ||
margin: 4em auto; | ||
} | ||
|
||
|
||
.header-container { | ||
display: flex; | ||
flex-direction: row; | ||
flex-wrap: wrap-reverse; | ||
justify-content: center; | ||
gap: 1em; | ||
overflow: hidden; | ||
position: relative; | ||
} | ||
|
||
.header-image { | ||
display: flex; | ||
min-width: 400px; | ||
position: relative; | ||
position: absolute; | ||
z-index: -1; | ||
top: 0; | ||
bottom: 0; | ||
left: 0; | ||
right: 0; | ||
} | ||
|
||
.header-image img { | ||
object-fit: cover; | ||
} | ||
|
||
.header-title { | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
justify-content: center; | ||
flex: 1; | ||
text-align: center; | ||
text-shadow: 0 0 1px rgba(0, 0, 0, 0.7); | ||
padding: 10em; | ||
background-image: radial-gradient(rgba(194, 194, 194, 0.13), rgba(195, 195, 195, 0.25)); | ||
} | ||
|
||
.header-title h2 { | ||
font-size: 400%; | ||
margin: 0; | ||
} | ||
|
||
.header-title p { | ||
font-size: 150%; | ||
} | ||
|
||
#top-nav, | ||
#bottom { | ||
background: var(--theme-background-color2); | ||
padding: 1em; | ||
} | ||
|
||
#year-picker select { | ||
border: none; | ||
background: inherit; | ||
font-size: inherit; | ||
color: inherit; | ||
-webkit-appearance: none; | ||
-moz-appearance: none; | ||
appearance: none; | ||
} | ||
|
||
#top-nav a, | ||
.header-container a { | ||
text-decoration: none; | ||
} | ||
|
||
#top-nav .current { | ||
color: var(--theme-background-color2); | ||
background: white; | ||
} | ||
|
||
#bottom { | ||
background: var(--theme-background-color2); | ||
display: flex; | ||
flex-wrap: wrap; | ||
gap: 2em; | ||
justify-content: center; | ||
} | ||
|
||
#top-nav { | ||
display: flex; | ||
} | ||
|
||
#top-nav select { | ||
margin-left: 1em; | ||
margin-right: 1em; | ||
} | ||
|
||
#day-picker { | ||
display: flex; | ||
flex-wrap: wrap; | ||
} | ||
|
||
#day-picker a { | ||
margin: 1em; | ||
} | ||
|
||
#code-container { | ||
overflow: auto; | ||
scroll-behavior: smooth; | ||
} | ||
|
||
.hljs { | ||
background: var(--theme-background-color2); | ||
} | ||
|
||
.hljs-ln-numbers { | ||
padding-right: 1em !important; | ||
text-align: right; | ||
} | ||
|
||
.content { | ||
line-height: 1.5; | ||
margin-top: 2em; | ||
/* hyphens: auto; */ | ||
} | ||
|
||
|
||
@media (max-width: 1024px) { | ||
.main { | ||
width: inherit; | ||
} | ||
|
||
.content { | ||
width: 100%; | ||
} | ||
|
||
#top-nav span, | ||
#top-nav select { | ||
padding: 0.25em; | ||
} | ||
|
||
.header-title h2 { | ||
font-size: 300%; | ||
} | ||
} | ||
|
||
@media (orientation: landscape) { | ||
main { | ||
width: 90%; | ||
} | ||
} | ||
</style> | ||
</head> | ||
|
||
<body lang="en-US"> | ||
<div id="top-nav"> | ||
<div id="year-picker"><select><option selected="selected" value="/2015/25/">2015</option><option value="/2016/25/">2016</option><option value="/2017/25/">2017</option><option value="/2018/25/">2018</option><option value="/2019/25/">2019</option><option value="/2020/25/">2020</option><option value="/2021/25/">2021</option><option value="/2022/25/">2022</option><option value="/2023/25/">2023</option><option value="/2024/12/">2024</option></select></div> | ||
<div id="day-picker"><span class="current"><a href="/2015/1">01</a></span><span><a href="/2015/2">02</a></span><span><a href="/2015/3">03</a></span><span><a href="/2015/4">04</a></span><span><a href="/2015/5">05</a></span><span><a href="/2015/6">06</a></span><span><a href="/2015/7">07</a></span><span><a href="/2015/8">08</a></span><span><a href="/2015/9">09</a></span><span><a href="/2015/10">10</a></span><span><a href="/2015/11">11</a></span><span><a href="/2015/12">12</a></span><span><a href="/2015/13">13</a></span><span><a href="/2015/14">14</a></span><span><a href="/2015/15">15</a></span><span><a href="/2015/16">16</a></span><span><a href="/2015/17">17</a></span><span><a href="/2015/18">18</a></span><span><a href="/2015/19">19</a></span><span><a href="/2015/20">20</a></span><span><a href="/2015/21">21</a></span><span><a href="/2015/22">22</a></span><span><a href="/2015/23">23</a></span><span><a href="/2015/24">24</a></span><span><a href="/2015/25">25</a></span></div> | ||
</div> | ||
<div class="main"> | ||
<div class="header-container"> | ||
<div class="header-image"> | ||
<img id="cover" width="100%" src="illustration.jpeg" /> | ||
</div> | ||
|
||
<div class="header-title"> | ||
<p class="text">Advent of Code</p> | ||
<h2 id="problem-id">2015/1</h2> | ||
<h2 id="problem-name">Not Quite Lisp</h2> | ||
<p class="text">in C#</p> | ||
<p class="text"></p> | ||
<p class="text"><em>by <a style="text-decoration: underline" | ||
href="https://github.com/sponsors/encse">encse</a></em></p> | ||
</div> | ||
|
||
</div> | ||
|
||
<div class="content"> | ||
<div id="notes"><p>Santa was hoping for a white Christmas, but his weather machine's "snow" function is powered by stars, and he's fresh out! To save Christmas, he needs you to collect <em>fifty stars</em> by December 25th.</p> | ||
<p>Collect stars by helping Santa solve puzzles. Two puzzles will be made available on each day in the Advent calendar; the second puzzle is unlocked when you complete the first. Each puzzle grants <em>one star</em>. Good luck!</p> | ||
<p>Read the <a href="https://adventofcode.com/2015/day/1">full puzzle</a>.</p> | ||
</div> | ||
<div id="code-container"><pre class="hljs language-csharp"><code>using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace AdventOfCode.Y2015.Day01; | ||
|
||
[ProblemName("Not Quite Lisp")] | ||
class Solution : Solver { | ||
|
||
public object PartOne(string input) => Levels(input).Last().level; | ||
|
||
public object PartTwo(string input) => Levels(input).First(p => p.level == -1).idx; | ||
|
||
IEnumerable<(int idx, int level)> Levels(string input){ | ||
var level = 0; | ||
for (var i = 0; i < input.Length; i++) { | ||
level += input[i] == '(' ? 1 : -1; | ||
yield return (i+1, level); | ||
} | ||
} | ||
} | ||
</code></pre></div> | ||
<div id="code-location"> <p>Please ☆ my <a href="https://github.com/encse/adventofcode/">repo</a> if you like it!</p></div> | ||
</div> | ||
|
||
</div> | ||
<div id="bottom"> | ||
<span>© <span id="currentYear"></span></span> | ||
<span><a href="https://adventofcode.com">Advent of Code</a> is a registered trademark in the US</span> | ||
<span>Images provided by <a href="https://www.bing.com/images/create">Bing</a> image creator</span> | ||
</div> | ||
|
||
<script> | ||
// This will automatically apply highlight.js to all <pre><code> blocks | ||
document.addEventListener('DOMContentLoaded', function () { | ||
|
||
let yearPicker = document.querySelector('#year-picker select') | ||
if (yearPicker) { | ||
yearPicker.addEventListener('change', function () { | ||
window.location = this.value; | ||
}); | ||
} | ||
|
||
// Automatically highlight all <code> blocks inside <pre> | ||
hljs.highlightAll(); | ||
}); | ||
</script> | ||
|
||
<script async src="https://www.googletagmanager.com/gtag/js?id=G-P8Y1BWSSF3"></script> | ||
<script> | ||
window.dataLayer = window.dataLayer || []; | ||
function gtag() { dataLayer.push(arguments); } | ||
gtag('js', new Date()); | ||
gtag('config', 'G-P8Y1BWSSF3'); | ||
</script> | ||
</body> | ||
|
||
</html> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.