netwalk

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2026 License: MIT Imports: 19 Imported by: 0

README

Netwalk

Rotate network tiles until every active connection reaches the server in one loop-free tree.

Netwalk gameplay

Quick Start

puzzletea new netwalk "Mini 5x5"
puzzletea new netwalk "Easy 7x7"
puzzletea new network medium

Rules

  • Every active tile contains a fixed connector pattern that can only be rotated.
  • All connectors must match neighboring connectors exactly.
  • No connector may point off the board or into an empty cell.
  • The final network must be a single connected tree rooted at the server.

Controls

Key Action
Arrows / wasd / hjkl Move cursor
Space Rotate clockwise
Backspace Rotate counter-clockwise
Enter Toggle lock

Modes

Mode Board
Mini 5x5 Small starter tree
Easy 7x7 Moderate branch count
Medium 9x9 More global interaction
Hard 11x11 Longer branch chains
Expert 13x13 Largest network

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultKeyMap = KeyMap{
	CursorKeyMap: game.DefaultCursorKeyMap,
	Rotate: key.NewBinding(
		key.WithKeys("space"),
		key.WithHelp("space", "Rotate"),
	),
	RotateBack: key.NewBinding(
		key.WithKeys("backspace", "shift+space"),
		key.WithHelp("bkspc", "Rotate back"),
	),
	Lock: key.NewBinding(
		key.WithKeys("enter"),
		key.WithHelp("enter", "Toggle lock"),
	),
}
View Source
var Definition = puzzle.NewDefinition(puzzle.DefinitionSpec{
	Name:         "Netwalk",
	Description:  "Rotate network tiles until every computer connects to the server.",
	Aliases:      []string{"network"},
	Modes:        ModeDefinitions,
	DailyModeIDs: puzzle.SelectModeIDsByIndex(ModeDefinitions, 1, 2),
})
View Source
var HelpContent string
View Source
var ModeDefinitions = gameentry.BuildModeDefs(Modes)
View Source
var Modes = []game.Mode{
	NewMode("Mini 5x5", "Compact 5×5 network with a denser starter tree.", 5, 0.50, miniProfile),
	NewMode("Easy 7x7", "7×7 board with fuller coverage and gentle local tangles.", 7, 0.57, easyProfile),
	NewMode("Medium 9x9", "Balanced 9×9 network with tighter clusters and more branching.", 9, 0.64, mediumProfile),
	NewMode("Hard 11x11", "Dense 11×11 board that packs branches into close local interactions.", 11, 0.72, hardProfile),
	NewMode("Expert 13x13", "Large, crowded network with heavy branching and frequent near-miss tangles.", 13, 0.78, expertProfile),
}
View Source
var PDFPrintAdapter = printAdapter{}

Functions

func New

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

Types

type KeyMap

type KeyMap struct {
	game.CursorKeyMap
	Rotate     key.Binding
	RotateBack key.Binding
	Lock       key.Binding
}

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 NetwalkMode

type NetwalkMode struct {
	game.BaseMode
	Size      int
	FillRatio float64
	Profile   generateProfile
}

func NewMode

func NewMode(title, desc string, size int, fillRatio float64, profile generateProfile) NetwalkMode

func (NetwalkMode) Spawn

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

func (NetwalkMode) SpawnSeeded

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

type Puzzle

type Puzzle struct {
	Size  int
	Root  point
	Tiles [][]tile
}

func Generate

func Generate(size, targetActive int) (Puzzle, error)

func GenerateSeeded

func GenerateSeeded(size, targetActive int, rng *rand.Rand) (Puzzle, error)

func GenerateSeededWithDensity

func GenerateSeededWithDensity(size int, fillRatio float64, profile generateProfile, rng *rand.Rand) (Puzzle, error)

type Save

type Save struct {
	Size             int    `json:"size"`
	Masks            string `json:"masks"`
	Rotations        string `json:"rotations"`
	InitialRotations string `json:"initial_rotations"`
	Kinds            string `json:"kinds"`
	Locks            string `json:"locks"`
	ModeTitle        string `json:"mode_title"`
}

Jump to

Keyboard shortcuts

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