feat: finalize with step 5

This commit is contained in:
jonas committed 2026-09-03 23:39:25 +02:00
1 parent 129dd5d8b8
commit aab128b55c
10 files changed
+332 -37

No files matched your search

@@ -2,13 +2,23 @@ package westworldwithmessaging
import "fmt"
// entMinerBob and entElsa are our own stand-ins for the book's
// enumerated entity IDs (referenced as "ent_Miner_Bob" and "ent_Elsa"
// - presumably from an enum in a header we haven't been shown). Since
// this demo only ever has these two fixed characters, plain named
// constants do the same job: giving call sites a readable name
// instead of a bare number.
const (
entMinerBob = 1
entElsa = 2
)
// entityNames is a temporary stand-in for the book's real name
// lookup table. We still haven't been shown that table, so this is
// just a small map we're filling in by hand as we meet entities -
// the miner (ID 1) and now his wife Elsa (ID 2).
// just a small map we're filling in by hand as we meet entities.
var entityNames = map[int]string{
1: "Miner Bob",
2: "Elsa",
entMinerBob: "Miner Bob",
entElsa: "Elsa",
}
// GetNameOfEntity looks up a friendly name for a given entity ID.