From 777a10c7343f97d5e3ed2ccf7c8f4d9a697a4d05 Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Sun, 24 Apr 2022 17:27:13 -0700 Subject: [PATCH] Add a best_game shortcode --- content/nethack/index.md | 33 ++++++++++++++++++++--- content/nethack/style.css | 7 ++--- layouts/shortcodes/nethack/best_game.html | 8 ++++++ layouts/shortcodes/nethack/logfile.html | 2 +- 4 files changed, 41 insertions(+), 9 deletions(-) create mode 100644 layouts/shortcodes/nethack/best_game.html diff --git a/content/nethack/index.md b/content/nethack/index.md index 3cf7238..14ba542 100644 --- a/content/nethack/index.md +++ b/content/nethack/index.md @@ -2,10 +2,37 @@ title: "Nethack" description: In which I play way too much of a silly command line Rogue-like game. date: 2022-04-13T08:43:46-07:00 -draft: true +draft: false type: simple --- -Herein is a chronological accounting of my descents into the Dungeons of Doom. +Every so often I get hooked on [this game][nethack]. It's a command line +Roguelike adventure game with rules based on Dungeons & Dragons. You play a +character on a mission for their deity to retrieve the Amulet of Yendor from an +evil Wizard and bring it back to the surface. The game gives you very little to +go on when you start, and it teaches you almost nothing except the basic +controls. Famously, almost every item you encounter or action you can take can +go wrong in some catastrophic way and cause + {{< abbr title="Yet Another Stupid Death" >}}YASD{{}}. +The more you play, the more you learn, and the more you begin to understand the +risks and consequences. -{{< nethack_table >}} \ No newline at end of file +In short: it's very hard, you die a lot, and it's quite easy to lose hours +delving deeper and deeper into the Dungeons of Doom, dying, and starting again. +It's also really fun. + +Here's my best game so far: + +{{< nethack/best_game >}} + +## A Game Log + +The game logs every play-through, along with a bunch of data about your +character and how you did. + +Herein is a chronological accounting of my last ten descents into the Dungeons +of Doom. + +{{< nethack/logfile >}} + +[nethack]: https://www.nethack.org \ No newline at end of file diff --git a/content/nethack/style.css b/content/nethack/style.css index e97ded0..d40bd62 100644 --- a/content/nethack/style.css +++ b/content/nethack/style.css @@ -10,13 +10,10 @@ ol.logfile { padding-inline-start: 0; } -.logentry { - background-color: var(--logentry-background-color); - color: var(--logentry-foreground-color); -} - .logentry { align-items: first baseline; + color: var(--logentry-foreground-color); + background-color: var(--logentry-background-color); border-radius: 6px; display: grid; grid-template-columns: 32px auto auto; diff --git a/layouts/shortcodes/nethack/best_game.html b/layouts/shortcodes/nethack/best_game.html new file mode 100644 index 0000000..a96084d --- /dev/null +++ b/layouts/shortcodes/nethack/best_game.html @@ -0,0 +1,8 @@ +{{ $nethack_data := $.Site.Data.nethack.logfile }} +{{ $logfile := slice }} +{{ range $nethack_data }} + {{ $logfile = $logfile | append .logfile }} +{{ end }} +
+ {{ partial "nethack/logentry.html" (index (sort $logfile "score" "desc") 0) }} +
\ No newline at end of file diff --git a/layouts/shortcodes/nethack/logfile.html b/layouts/shortcodes/nethack/logfile.html index 7fcc1a0..1a3e921 100644 --- a/layouts/shortcodes/nethack/logfile.html +++ b/layouts/shortcodes/nethack/logfile.html @@ -4,7 +4,7 @@ {{ $logfile = $logfile | append .logfile }} {{ end }}
    - {{ range sort $logfile "end_date" "desc" }} + {{ range first 10 (sort $logfile "end_date" "desc") }} {{ if ne .death.cause "quit" }}
  1. {{ partial "nethack/logentry.html" .}}