-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a Project page for Cellular Sprites (#140)
Reference: #138
- Loading branch information
1 parent
0501b69
commit 8a346b7
Showing
2 changed files
with
66 additions
and
0 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
--- | ||
layout: post | ||
title: "Postscript: Cellular Sprites" | ||
date: 2020-03-31 | ||
category: projects | ||
comments: true | ||
author: "LJ MIRANDA" | ||
header-img: /assets/png/general/cellular-sprites.png | ||
tags: [jupyter notebooks, streamlit, procedural generation, streamlit, seagull, cellular automata, pixel art, 8-bit, sprites] | ||
description: | | ||
Come and generate your own 8-bit sprites using cellular automata! This | ||
project was built using Seagull, my Python library for Conway's Game of | ||
Life, and Streamlit. | ||
excerpt: | | ||
Come and generate your own 8-bit sprites using cellular automata! This | ||
project was built using Seagull, my Python library for Conway's Game of | ||
Life, and Streamlit. | ||
--- | ||
|
||
Almost a year ago, I wrote a library for Conway's Game of | ||
Life—[Seagull](https://github.com/ljvmiranda921/seagull). It's a fun | ||
project that serves as an outlet for my interests in [cellular automata](https://en.wikipedia.org/wiki/Cellular_automaton).[^1] | ||
This year, I used it for generating procedural art: | ||
|
||
<!-- add examples --> | ||
![](/assets/png/general/cellular-sprites.png){:width="640px"} | ||
{: style="text-align: center;"} | ||
|
||
In [Cellular Sprites](bit.ly/CellularSprites), you generate 8-bit sprites using | ||
Conway's Game of Life: | ||
* Any live cell with two or three neighbors survives | ||
* Any dead cell with one or less live neighbors becomes a live cell | ||
* All other live cells die in the next generation. All dead cells stay dead | ||
|
||
Note that these steps were based from | ||
[yurkth/sprator](https://github.com/yurkth/sprator). So all credit goes to | ||
him/her. In addition, the board size was first set to 4x8 before I ran the Game | ||
of Life Simulator. Afterwards, I flipped the board to create a square 8x8 | ||
image. It's good that Seagull's API design allowed for these changes, and it's | ||
very easy to implement! You can check [this | ||
example](https://pyseagull.readthedocs.io/en/latest/notebooks/sprator.html#Sprator) | ||
on how it's done. | ||
|
||
Lastly, Cellular Sprites was a learning opportunity for me to build and deploy | ||
a [Streamlit](streamlit.io) application. Streamlit is awesome. I talked about | ||
it at length in [one of my blog posts on Jupyter | ||
Notebooks](https://ljvmiranda921.github.io/notebook/2020/03/16/jupyter-notebooks-in-2020-part-2/#quick-turnaround-from-prototype-to-prod). | ||
I'm not a web-developer (I suck at frontend), but I was able to create a decent | ||
UI in just a day of hacking! | ||
|
||
**I suggest trying-out Cellular Sprites on your own.** Play with the parameters on | ||
the sidebar to create cute 8-bit sprites! If you found something cool, feel | ||
free to save the image and share to your friends! [(If `iframe` is not working, | ||
click this link to redirect you to the Heroku | ||
app)](https://cellular-sprites.herokuapp.com) | ||
|
||
<iframe src="https://cellular-sprites.herokuapp.com" width="700" height="600"> | ||
<p>Your browser does not support iframes.</p> | ||
</iframe> | ||
|
||
|
||
|
||
|
||
### Footnotes | ||
|
||
[^1]: In addition, I used it as an opportunity to learn and enforce [type hints in Python](https://realpython.com/python-type-checking/) |