ui

ui

import "github.com/yuta-yoshinaga/go_trumpcards/internal/infrastructure/ui"

Index

Variables

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

func RunCuiLoop(controller CuiExecer, helpLines []string)

RunCuiLoop 標準CUIゲームループを実行する helpLines は “help” / “?” コマンドが入力されたときのみ表示される

## func RunInteractiveCuiLoop

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.

## type CuiExecer

CuiExecer CUIコントローラの共通インタフェース

type CuiExecer interface {
    Exec(command string) string
}

## type DoubtCui

DoubtCui ダウトCUIクラス

type DoubtCui struct {
    // contains filtered or unexported fields
}

### func NewDoubtCui

func NewDoubtCui() *DoubtCui

NewDoubtCui コンストラクタ

### func (*DoubtCui) Controller

func (cui *DoubtCui) Controller() CuiExecer

Controller returns the game controller.

### func (*DoubtCui) Exec

func (cui *DoubtCui) Exec()

Exec ゲームメインループ

### func (*DoubtCui) HelpLines

func (cui *DoubtCui) HelpLines() []string

HelpLines returns the game’s help lines.

## type GameManager

GameManager manages multiple game CUI controllers and enables dynamic switching.

type GameManager struct {
    // contains filtered or unexported fields
}

### func NewGameManager

func NewGameManager(startGame string) *GameManager

NewGameManager 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() string

CurrentGame returns the name of the currently active game.

### func (*GameManager) Exec

func (m *GameManager) Exec(cmd string) string

Exec 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() []string

HelpLines returns the current game’s help lines plus interactive-mode commands.

### func (*GameManager) InitCurrentGame

func (m *GameManager) InitCurrentGame() string

InitCurrentGame 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