What if Conway's Game of Life was a cloud-native serverless application written for WASI using TinyGo and deployed using Fermyon Spin?
Welcome to cloudlife... "Life As A Service"
Uses Vita for the Go language Game of Life implementation.
spin build
spin up
All operations on the multiverse are applied to all existing universes.
-
POST /multiverse?n=2
Creates new universes in a grid. Pass the
n
query parameter to create a specific number of universes.Returns the list of IDs for each universe that is created.
-
GET /multiverse
Returns the list of IDs for each universe that has been created.
-
PUT /multiverse
Advances each universe by 1 generation.
Returns the cells for each universe after it has advanced.
-
DELETE /multiverse
Deletes all universes.
All operations on a universe only apply to that specific universe.
-
POST /universe
Creates a new universe.
Returns the ID for the new universe that is created.
-
GET /universe/:id
Returns the current cells for the universe with the specific ID.
-
PUT /universe/:id
Advances the universe with the specific ID by 1 generation.
Returns the cells for the universe after it has advanced.
-
PUT /universe/:id?topid=:tid&bottomid=:bid&leftid=:leftid&rightid=:rid
Sets the neighbors for the universe with the specific ID to the universes with the respective ID and position e.g. top, bottom, left, and right. Does not advance the universe to the next generation.
-
DELETE /universe/:id
Deletes the universe with the specific ID.
lifectl
is a command life tool to control cloudlife applications.
cd ./cmd/lifectl
go install .
$ lifectl
NAME:
lifectl - Control your cloudlife
USAGE:
lifectl [global options] command [arguments]
COMMANDS:
start Starts a cloudlife application
run Runs the cloudlife application
stop Stops a cloudlife application
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--host value Host to use to connect to the cloudlife application (default: "http://localhost:3000")
--help, -h show help