Skip to content

krymtkts/PSGameOfLife

Repository files navigation

PSGameOfLife

Top Language License: MIT

PSGameOfLife is a PowerShell module written in F#. It runs Conway's Game of Life interactively in your console.

Tested on PowerShell 7.4 or later with Windows Terminal on both Windows and Ubuntu. Visual Studio Code terminal appears to have a higher load than Windows Terminal.

default CUI mode GUI mode

Features

  • Interactive Conway's Game of Life simulation in the terminal
  • Customizable initial randomness and update interval
  • Simple PowerShell cmdlet interface
  • CUI and GUI, GUI mode is Avalonia-based cross-platform

Installation

You can install PSGameOfLife from the PowerShell Gallery:

# Recommended: PSResourceGet (PowerShellGet 3.0)
Install-PSResource -Name PSGameOfLife

# Or, with PowerShellGet 2.x:
Install-Module -Name PSGameOfLife

Cmdlet Help

See the Start-GameOfLife.md file for detailed cmdlet help.

Usage

CUI (Console) mode

Start-GameOfLife

Press Q during the simulation to quit.

You can customize the initial randomness and update interval:

Start-GameOfLife -FateRoll 0.2 -IntervalMs 200
  • -FateRoll sets the probability (0.1 ~ 0.5) that each cell is alive at the start
  • -IntervalMs sets the interval in milliseconds between generations (default: 100)

GUI mode

Start-GameOfLife -GuiMode

Press Q during the simulation to quit.

Note

On Linux, due to a known issue, quitting the game with the Q key leaves a zombie window. Therefore, the Q key is not provided on Linux. Please close the window to exit.

You can adjust the appearance and size of the window with the following parameters:

  • -CellSize sets pixel size of each cell (1 to 10, default: 10)
  • -Width : sets number of cells horizontally (default: 50)
  • -Height : sets number of cells vertically (default: 50)

Example:

Start-GameOfLife -GuiMode -CellSize 8 -Width 80 -Height 60

You can use -FateRoll and -IntervalMs in GUI mode as well as in CUI mode.

Start-GameOfLife -GuiMode -CellSize 8 -Width 80 -Height 60 -FateRoll 0.2 -IntervalMs 200

License

The MIT License applies to this project. For details, see the LICENSE file.

Links

About

Interactive Conway's Game of Life module for PowerShell, written in F#. Simulates the Game of Life in your terminal with customizable settings.

Topics

Resources

License

Stars

Watchers

Forks

Contributors