package westworld import "fmt" // 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 - // right now that's only the miner from main.go, whose ID is 1. var entityNames = map[int]string{ 1: "Miner Bob", } // GetNameOfEntity looks up a friendly name for a given entity ID. // Anything not in entityNames falls back to printing the raw ID. func GetNameOfEntity(id int) string { if name, ok := entityNames[id]; ok { return name } return fmt.Sprintf("Entity %d", id) }