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 ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearAndSpawnCells ¶
func ClearAndSpawnCells(writer *uilive.Writer, gameConfig GameConfig, frameCells FrameCells)
ClearAndSpawnCells updates the cell string that is printed to the command line.
func IsCoordOutOfFrame ¶
func IsCoordOutOfFrame(gameConfig GameConfig, x, y int) bool
IsCoordOutOfFrame returns whether or not the cell at (x,y) is out of the frame.
func RunGame ¶
func RunGame(gameConfig GameConfig, initPattern Pattern)
RunGame runs the game based on the passed args.
Types ¶
type Cell ¶
type Cell struct { X int Y int IsAlive bool LivingNeighbors CellNeighbors }
func GetCellByCoord ¶
func GetCellByCoord(gameConfig GameConfig, frameCells FrameCells, x, y int) Cell
GetCellByCoord returns the cell that is at (x,y).
type CellNeighbors ¶
type CellNeighbors []Cell
func GetLivingNeighborsByCoord ¶
func GetLivingNeighborsByCoord(gameConfig GameConfig, frameCells FrameCells, x, y int) CellNeighbors
GetLivingNeighborsByCoord returns a slice of cells that neighbor the cell at (x,y).
type FrameCells ¶
type FrameCells []Cell
func GetFrameCellsByPattern ¶
func GetFrameCellsByPattern(gameConfig GameConfig, pattern Pattern) FrameCells
GetFrameCellsByPattern converts a pattern string to frame cells.
func UpdateCells ¶
func UpdateCells(gameConfig GameConfig, frameCells FrameCells) FrameCells
UpdateCells returns new frame cells after evaluating the living state of frameCells.