Add a best_game shortcode

This commit is contained in:
Eryn Wells 2022-04-24 17:27:13 -07:00
parent 8fb0e09e1b
commit 777a10c734
4 changed files with 41 additions and 9 deletions

View file

@ -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{{</ abbr >}}.
The more you play, the more you learn, and the more you begin to understand the
risks and consequences.
{{< nethack_table >}}
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

View file

@ -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;

View file

@ -0,0 +1,8 @@
{{ $nethack_data := $.Site.Data.nethack.logfile }}
{{ $logfile := slice }}
{{ range $nethack_data }}
{{ $logfile = $logfile | append .logfile }}
{{ end }}
<div class="logentry">
{{ partial "nethack/logentry.html" (index (sort $logfile "score" "desc") 0) }}
</div>

View file

@ -4,7 +4,7 @@
{{ $logfile = $logfile | append .logfile }}
{{ end }}
<ol class="logfile">
{{ range sort $logfile "end_date" "desc" }}
{{ range first 10 (sort $logfile "end_date" "desc") }}
{{ if ne .death.cause "quit" }}
<li class="logentry">
{{ partial "nethack/logentry.html" .}}