bod

package module
v0.0.0-...-fd4ab75 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: MIT Imports: 4 Imported by: 0

README

Bod is short for Bodleian, a library of some import among certain nerds. This library generates worlds.

Friendly functions for tile map generation via following algos: BSP

With the following on the way: Drunkard's walk Celluar Automata

Simple usage: //get a bsp map myMap := bod.DoBSP(60, 25) //print tile map to terminal bod.ShowMap(myMap)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AbsInt

func AbsInt(x int) int

abs value of an int

func DoBSP

func DoBSP(screenWidth, screenHeight int) [][]string

func DoDrunkWalk

func DoDrunkWalk(width, height, momentum int, targetPercent float64) [][]string

func EditMapChars

func EditMapChars(m [][]string, find, insert string, show bool)

find and replace for the map

func Manhattan

func Manhattan(x1, y1, x2, y2 int) int

simple manhattan distance formula

func NCharHood

func NCharHood(m [][]string, x, y int, char string) int

go through the matrix and see how spaces around a cell have a given char in them helps with assigning chars to viz the matrix

func ShowMap

func ShowMap(m [][]string)

loop over the map and print it

Types

type Drunkard

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

this random walk, aka drunk walk. Drunk walk sounds more fun so we have a drunkard not a walker

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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