util

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Copyright © 2021 Brian Longmore branodev@gmail.com

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BruteRunGame added in v1.3.0

func BruteRunGame(gc GameConfig)

BruteRunGame runs the game with in-time building.

func GenBuildFile added in v1.3.0

func GenBuildFile(bc BuildConfig) error

GenBuildFile creates a build file from bc.If the destination file already exists, it will be overwritten. If the destination is omitted, the build file will be saved in the CWD and will have the pattern's filename without the extension.

func RunBuildFile added in v1.3.0

func RunBuildFile(rc RunConfig) error

RunBuildFile runs a build file according to the parameters passed in rc.

Types

type BuildConfig added in v1.3.0

type BuildConfig struct {
	BuildFilePath string
	Width         int
	Height        int
	FrameCount    int
	InitPattern   Pattern
}

type Cell

type Cell struct {
	X               int
	Y               int
	IsAlive         bool
	LiveNeighborNum int
}

type Cells added in v1.3.0

type Cells []Cell

type Frame added in v1.3.0

type Frame struct {
	FrameNum int
	Cells
}

type Frames added in v1.3.0

type Frames []Frame

type GameConfig added in v1.0.0

type GameConfig struct {
	Width        int
	Height       int
	FrameCount   int
	InitPattern  Pattern
	Interval     time.Duration
	LiveCellChar string
	DeadCellChar string
}

type GameData added in v1.3.0

type GameData struct {
	BuildConfig
	Frames
}

type Pattern

type Pattern struct {
	FilePath string
	X        int
	Y        int
}

type RunConfig added in v1.3.0

type RunConfig struct {
	BuildFilePath string
	Interval      time.Duration
	LiveCellChar  string
	DeadCellChar  string
}

Jump to

Keyboard shortcuts

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