import "github.com/yuta-yoshinaga/go_trumpcards/internal/infrastructure/ui"GameAliases maps short alias names to their canonical game names. Aliases are not shown in help or game lists.
var GameAliases = map[string]string{
"7stud": "sevencardstud",
"7cs": "sevencardstud",
"clock": "clocksolitaire",
"crazy8": "crazyeights",
"indian": "indianpoker",
"video": "videopoker",
"deuces": "deuceswild",
"joker": "jokerpoker",
"short": "shortdeck",
"6plus": "shortdeck",
"gin": "ginrummy",
"3card": "threecard",
}GameNames is the canonical ordered list of available game names.
var GameNames = []string{
"blackjack", "poker", "oldmaid", "daifugo", "sevens",
"doubt", "holdem", "omaha", "shortdeck", "pineapple",
"hearts", "memory", "klondike", "freecell", "baccarat",
"spades", "crazyeights", "ginrummy", "canasta", "spider",
"napoleon", "indianpoker", "videopoker", "deuceswild", "jokerpoker",
"euchre", "pyramid", "tripeaks", "cribbage", "threecard",
"ohhell", "bridge", "speed", "gofish", "pinochle", "golf",
"pigtail", "sevencardstud", "clocksolitaire",
}func RunCuiLoop(controller CuiExecer, helpLines []string)RunCuiLoop 標準CUIゲームループを実行する helpLines は “help” / “?” コマンドが入力されたときのみ表示される
func RunInteractiveCuiLoop(manager *GameManager)RunInteractiveCuiLoop runs an interactive multi-game CUI loop with game switching support. The manager handles help/? commands internally; other commands are delegated to the current game.
CuiExecer CUIコントローラの共通インタフェース
type CuiExecer interface {
Exec(command string) string
}DoubtCui ダウトCUIクラス
type DoubtCui struct {
// contains filtered or unexported fields
}func NewDoubtCui() *DoubtCuiNewDoubtCui コンストラクタ
### func (*DoubtCui) Controller
func (cui *DoubtCui) Controller() CuiExecerController returns the game controller.
func (cui *DoubtCui) Exec()Exec ゲームメインループ
### func (*DoubtCui) HelpLines
func (cui *DoubtCui) HelpLines() []stringHelpLines returns the game’s help lines.
GameManager manages multiple game CUI controllers and enables dynamic switching.
type GameManager struct {
// contains filtered or unexported fields
}func NewGameManager(startGame string) *GameManagerNewGameManager creates a GameManager starting with startGame (must be a valid game name). i18n.SetLang must be called before NewGameManager: each game’s HelpLines() is evaluated once at construction time, so changing the language afterwards will not update cached help text.
### func (*GameManager) CurrentGame
func (m *GameManager) CurrentGame() stringCurrentGame returns the name of the currently active game.
func (m *GameManager) Exec(cmd string) stringExec processes a command. “switch <game>” and “games” are handled by the manager; all other commands are delegated to the current game’s controller.
### func (*GameManager) HelpLines
func (m *GameManager) HelpLines() []stringHelpLines returns the current game’s help lines plus interactive-mode commands.
### func (*GameManager) InitCurrentGame
func (m *GameManager) InitCurrentGame() stringInitCurrentGame initializes (resets) the current game if not yet done and returns the reset output. This should be called once at startup before entering the game loop.
Generated by gomarkdoc