Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modifying the grid in symbols #69

Closed
edemaine opened this issue May 12, 2022 · 0 comments
Closed

Modifying the grid in symbols #69

edemaine opened this issue May 12, 2022 · 0 comments

Comments

@edemaine
Copy link
Owner

edemaine commented May 12, 2022

Currently, a JavaScript/CoffeeScript symbol definition can read neighboring cells via this.neighbor, but it cannot modify such symbols. It wouldn't make much sense to modify previously processed symbols (unless we want to force them to be reprocessed...), but it'd be useful for making a symbol that represents the top-left corner of a bigger graphic.

For example, consider this gadget diagram:

  ||
--AA--
--AA--
  ||

To make this work nicely, we can define A to be a gadget graphic that occupies a 2x2 grid of symbols (but has viewBox still set to a single grid cell), and then to replace with blanks the corresponding symbols, resulting in this effective input:

  ||
--A --
--  --
  ||

This would let natural ASCII art work with symbols that are larger than one grid cell.

Combined with neighbor reading, you could even make the A symbol depend on the erased symbols. For example:

  ||
--A2--
--LR--
  ||

In this case 2LR could be additional input to the A symbol, read via this.neighbor. It gets erased by A anyway so it's free space to provide information.


An issue with implementing this in the current SVG Tiler is that we currently load all symbols from mappings before we actually execute the dynamic symbol functions, so changing the key in the second stage wouldn't affect the already-run first stage. But perhaps we should instead evaluate and run each symbol together. Reasons why it matters:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant