Documentation
¶
Overview ¶
Copyright © 2021 Brian Longmore brianl.ext@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 ¶
- func BruteRunGame(gc GameConfig)
- func ClearAndDrawFrames(gc GameConfig, frameCells Cells)
- func GenBuildFile(bc BuildConfig) error
- func GetConfigListStrings(config GameConfig) (string, string)
- func GetLiveNeighborNumByCoord(bc BuildConfig, frameCells Cells, x, y int) int
- func IsCoordOutOfFrame(bc BuildConfig, x, y int) bool
- func RunBuildFile(rc RunConfig) error
- func RunFrames(gd GameData, rc RunConfig)
- func UpdateCells(bc BuildConfig, frameCells *Cells)
- type BuildConfig
- type Cell
- type Cells
- type Frame
- type Frames
- type GameConfig
- type GameData
- type Pattern
- type RunConfig
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 ClearAndDrawFrames ¶ added in v1.3.0
func ClearAndDrawFrames(gc GameConfig, frameCells Cells)
ClearAndDrawFrames updates the frame that is printed to the command line.
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.
func GetConfigListStrings ¶ added in v1.2.2
func GetConfigListStrings(config GameConfig) (string, string)
GetConfigListStrings returns both game and pattern config strings from config.
func GetLiveNeighborNumByCoord ¶ added in v1.3.0
func GetLiveNeighborNumByCoord(bc BuildConfig, frameCells Cells, x, y int) int
GetLiveNeighborNumByCoord returns the number of cells neighboring the cell at (x,y).
func IsCoordOutOfFrame ¶
func IsCoordOutOfFrame(bc BuildConfig, x, y int) bool
IsCoordOutOfFrame returns whether or not the cell at (x,y) is out of the frame.
func RunBuildFile ¶ added in v1.3.0
RunBuildFile runs a build file according to the parameters passed in rc.
func RunFrames ¶ added in v1.3.0
RunFrames runs the frames based on the passed game data and run config.
func UpdateCells ¶
func UpdateCells(bc BuildConfig, frameCells *Cells)
UpdateCells updates the value of the pointer frameCells after evaluating the living states of its cells.
Types ¶
type BuildConfig ¶ added in v1.3.0
type Cell ¶
func GetCellByCoord ¶
func GetCellByCoord(bc BuildConfig, frameCells Cells, x, y int) Cell
GetCellByCoord returns the cell that is at (x,y).
func GetNewCell ¶ added in v1.1.0
func GetNewCell(bc BuildConfig, frameCells Cells, cell Cell) Cell
GetNewCell returns a new cell from the passed cell according to the life conditions.
type Cells ¶ added in v1.3.0
type Cells []Cell
func GenCellsFromPattern ¶ added in v1.3.0
func GenCellsFromPattern(bc BuildConfig) Cells
GenCellsFromPattern converts a pattern string to frame cells.
type Frames ¶ added in v1.3.0
type Frames []Frame
func GenFramesFromPattern ¶ added in v1.3.0
func GenFramesFromPattern(bc BuildConfig) Frames
GenFramesFromPattern generates and returns Frames according to the values passed in bc.
type GameConfig ¶ added in v1.0.0
type GameData ¶ added in v1.3.0
type GameData struct { BuildConfig Frames }
func GenGameDataFromBuildFile ¶ added in v1.3.0
GenGameDataFromBuildFile returns GameData that was stored in the targeted json build file.