MyPy and Dict-Like get() Methods

Last updated:

I'm hacking on something for my `kdl-py` project, and realized I wanted a .get() method to retrieve child nodes by name, similar to a dict. I had some trouble working out how to set it up to type properly in MyPy, so here's a short summary of my results, which I'm quite happy with now.

(Disclaimer: while working on this, I was laboring under the misapprehension that dict.get("foo") raised an exception if "foo" wasn't in the dict, but that's only the behavior for dict["foo"]! dict.get("foo") will instead always return the default value if the key is missing, which just defaults to None, which is a much simpler behavior, ugh.)

So, the problem I was having is that I wanted an optional argument (the default value, to be returned if the node name couldn't be found), and I wanted to tell whether that argument was passed at all. Any value is valid for the default, so I can't rely on a standard sentinel value, like None.

One way to do this is with kwargs shenanigans (leaving the argument out of the arglist, using a **kwargs arg instead, and just checking if it shows up in there), but that's awkward at the best of times, and doesn't let you typecheck well (can't indicate that the call might return the default value, type-wise).

The usual way to do this in JS, which doesn't have a kwargs equivalent, is instead to set the default value to some unique object value that's not exposed to the outside, and see if it's still equal to that value. Since the outside world doesn't have access to that value, you can be sure that if you see it, the argument wasn't passed at all.

This is how I ended up going. Here's the final code:

import typing as t

class _MISSING:
  pass

T = t.TypeVar('T')

class NodeList:
  @t.overload
  def get(self, key: str) -> Node:
    ...

  @t.overload
  def get(
    self, 
    key: str, 
    default: t.Union[T, _MISSING] = _MISSING(),
  ) -> t.Union[Node, T]:
    ...

  def get(
    self,
    key: str,
    default: t.Union[T, _MISSING] = _MISSING(),
  ) -> t.Union[Node, T]:
    if self.data.has(key):
      return self.data.get(key)
    if isinstance(default, _MISSING):
      raise KeyError(f"No node with name '{key}' found.")
    else:
      return default

Boom, there you go. Now if you call nl.get("foo"), the return type is definitely Node, so you don't have to do a None check to satisfy MyPy (it'll just throw if you screw up), but it'll correctly type as "Node or whatever your default is" when you do pass a default value.

Cultist Simulator Starting Hints (Spoiler-free and -lite!)

Last updated:

Cultist Simulator is one of my favorite games (on desktops, and now on Switch as well!), but the early game can be a bit... unfriendly to beginners. The UI is intentionally a bit sparse, lending the "tarot" aspect to it, but that can make it confusing to navigate until you learn your way around.

Here's some beginner tips to get you started; initially spoiler-free, and later (clearly marked) spoiler-lite.

Spoiler-free Starter Tips

  • Experiment, experiment, experiment. Often the thing you're missing is just combining a card with a verb you didn't realize would go with it. Try things out!
  • Read, read, read. Read every card. Read every verb result. Don't neglect the little aspect boxes at the bottom of cards and active verbs, they give important information!
  • Related to both of the above: Click on a card; it'll briefly highlight what verbs it could go in. Click on a verb's slot; it'll briefly highlight all the cards that can go in it. You might be surprised what you can do!
  • Even a card that "doesn't do anything" in a given verb might give useful information when you slot it in anyway. Read, experiment, read, experiment.
  • Pause constantly. Pause any time a verb finishes, so you can read the results in peace and figure out your next move.
  • The various bits of story you get out of books (clicking on the book initially; reading the verb summary when you first put it in; and reading the verb result after you finish reading it) often have hints about advanced topics. Take notes when something sounds significant, particularly if it sounds like the author might be talking about using a particular aspect for something.
  • Level up your core aspects (Health, Reason, Passion) at least a little bit; it's pretty easy to gain the first few levels and it'll make things a lot less fraught.
  • The primary grind you have to deal with is keeping yourself solvent (easy after a bit), and keeping yourself from accumulating Dread or Fascination when the bad Seasons come up. Figuring out how to manage those is key to reaching the end-game.
  • Speaking of Seasons, read the Time Passes verb. The little icon in the corner tells you what season's coming up, so you have 60 seconds to prepare for it if it's gonna be bad. The progression of seasons is the primary RNG in the game, and staying on top of them is vital for avoiding problems.
  • If you're playing on Switch, use the Up d-pad button! You default to only seeing your "permanent" verbs; all your "temporary" verbs spawned as a result of a Season or various actions go in a separate pane that Up switches to! If you don't check this regularly you will absolutely die.

Spoiler-lite Starter Tips

Here I'll give some tips that technically skip a tiny bit of learning, but only the tiniest bit, and are really important for getting the ball rolling.

  • Whatever your starting scenario, use all your initial cards, and the results of using those cards, until you get all five of your basic Action Verbs (Work/Study/Talk/Dream/Explore).

  • Right away, Work your Health to get Vitality, and turn the first two you get into the Strength skill. Then keep working and studying those vitalities until you get it upgraded to level 2. With luck you've avoided getting injured so far (if not, Dream the injury with a vitality to get the health back); at level 2, the Strength skill has a 0% chance of injury. This is a dependable skill for keeping your money supply steady in the early game. It's easy to use your steady Vitality gain to level up to 3 as well. (Save the last level for a bit, see below.)

  • Once that's up, Study your Reason and Passion to get Erudition/Glimmer and use those to level up your stats as well. Getting each new skill to level 2 is easy and quick. Leveling to 3 is harder until you find Essay/Poetry books or find Sulochana.

  • In the meantime, Talk to your one follower to establish your cult. Then Talk with lore to start gathering cult followers. Don't worry about the Mystique; as long as you don't actually do crimes it's harmless. Getting a large following is vital, and the earlier you do it the better.

  • Similarly, Explore with your followers until you get all three of the starting locations. Whenever you have spare money, spend it at the bookstore until it's empty, then hit the Auction house until it's empty as well. Study all those books for your starting lores and languages.

  • Dream your way into the Mansus by using Passion, then try out lores until you find one that gives a promising message in the verb. (Read, read, read!) Getting into the Mansus is the primary way to find Secret History lore, which is how you Explore for more lores and items after the bookstore/auction is emptied out. Other than that, the Mansus is 50% influences by weight, plus some moods and a few ~secrets~. Take notes on what you get from each location, so you know where to return to when you need something in particular later. You'll get further into the Mansus with higher-level lores.

  • Explore with a Secret Histories lore to get a location, then explore that location. It'll cost some money, so make sure you've got the scratch. Once the minimum requirements are met the verb summary will give vague hints about what's in store; once the exploration has started and gotten past the first 10s cycle, read the little icons on the verb to see exactly what you'll face and how to defeat it. Add followers with the right aspects when you get the chance (you can add two things, followers or money, between each obstacle); >=1 gives you a small success chance, >=5 gives you moderate success chance, >=10 gives you large success chance (but never 100%). Note that this is a score in one relevant lore; sending 5 Knock and 5 Lantern against a Secret Door obstacle just results in a moderate success chance as it picks one lore to use. You can see your combined lore totals at the bottom of the verb.

    If you're scared about what might come up, you can always just send a hireling with a single Funds to scout the location first, so you can figure out who to actually send for a successful run. (Tho beware of Curses this way.) The obstacles will be the same every time.

  • Having trouble with influences or hirelings timing out before you can use them? Talk about them with someone! While a card is sitting in a slot, its timer doesn't go down. Sulochana, a Patron, is particularly useful for this, as she'll Talk about literally anything for a minute. If you have a pair of hirelings or spirits, have them talk to each other. Use Sulochana to get your Reason/Passion to level 3 or 4, as she can keep your first Lessons Learned alive long enough to use.

  • Talking does not prevent a card from getting grabbed by a "magnet" slot; it only loosely holds them. However, many actions do effectively "hide" cards from magnets (anything that you can't immediately retrieve the card from), and can save your ass in a tight spot. Painting with your Creativity skill is a great way to hide pesky Notoriety when the detective season is coming up, for example.

  • Talk to your cultists about your Cult to get them to do "cult business". Each cultist type (depending on their aspect) has a different type of business they can do, and several are very important. Experiment!

  • Maxing out your skills (level 4) requires a lore. Try out the different lores, as only some have an effect, and there are different possibilities. Each choice helps in different ways later in the game.

  • Dealing with Dread is simple - Dream with Funds to gain Contentment; you can then either Dream the Dread and Contentment together to get rid of it preemptively, or let the Season Of Dread grab one of each and cancel itself out. Occasionally you'll get sick from this; that's fine, just work your Strength to get some vitality to treat it. Still cheap and easy.

  • Dealing with Fascination is harder - Dream with Dread or Fleeting Reminiscence. There are several ways to grab those; sacrificing a Health (or letting an Injury linger until it expires) to get a Decrepitude, which you can Work to give you a high chance of Dread, is the most reliable, but Mansus runs (especially White Door) are pretty good too.

  • Another easy way to deal with either of these is to realize that they count as Influences. (Read their cards! It's right at the bottom!) This means you can use them in cult promotions or in Rituals (at least, ones that consume influence). Use them even if you don't need 'em, they'll still get used up! You can also, if the correct "real" influence is sitting around, subvert them to level up the "real" influence with Study. Restlessness, which decays into Dread, is a particularly useful mood for this, as it has 2 points each of five different aspects. It's great for summoning.

  • Rites are all the same; you can cast any spell with any rite. The only difference is in what they consume: every rite takes a Lore and two more ingredients chosen from {person, tool, ingredient, influence}, and consumes one of the things you put in. The rites you get from the Auction House are gonna be your main ones for the whole game, as they consume Influences (you know, those things that decay anyway), but the other rites can be useful in different circumstances.

    (Oh, and remember to click on the "Projector" slot when you're Studying STUMM!. It doesn't require what you probably think it requires.)

  • The most important thing you can do with Rites is summoning spirits; for this you'll always need Knock (as the help text states). The other rituals have some value, but mostly you'll be summoning. Play around with aspects and read (!) the help text to figure out how you can summon spirits; I recommend writing down your results on what aspect are needed, and how much, and where to easily get those aspects, so you're not frantically slamming things together when you realize you need a particular spirit.

    Note that most spirits already have the non-Knock aspects you need to summon them, so they can be used to summon more of themselves with an easy Sunset Rite when you need an army, or at least a spare so you can send the first one off to do something risky. (And don't forget, this means you'll have the Influence slot free in Sunset Rite to dispose of a pesky mood, if necessary.)

    If a spirit gets frisky during summoning, unless it's absolutely vital you get the spirit, just dismiss it with Reason. It's 100% reliable and safe, and you can just try again later. Using Passion to force the summoning is risky.

  • Once your Vitality is maxed, Working with Reason will get you an office job. It's another reliable way to keep yourself fed, but won't gain you much money; basically its profit is just slightly higher per second than working a high-level Strength, but it takes twice as long so there's less micro. If you get the good promotion it actually can be a reliable income source for a while, but it will eventually get in your way, as you can't take the necessary time off to do rituals and write essays. Still, it's a reliable way to get you into the midgame.

  • The midgame starts when you're finally Exploring locations, have a good set of cultists, and have collected all your Patrons. Once you can start taking Patron commissions (and have the lore to reliably complete them), you can finally quit your job, as occasionally auctioning off the rewards from commissions will make you far more money. Build up lore, accumulate items, make your cult strong.

  • Eventually you'll have enough ~stuff~ to feel like entering the endgame. Play around with your Temptation; the game will give you hints about how to proceed. Figuring out how to actually complete the game is part of the fun. There are six major "good" endings in the base game (three "base" and three NG+), several more in the DLCs, and the Exile DLC is almost an entirely new game. There's also a score of minor endings, both good and bad, which will earn you Steam Achievements, so don't feel bad about dying. It's Fun!

Filling the Combat Magic Gap: Arcane Weapons

Last updated:

D&D 5e establishes a pretty decent divide between physical and magic combatants. In particular, their core damage mechanic is split in two: physical attackers use weapons to deal damage, magical attackers use cantrips (and spells) to deal damage.

This leaves an underserved demographic in the gap: characters that want to be primarily physical (taking one of the physical-oriented classes, like Fighter or Rogue) but with a mystical twist to how they attack, slinging fire or whatnot. A few cantrips kinda serve this: Shillelagh does the opposite, kinda, letting a mage class use a physical weapon with their casting stat; the "bladetrips" are bit closer to this, but they're still cantrips, not weapons, and so can't be used with features like Sneak Attack or Rage, and are balanced on the cantrip scale (increasing at levels 5/11/17).

So, let's define something that actually works!

Arcane Weapons

Arcane Weapons are a new class of weapons that deal damage thru magic. These can take many forms, from rune-inscribed blades to magic wands to arcane blasters.

Rather than listing an explicit and limited set of Arcane weapons, Arcane weapons can be produced by starting from any Martial weapon's stats, and choosing a magical damage type to use for it instead, making appropriate modifications based on the damage type. The GM and player should then work together to decide on the actual physical form of the weapon.

  • If you choose Magical Slashing, Magical Bludgeoning, Magical Piercing, or Poison, the damage is unchanged.
  • If you choose Fire, Ice, Lightning, or Acid, the damage is reduced by one step.
  • If you choose Radiant, Necrotic, Psychic, Thunder, or Force, the damage is reduced by two steps.

Damage "steps" are: (1d12 or 2d6) => 1d10 => (1d8 or 2d4) => 1d6 => 1d4 => 1 => 1 => .... If you move to a step with a choice of damage dice, you can choose either option.

Alternately, one can start from a Simple weapon, and ignore one damage reduction step. For example, a Needler Wand produced from Light Crossbow stats (1d8 damage) switched to ice damage would still deal 1d8 damage on hit, but switched to radiant would deal 1d6 damage on hit. (This does not make the Arcane weapon a Simple weapon, it just expands the variety of weapon stats one can use, particular in ranged weapons.)

Wielding an Arcane weapon uses all the same rules as the corresponding weapon it's based on. For example, if you start from Greatsword stats to produce an Immolation Staff that deals fire damage, it's still a Two-handed Heavy Melee weapon, that happens to deal 1d10 fire damage on hit instead of 2d6 slashing. As another example, if you start from Light Crossbow stats to produce a Needler Wand that deals ice damage, it's still a Two-handed Loading Ranged weapon with an 80/320 range, that happens to deal 1d8 ice damage instead of 1d8 piercing.

Abilities that depend on or otherwise reference Martial weapons can also be used with Arcane weapons based off the specified weapon types. For example, Monks can choose any Arcane weapon they have proficiency in as one of their monk weapons.

However, no character has proficiency with Arcane weapons by default; they can gain proficiency in various methods, as described below.

Arcane Weapon Proficiency

Arcane weapons require special proficiency to use. Without this proficiency, an Arcane weapon can't be used at all; it's simply a magical stick or what-have-you.

Whenever a source would grant a player proficiency with one or more martial weapons (such as the first level of most martial classes, or some heritage choices such as Elf) you may choose to instead gain proficiency in Arcane weapons using the stats of any of those weapons. This is an all-or-nothing choice; all of the gained Martial weapon proficiencies are switched over to Arcane equivalents, or none are.

That is, a class that grants proficiency with all Martial weapons, like a Fighter, can instead choose to gain proficiency with all Arcane weapons based on Martial weapon stats. A class with limited proficiencies, like the Monk who receives only shortsword proficiency, can instead choose to gain proficiency with Arcane weapons based on shortsword stats.

(A player could use multiclassing to easily get both Martial and Arcane proficiencies, such as taking a level of Fighter and a level of Barbarian, if they so chose.)

Any class that gains cantrips can choose to replace one known cantrip with proficiency in all Arcane weapons instead.

Unarmed strikes do not have an Arcane equivalent in general, but Monks and similar classes that can make their unarmed strikes magical have additional options; see below for details.

The Weapon Master feat can, as any of your four chosen proficiencies, instead grant proficiency with Arcane weapons based off the chosen weapon's stats.

If you're proficient in at least one Arcane weapon, or can cast at least one spell, you're automatically proficient in all Arcane weapons based off of Simple weapons you're proficient in, as well.

When you gain proficiency with at least one Arcane weapon, choose a magical damage type to be your primary damage type. Whenever you attack with an Arcane weapon, you may choose to have it deal your primary damage type instead of whatever damage type it would normally deal, applying the same modifications to the base weapon's damage dice that you would if designing the weapon from scratch.

As well, when you gain proficiency with at least one Arcane weapon, if you don't already have a spellcasting ability from another source, choose Int, Wis, or Cha as your spellcasting ability. Whenever you attack with an Arcane weapon, you may choose to use your spellcasting ability instead of Str/Dex for attack and damage rolls using the weapon.

For example, if a character chooses Int and Psychic as their casting stat and primary damage type, then wields the Immolation Staff described above (greatsword switched to fire damage), they can choose to add either their Str or Int to attack and damage, and can choose to deal either 1d10 fire damage or 1d8 psychic damage on a hit.

If the same character wielded the Needler Wand (light crossbow switched to Ice damage), they can choose to add either their Dex or Int to attack and damage, and can choose to deal either 1d8 ice damage or 1d6 psychic damage on a hit.

Arcane Unarmed Strikes

Replace the Monk's 6th level Ki-Empowered Strikes ability with:

You gain the ability to make your unarmed strikes into Arcane Strikes. If you do not already have a spellcasting ability and/or an Arcane primary damage type, choose them as if you have just gained proficiency in an Arcane weapon.

Any time you make an unarmed strike, or attack with a monk weapon and replace its damage with your unarmed strike damage, you can choose to use your spellcasting ability instead of Str or Dex, and you can choose to replace its damage type with your Arcane primary damage type. If your chosen Arcane primary damage type would normally reduce a Martial weapon's damage die by two steps, your unarmed strike damage is reduced by one step when you replace its damage type (it is otherwise unaltered).

Your unarmed strike now counts as an Arcane weapon (for the purpose of applying Fighting Styles/etc).

For example, a Monk could choose Wis and Fire for their unarmed strike, allowing them to add their Str, Dex, or Wis to attack and damage for unarmed strikes, and deal Bludgeoning or Fire damage equal to their normal unarmed strike damage. If they are wielding a monk weapon and choose to replace its damage with their unarmed strike damage, they can also switch its damage type to Fire.

If they instead chose Radiant for their damage type, they can still freely add their Str, Dex, or Wis to their attacks, and can choose to either deal their ordinary amount of Bludgeoning damage, or deal Radiant damage reduced by one step.

If the Fire Monk from above wields a Radiant arcane weapon that they've chosen as a monk weapon, they can choose to have it deal Radiant or Fire damage, and its damage is not reduced in either case.

Arcane Fighting Styles

These additional fighting styles are available to any class, and all require that you have proficiency with at least one Arcane weapon.

  • Arcane Fire Style: Whenever you wield an Arcane weapon dealing fire damage, increase the damage die by one step.
  • Arcane Ice Style: Whenever you hit an opponent with an Arcane weapon dealing ice damage, their speed is reduced by 10ft until the start of your next turn unless they're immune to ice damage. This effect only applies once per opponent; it does not stack if an opponent is hit multiple times.
  • Arcane Acid Style: Whenever you hit an opponent with an Arcane weapon dealing acid damage, you may deal the weapon's base damage to another target within 5ft of the original target.
  • Arcane Lightning Style: Whenever you hit an opponent with an Arcane weapon dealing lightning damage, you may spend your reaction to deal additional lightning damage equal to the weapon's base damage.
  • Arcane Poison Style: Whenever you hit an opponent with an Arcane weapon dealing poison damage, they have disadvantage on the next saving throw they make before the start of your next turn unless they're immune to poison damage or the poisoned condition.
  • Arcane Radiant Style: Whenever you wield an Arcane weapon dealing radiant damage, your attacks with that weapon ignore half cover and three-quarters cover.
  • Arcane Necrotic Style: Whenever you hit an opponent with an Arcane weapon dealing necrotic damage, increase the damage die by two steps if the opponent is missing any of its hit points.
  • Arcane Psychic Style: Whenever you hit an opponent with an Arcane weapon dealing psychic damage, they have disadvantage on the next attack roll they make before the start of your next turn unless they are immune to psychic damage.
  • Arcane Thunder Style: Whenever you hit an opponent with an Arcane weapon dealing thunder damage, you may deal the weapon's base damage to every target within 5ft of the opponent besides you, but your attack makes a thunderous noise that can be heard up to 100ft away.
  • Arcane Force Style: Whenever you hit an opponent with an Arcane weapon dealing force damage, you may choose to push them 10ft away from you in a straight line unless they are immune to force damage.

Arcane Weapon Strike

While arcane weapons interact well with martial classes' Extra Attack features, they don't compare well with cantrips for spellcaster classes that never get extra attacks. Green Flame Blade and similar bladetrips let casters flip a weapon into cantrip scaling, so let's run on that same principle:

  • Arcane Weapon Strike

  • Evocation cantrip

  • Casting Time: 1 action

  • Range: Self (5-foot radius)

  • Components: S, M (an arcane weapon worth at least 1 sp)

  • Duration: Instantaneous

  • You brandish the arcane weapon used in the spell's casting and make an attack with it as normal. On a hit, the target suffers the weapon attack's normal effects, and your magic flares thru the weapon to strike another target you can see within 5 feet of the original target. The second creature takes damage equal to your spellcasting ability modifier, and of the same type as the arcane weapon.

    This spell's damage increases when you reach certain levels. At 5th level, the damage to both targets increases by 1d10/1d8/1d6 (depending on arcane damage type) for melee attacks, or 1d8/1d6/1d4 for ranged attacks. They increase by another die at 11th and 17th level.

Hades Rareboon Run

Last updated:

I love the game Hades (GOTY 2020), and I hit the epilogue last year, at the end of November. I put it down for a little bit, since it was then my wife's turn to play in the evenings (we switch off playing single-player games with each other), and intended to pick it back up on my own to finish out the last few bits of completion I had left. Of course, I then didn't do it.

But yesterday, my friend Manish (@manishearth) posted about doing a gimmick run with his friend Jane, where you are forced to pick up as many and as high-quality boons as possible. (They got this from @Duunko who termed it Shiny Boon Run, but I like the alliteration of my term.)

I thought it would be a fun challenge to jump back onto the Hades saddle, so I did one today (and escaped! yay!). I had to ping Manish several times for clarifications on the run rules, so I thought I'd write them down more formally, in case anyone else wants to do Rareboon Runs:

Rareboon Run Rules

The general policy underlying these rules is to collect as many boons as possible, of as high a quality as possible, to show just how much Olympus loves you and how good a boi you are.

  1. Whenever you're given a boon choice, you must choose the rarest boon you can: Legendary > Duo > Heroic > Epic > Rare > Common.

    • If there are multiple boons of the highest rarity, you must choose randomly. Alternately, if someone is watching with you, have them choose the one that's the most lulz.
    • If you have boon rerolls, you can only reroll when there are multiple highest rarities.
    • This includes primary-boon replacements! If they're the highest rarity (and they usually will be) you must choose them!
    • If you're choosing from Chaos's boons, you must choose a Favor boon if possible. Otherwise it follows the standard highest-rarity rules.
  2. Whenever you're given a door choice, you must choose the most boon-ific door: Trials > Shop (if you have at least 300 gold) > Challenge Boon > Chaos == Shop (if you have at least 150 gold) == Boon > everything else.

    • Again, if there are multiple best choices, choose randomly or have someone choose for you. Or reroll a door, if you have door rerolls.
    • In Styx, you must complete all boon hallways, even if you find the fountain before you're done with them. You can do them in whatever order you want, tho. If there are still boons in the Styx shop after this, you must continue doing hallways until you're either done with hallways or done buying boons.
    • Note that "everything else" includes hammers :(. If you get unlucky with hammers being paired with boon doors, shops will sometimes offer hammers if you're behind, as can Styx hallways. However, you are free to choose whatever hammer ability is best for you, as this run can be hard enough as it is without saddling you with a random-ass hammer ability. Or choose randomly if you want the challenge.
  3. If you're in a shop, you must buy as many boons as possible. In Styx, this applies after every hallway clear. You can spend money on whatever you want beyond that (even if it would reduce your gold to below 150 before a shop room). If you don't have enough money to buy all of them, choose randomly or have someone choose for you.

  4. You must check Pools when they come up. If they offer the "your next boon is increased rarity" choice, you must buy it if possible. (You can buy the others if you want.)

  5. If you get Sisyphus's room, you must give Bouldy a Nectar if possible. If you get Eurydice's room, you must choose the "next 3 boons are of increased rarity" benefit.

  6. You cannot purge boons. Every boon is precious.

Use whatever weapon/form/companion/keepsakes/mirror/punishments you want. We're a self-imposed challenge, not a cop.

Try It Out!

The end result usually isn't that bad, and the enforced variety keeps you from falling into a rut. It was pretty fun, and I might do more!

A Better Temperature System

Last updated:

Yes, it's time for another installment of "Tab gives a utopian vision of an alternate today where people knew better in the past about some minor topic". Today we're talking about temperature.

What's Wrong With Temperature?

There's a lot wrong with temperature, unfortunately. The metric system uses Kelvins to measure temp. Kelvins are defined as "the same degree size as Celsius, but 0 is absolute zero". This has some issues:

  • having the scale's zero be a meaningful zero, so that doubling the number actually corresponds to doubling some physical quantity - is good
  • but having that zero be very far away from human-meaningful quantities, particularly the two primary things humans use temperature for on a regular basis (outside temp and body temp) is really inconvenient
  • the Celsius zero and the Kelvin zero are not a round, or even whole, number of degrees apart, so interconverting involves an awkward "273.16" factor.

A lot of this comes from the fact that we invented temperature scales long before we realized that temperature even had a physically-meaningful zero. Instead, Celsius just tied its 0 and 100 to measurable, somewhat-meaningful values for humans: the freezing and boiling point of water. The resulting delta from the "real" zero, and the size of the degree, thus have no particular reason to be convenient or "round", and yeah, they're really not.

We can do better!

But What About Fahrenheit?

Yeah, what about Fahrenheit? It's not SI, but it is still metric (base-10), and I think it has some very nice qualities as well (plus some pretty bad ones).

Obvious bad thing is that its 0/100 points are meaningless; 0°F is the freezing point of saturated salt water (which, tbf, was easier to obtain than purified water, and so a more reliable liquid for gauge calibration) and, uh, for some reason 100°F is based on him setting human body temperature to 96°F? So 100 wasn't even meaningful from the start??? Nowadays of course we use the same freezing/boiling point of water definition, which gives us the convenient 32/212 pair, how nice.

Fahrenheit actually has some great qualities, tho. While the freezing point is pretty rando, it does at least mean that the 0 point is roughly as cold as it gets in temperate parts of the world. (And measuring subzero is basically just for fun anyway; below that it's all "lethally cold" and the precise number doesn't matter anyway.) Similarly, 100 is roughly as hot as it gets in temperate parts of the world. This means that outside temps range nicely over the 0-100 range (vs the roughly -15 to 45 range for Celsius).

As well, the degree size is, in my opinion, a bit better. Ten degrees Fahrenheit is more or less the minimum temperature difference that makes a difference for how you dress and respond to the weather - you'll feel 70 and 80 as different and respond accordingly, but 70 and 75 are too close to care about the difference. (Celsius's similar bands are 5 degrees apart, which is kinda round but not as good.)

So Fahrenheit gives us a meaningful 0-100 range for our daily temperature usage, and has meaningful 10-degree bands as well. That's really nice! Sure would've been good to keep that around.

Let's Get It Right

Just to get one difficulty out of the way, we can't make a temperature system that's both human-meaningful for small numbers, and useful for physics. The two desired zero points (deep space vs frozen water) are too far apart.

What we can do, tho, is make it so that converting between the "human" and "absolute" scales is as easy as possible, so the two zeros are a whole, round number of degrees apart.

Taking all the above into account, I present to you the Degrees Temp (°T), or Absolute Temp (°AT) system, an ideal system that combines the best parts of everything:

Degrees Temp, the human-usable system, is defined by the freezing point of water at 20°, and absolute zero at -500°. °AT is just °T + 500.

The freezing point of water is not 0, but it is a round, easily-memorized and easily-recognized number. 0°T, instead, is a sub-freezing temp that is, again, roughly "as cold as a temperate climate gets", similar to Fahrenheit. Also similar, 100°T is roughly as hot as a temperate climate gets.

(Converted back into existing units, 0°T is 14°F/-10°C, and 100°T is 107°F/42°C.)

By a lucky coincidence, average human body temp is 90°T, another convenient number. (Compare to 37°C or 98.6°F, both awful.)

Not that it usually matters in reality, but the boiling point of water is 210°T, yet another convenient number. I'm not imposing excess rounding here to make it look good, either: 100°C really is 210.4°T!

Swapping between human- and physics-friendly versions of the unit is also, as I mentioned earlier, trivial in this system, you just add or subtract 500° from the temperature. A far cry from 273.15°! (Or the equally horrible 459.67 for converting between Fahrenheit and Rankine.)

(If you want to convert more temps, the conversion factor between °AT and K is .5253. To convert from °C to K, add 273.16; to convert from °AT to °T, subtract 500.)

Here's a quick table with some convenient numbers:

°T°F°CK
0°T13°F-10°C263K
10°T22°F-5°C268K
20°T (water freezes)32°F0°C273K
30°T41°F5°C278K
40°T50°F11°C284K
50°T60°F16°C289K
60°T70°F21°C294K
70°T79°F26°C299K
80°T89°F32°C305K
90°T (body temp)98°F37°C310K
100°T108°F42°C315K
210°T (water boils)212°F100°C373K

Bonus: What About Heximal?

Real Tab-heads know that base-6 is the best base for numbers to be, substantially better than base-10. This temperature scale seems pretty well-tailored to base-10, with a great 0-100 range and a round absolute zero. Can it be adapted to base-6 while maintaining its good properties?

Yes! It's not perfect, but it's slightly better in some ways, slightly worse in other ways, and overall fairly similar.

Short form: Absolute zero is now at -1000₆°T, and water freezes at 10₆°T. The rest of the system extends from that.

This means that 0₆°T is equal to about -7°C, or 19°F, slightly higher than the decimal version, and 100₆°T is equal to... 37°C or 98.4°F! That's body temperature, baby! That was a very common calibration target for older temperature scales, and is just a fun number to have at such a round value.

It does mean that the range overall is a bit narrower; negative and >100₆°T temperatures will show up more often. They'll be "very cold" and "very hot" temps, but not "hoo boy these never happen" temps, like in the decimal version. But that's okay! Realistically, readouts will have to be able to display these values anyway, so it's not a huge loss. The vast majority of outdoor temperatures you encounter will continue to be in the 0-100₆ range.

Bonus points for the fact that "room temperature" (72°F/22°C) is a nice round 40₆°T. How nice!

(You can see me working thru the logic here at https://twitter.com/tabatkins/status/1308226259374149633.)

Some Conversion Code For Nerds

If you wanna play with this system a bit, here's some JS for converting between it and C/F/K:

Decimal version:

function atFromK(degK) { return degK / 273.16 * 520; }
function kFromAT(degAT) { return degAT / 520 * 273.16; }
function tFromC(degC) { return atFromK(degC + 273.16) - 500; }
function cFromT(degT) { return kFromAT(degT + 500) - 273.16; }
function fFromT(degT) { return cFromT(degT) * 9/5 + 32; }
function tFromF(degF) { return tFromC((degF - 32) * 5/9); }

Heximal version:

function atFromK(degK) { return degK / 273.16 * 226; }
function kFromAT(degAT) { return degAT / 226 * 273.16; }
function tFromC(degC) { return atFromK(degC + 273.16) - 216; }
function cFromT(degT) { return kFromAT(degT + 216) - 273.16; }
function fFromT(degT) { return cFromT(degT) * 9/5 + 32; }
function tFromF(degF) { return tFromC((degF - 32) * 5/9); }

(You'll want to call .toString(6) on the heximal results, and/or use parseInt(X, 6) on the heximal inputs, of course. Like fFromT(parseInt("100", 6)) or tFromC(0).toString(6).)