Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hikari-no-yume/pico8bot.php
@pico8bot's image generation reimplemented in PHP as a little programming language
https://github.com/hikari-no-yume/pico8bot.php
Last synced: 17 days ago
JSON representation
@pico8bot's image generation reimplemented in PHP as a little programming language
- Host: GitHub
- URL: https://github.com/hikari-no-yume/pico8bot.php
- Owner: hikari-no-yume
- License: other
- Created: 2016-01-22T18:14:43.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-01-23T19:47:36.000Z (almost 9 years ago)
- Last Synced: 2024-10-31T05:08:07.487Z (2 months ago)
- Language: PHP
- Homepage:
- Size: 265 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
pico8bot, in PHP
================I think [@pico8bot](https://twitter.com/pico8bot) on Twitter is pretty cool. Just for fun, I've reimplemented the image generation algorithm in PHP.
I looked at the original source code to find out how the `%` operator works, the colour palette, the number of frames, how `x` and `y` are set, and the width and height: https://github.com/Objelisks/picobot/blob/master/bot.js
![Screenshot!](https://raw.githubusercontent.com/TazeTSchnitzel/pico8bot.php/master/screenshot.png)
Capabilities
------------* Full language support:
* Operators: `+`, `-`, `*`, `/`, `%`
* Functions: `sin`, `cos`, `abs`, `tan2`, `sqrt`, `floor`, `max`, `min`
* Variables: `x`, `y`, `t`
* Uses PHP's tokeniser because I'm lazy
* Shunting-yard parser which generates abstract syntax tree
* Two evaluation methods:
* Naïve recursive evaluator
* JIT compilation to PHP codeRequirements
------------PHP >= 7.0
PHP Gd extension
Usage
-----$ php pico8bot.php
Currently doesn't do animation or give a choice of evaluator (it always uses JIT).
e.g.
$ php picto8bot.php 'sin(2.07*x)*cos(9.76%8.24)*flr(max(y, 2.51))' test.gif