GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - yutao-huang/office-scripts-conway-game-of-life: A Conway's Game of Life implementation using Office Scripts for Excel on the web

BranchesTags
Open more actions menu

Latest commit

 

History

35 Commits
35 Commits

Folders and files

NameName
Last commit message
Last commit date
.vscode
.vscode
 
 
images
images
 
 
src
src
 
 
README.md
README.md
 
 

Repository files navigation

Conway's Game of Life in Office Scripts

This is a Game of Life simulator in Office Scripts that can demonstrate this classic yet fascinating game on Excel worksheet.

banner

17c/45_Reaction, 16x5 (17c45reaction.rle)

Background

Conway's Game of Life

Please read https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life for more details about this wonderful game.

The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970. It is a zero-player game, meaning that its evolution is determined by its initial state, requiring no further input. One interacts with the Game of Life by creating an initial configuration and observing how it evolves. It is Turing complete and can simulate a universal constructor or any other Turing machine.

Office Scripts

Please refer to https://aka.ms/office-scripts for more details about Office Scripts in Excel on the web.

Office Scripts in Excel on the web let you automate your day-to-day tasks. You can record your Excel actions with the Action Recorder, which creates a script. You can also create and edit scripts with the Code Editor. Your scripts can then be shared across your organization so your coworkers can also automate their workflows.

Usage

  • Firstly start from here to get familiar with Office Scripts in Excel on the web.

  • Create a new workbook in Excel on the Web.

  • Open the Automate tab.

  • Press the New script button.

  • Copy the code from game-of-life.ts and paste into the Code Editor:

    code-editor

  • Optionally, rename the script as "Conway's Game of Life".

  • Hit the ▶ Run button above the code editor.

  • After a few seconds of churning (downloading the pattern rule and setting up the game board), a small "glider" will come to life and start to travel across the worksheet. Please note it will take a bit longer to run for the very first time.

    sample-glider

Customize the game

Follow the comments in the code to customize what and how you want to render the game. Most of the default settings should just work fine but please feel free to explore different game patterns.

  • The dimension of the game board (number of columns/rows):

    const BOARD_WIDTH = 60;
    const BOARD_HEIGHT = 40;
  • The dimension of each cell (in pixels):

    const CELL_WIDTH = 8;
    const CELL_HEIGHT = 8;
  • The board background color (refer to https://html-color.codes/ for the format of the color code):

    const BOARD_COLOR = "white";

    Or use null for a transparent board:

    const BOARD_COLOR = null;
  • The cell color (refer to https://html-color.codes/ for the format of the color code):

    const CELL_COLOR = "green";
  • The maximum generations you want it to run:

    const MAX_GENERATIONS = 120;
  • The initial pattern's rule (refer to https://copy.sh/life/examples for more sample patterns - look for the pattern file name without the extension .rle):

    const PATTERN_FILE_NAME = "glider";

Supported rules

  • Conway's Game of Life (23/3) (the most common rule)
  • HighLife (23/36)
  • Life without death (012345678/3)
  • Maze (12345/3)
  • 2x2 (125/36)
  • Move (245/368)
  • B3578/S238

Samples

Here are a few interesting samples based on the rules from https://copy.sh/life/examples. Note the frame rates have been adjusted for the screen recordings here for demonstration purpose. The actual evolution rendered in Excel on the Web is slower.

  • Bi-clock, 7x7 (biclock.rle):

    Bi-clock, 7x7

  • Maze wickstretcher, 6x8 (mazewickstretcher.rle):

    Maze wickstretcher, 6x8

  • 2x2 Block Oscillators, 26x2 (2x2blockoscillators.rle):

    2x2 Block Oscillators, 26x2

  • Baker, 16x14 (baker.rle):

    Baker, 16x14

  • Bomber Predecessor, 10x6 (bomberpredecessor.rle):

    Baker, 16x14

  • B3578/S238 Replicator, 7x7 (b3578s238replicator.rle):

    B3578/S238 Replicator, 7x7

Note

  • Rendering a game with many cells sometimes might be unstable. If you see the rendering has stopped, you may need to pick a different pattern with less cells.
  • Unfortunately this simulator code doesn't work with the "Run script" action in Power Automate, yet.

References

  • Office Scripts in Excel on the web
  • LifeWiki - The wiki for Conway's Game of Life.
  • https://copy.sh/life - Please do check out this awesome web-based implementation of Conway's Game of Life!

About

A Conway's Game of Life implementation using Office Scripts for Excel on the web

Topics

conways-game-of-lifeoffice-scripts

Resources

Readme
Activity

Stars

3 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402894 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.