rippleeffect

package
v1.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 6, 2026 License: MIT Imports: 17 Imported by: 0

README

Ripple Effect

Place digits into irregular cages so each cage contains 1..n exactly once, and matching digits stay outside each other’s ripple distance.

Modes

Mode Size Notes
Mini 5x5 5x5 Compact intro board
Easy 6x6 6x6 Gentle spacing logic
Medium 7x7 7x7 Balanced cages and ripples
Hard 8x8 8x8 Denser interactions
Expert 9x9 9x9 Wider reasoning chains

CLI

puzzletea new ripple-effect
puzzletea new ripple "Medium 7x7"
puzzletea new ripple-effect "Hard 8x8" --with-seed sample-seed

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DailyModes = []list.Item{
	Modes[1],
	Modes[2],
	Modes[3],
}
View Source
var DefaultKeyMap = KeyMap{
	CursorKeyMap: game.DefaultCursorKeyMap,
	FillValue: key.NewBinding(
		key.WithKeys("1", "2", "3", "4", "5", "6", "7", "8", "9"),
		key.WithHelp("1-9", "Fill"),
	),
	Clear: key.NewBinding(
		key.WithKeys("backspace", "delete"),
		key.WithHelp("bkspc", "Clear"),
	),
}
View Source
var Definition = game.Definition{
	Name:        "Ripple Effect",
	Description: "Place digits in cages without violating ripple distance.",
	Aliases:     []string{"ripple"},
	Modes:       Modes,
	DailyModes:  DailyModes,
	Help:        HelpContent,
	Import:      func(data []byte) (game.Gamer, error) { return ImportModel(data) },
}
View Source
var HelpContent string
View Source
var Modes = []list.Item{
	NewMode("Mini 5x5", "Small board with compact cages.", 5, 3, 0.76),
	NewMode("Easy 6x6", "Gentle introduction to ripple spacing.", 6, 3, 0.72),
	NewMode("Medium 7x7", "Balanced cages and row pressure.", 7, 4, 0.68),
	NewMode("Hard 8x8", "Denser ripple interactions.", 8, 4, 0.64),
	NewMode("Expert 9x9", "Wide board with longer deduction chains.", 9, 5, 0.60),
}

Functions

func New

func New(mode Mode, puzzle Puzzle) (game.Gamer, error)

Types

type Cage

type Cage struct {
	ID    int    `json:"id"`
	Size  int    `json:"size"`
	Cells []Cell `json:"cells"`
}

type Cell

type Cell struct {
	X int `json:"x"`
	Y int `json:"y"`
}

type KeyMap

type KeyMap struct {
	game.CursorKeyMap
	FillValue key.Binding
	Clear     key.Binding
}

type Mode

type Mode struct {
	game.BaseMode
	Size       int
	MaxCage    int
	GivenRatio float64
}

func NewMode

func NewMode(title, description string, size, maxCage int, givenRatio float64) Mode

func (Mode) Spawn

func (m Mode) Spawn() (game.Gamer, error)

func (Mode) SpawnSeeded

func (m Mode) SpawnSeeded(rng *rand.Rand) (game.Gamer, error)

type Model

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

func ImportModel

func ImportModel(data []byte) (*Model, error)

func (Model) GetDebugInfo

func (m Model) GetDebugInfo() string

func (Model) GetFullHelp

func (m Model) GetFullHelp() [][]key.Binding

func (Model) GetSave

func (m Model) GetSave() ([]byte, error)

func (Model) Init

func (m Model) Init() tea.Cmd

func (Model) IsSolved

func (m Model) IsSolved() bool

func (Model) Reset

func (m Model) Reset() game.Gamer

func (Model) SetTitle

func (m Model) SetTitle(t string) game.Gamer

func (Model) Update

func (m Model) Update(msg tea.Msg) (game.Gamer, tea.Cmd)

func (Model) View

func (m Model) View() string

type Puzzle

type Puzzle struct {
	Width    int
	Height   int
	Cages    []Cage
	Givens   grid
	Solution grid
}

func GeneratePuzzle

func GeneratePuzzle(width, height, maxCage int, givenRatio float64) (Puzzle, error)

func GeneratePuzzleSeeded

func GeneratePuzzleSeeded(width, height, maxCage int, givenRatio float64, rng *rand.Rand) (Puzzle, error)

type Save

type Save struct {
	Width     int    `json:"width"`
	Height    int    `json:"height"`
	State     string `json:"state"`
	Givens    string `json:"givens"`
	Cages     []Cage `json:"cages"`
	ModeTitle string `json:"mode_title"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL