nomads

package
v0.0.0-...-6f6b6c6 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2022 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ScreenWidth, ScreenHeight = 600, 600
	StartingPopulation        = 8000
	RateOfGeneration          = 5
	CellSize                  = 5
)

Variables

View Source
var Glider = Spaceship{
	{0, 0, 0, 0, 0},
	{0, 0, 0, 1, 0},
	{0, 1, 0, 1, 0},
	{0, 0, 1, 1, 0},
	{0, 0, 0, 0, 0},
}

Functions

func ConvertToRGBA

func ConvertToRGBA(colorToConvert color.Color) color.RGBA

func GetColorDifference

func GetColorDifference(color1 color.RGBA, color2 color.RGBA) float64

func RandomDivisibleBy

func RandomDivisibleBy(min int, max int, divisibleBy int) int

func RandomRGBA

func RandomRGBA(colors ...string) color.RGBA

func RandomWithin

func RandomWithin(min int, max int) int

func Squared

func Squared(number float64) float64

Types

type Cell

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

type Grid

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

func Setup

func Setup() *Grid

func (*Grid) Draw

func (grid *Grid) Draw(screen *ebiten.Image)

func (*Grid) DrawGlider

func (grid *Grid) DrawGlider(
	glider Spaceship,
	startingX int,
	startingY int,
	color color.RGBA,
) *Grid

func (*Grid) GetNeighborhoodDiversity

func (grid *Grid) GetNeighborhoodDiversity(cellX int, cellY int) float64

TODO: Need to thoroughly test GetNeighborhoodDiversity

func (*Grid) Layout

func (g *Grid) Layout(outsideWidth, outsideHeight int) (int, int)

func (*Grid) Update

func (grid *Grid) Update(screen *ebiten.Image) error

type Position

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

type Spaceship

type Spaceship [5][5]int

func RotateGlider

func RotateGlider(glider Spaceship) Spaceship

Jump to

Keyboard shortcuts

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