Rename constructor to game.New(game.Params) per styleguide

NewGame(Config) becomes New(Params), and Restore takes Params too, so
the package's primary type gets the canonical New() constructor with a
named-field Params struct (styleguide points 139, 159). cmd/rogue and
all tests updated; ARCHITECTURE.md constructor references corrected.
Pure rename, suite green.
This commit is contained in:
2026-07-23 05:39:31 +07:00
parent 8241cf4bee
commit cd0ba6c8ee
10 changed files with 57 additions and 57 deletions

View File

@@ -10,7 +10,7 @@ import (
func TestRunScriptedSession(t *testing.T) {
tt := &testTerm{input: []byte("hjkl.i Qy")}
g := NewGame(Config{Seed: 99, Term: tt})
g := New(Params{Seed: 99, Term: tt})
err := g.Run()
if err != nil {
@@ -52,7 +52,7 @@ func TestRunManyTurns(t *testing.T) {
script = append(script, " Q y Qy"...)
tt := &testTerm{input: script}
g := NewGame(Config{Seed: 31337, Term: tt})
g := New(Params{Seed: 31337, Term: tt})
err := g.Run()
if err != nil {
@@ -68,7 +68,7 @@ func TestRunManyTurns(t *testing.T) {
// wizard style, then descends and keeps playing.
func TestRunDownStairs(t *testing.T) {
tt := &testTerm{input: []byte(">..Qy")}
g := NewGame(Config{Seed: 7, Term: tt})
g := New(Params{Seed: 7, Term: tt})
g.NewLevel()
g.Player.Pos = g.Level.Stairs // stand on the stairs
g.restored = true // keep Run from regenerating the level
@@ -99,7 +99,7 @@ func TestSaveCommandRoundTrip(t *testing.T) {
// 'S' with no default file name goes straight to the name prompt.
script := "S" + path + "\n"
tt := &testTerm{input: []byte(script)}
g := NewGame(Config{Seed: 55, Term: tt})
g := New(Params{Seed: 55, Term: tt})
g.FileName = "" // force the name prompt
@@ -108,7 +108,7 @@ func TestSaveCommandRoundTrip(t *testing.T) {
t.Fatalf("Run: %v", runErr)
}
h, err := Restore(path, Config{Term: &testTerm{}})
h, err := Restore(path, Params{Term: &testTerm{}})
if err != nil {
t.Fatalf("Restore: %v", err)
}