scripts

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package scripts holds the map generation for Caves: pure algorithms, no engine types. Generation is just Go code; the game turns the grid into tagged engine objects.

Index

Constants

View Source
const (
	// Cols x Rows cells of Cell pixels fill the 800x600 window.
	Cols = 40
	Rows = 30
	Cell = 20.0
)

Variables

This section is empty.

Functions

func FindOpen

func FindOpen(grid [][]bool) (int, int)

FindOpen returns an open cell as close to the map center as possible: the player's spawn point.

func Generate

func Generate() [][]bool

Generate returns a cave grid (true = wall) using the classic cellular automata method: random fill, then smoothing votes where crowded cells become wall and lonely walls erode away.

func Reachable

func Reachable(grid [][]bool, startX, startY int) [][2]int

Reachable returns every open cell reachable from a start cell (BFS flood fill). Placing gems only on reachable cells keeps every generated cave winnable.

Types

This section is empty.

Jump to

Keyboard shortcuts

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