totes

Playing around with multiset rewriting today using Tote. Here are some little sequences I made during work breaks hehe.

tally

A very simple tally counter. You can use the evaluation buttons to increment and decrement.

rewriting sequence in Tote showing a tally counter
tally counter, going forwards


view GIF
rewriting sequence in Tote showing a tally counter in reverse
tally counter, going backwards
view GIF
5 5 5 51

# increment
45
12
23
34

# push 5 to stack and spawn in
# another 1 to start another cycle
51 5
pseudocode

rocket

A rocket launch sequence, made possible with direction setters.

rewriting sequence in Tote showing rocket launch
take your protein pills and put your helmet on


view GIF
# TO SPACE
‖ 🚀‖ ‖ 🚀
0 # liftoff!
54
43
32
21
10
pseudocode

Note: this sequence breaks if run in reverse. The rocket descends but it burns the countdown.

counter

A rabbit counter that resets at 10 rabbits. I think the rules could be reduced but I’m just not seeing it right now.

rewriting sequence in Tote showing a counter from 1 to 0
counting rabbits


view GIF
# GAAAHH
segments(9) → 🐇🐇🐇🐇🐇🐇🐇🐇🐇🐇
segments(8) → 🐇🐇🐇🐇🐇🐇🐇🐇🐇
segments(7) → 🐇🐇🐇🐇🐇🐇🐇🐇
segments(6) → 🐇🐇🐇🐇🐇🐇🐇
segments(5) → 🐇🐇🐇🐇🐇🐇
segments(4) → 🐇🐇🐇🐇🐇
segments(3) → 🐇🐇🐇🐇
segments(2) → 🐇🐇🐇
segments(1) → 🐇🐇
segments(0) → 🐇
🐇🐇🐇🐇🐇🐇🐇🐇🐇🐇segments(0)
🐇🐇🐇🐇🐇🐇🐇🐇🐇segments(9)
🐇🐇🐇🐇🐇🐇🐇🐇segments(8)
🐇🐇🐇🐇🐇🐇🐇segments(7)
🐇🐇🐇🐇🐇🐇segments(6)
🐇🐇🐇🐇🐇segments(5)
🐇🐇🐇🐇segments(4)
🐇🐇🐇segments(3)
🐇🐇segments(2)
🐇segments(1)
pseudocode

eye

I made an eye that follows a ball controlled with Devine’s controller setup.

rewriting sequence in Tote showing an eye tracking the movement of a ball
eye on the ball

3 sessions over
to
view GIF

I couldn’t find enough emojis and Unicode characters to include a code section like in the demos above so here’s an image of the rules instead. Additionally, the demo files are included for you to download and play with.

rules used in the eye tracker demo
eye-tracker rules

The ball is controlled by the arrow buttons which spawn in invisible arrows oriented in horizontal and vertical stacks from the upper-left corner of the "bag" — for simplicity, let’s call these coordinates. The axis rules are basically doing two things: serving as controllers that update coordinates and replacing the current eyeball symbol.

↓ ↓ ↓ ⬇️ 👁 → ↓ ↓ ↓ ⬇️ 👁
direction in dashed boxes

The first 3 rules are special in that they update coordinates but they keep the eyeball locked in its current state. They are also dependent on the placement of the eyeball, so if you decide to move it, you have to update these rules accordingly.

There are 8 eye sprites for each cardinal and intercardinal directions, hence the need for so many rules. But maybe it’s possible to reduce them to an even smaller set. Devine has an idea of using offset counters but I couldn’t get it to work so I’ll leave it to you, dear reader, as a challenge.

Added on

impressions

It’s quite fun actually. The mechanics are deceptively simple — declare a list of rules, the first matching rule from the top is applied, and start again from the top. However, I’m having a bit of a difficult time thinking with these constraints. Meanwhile, there’s people already doing impressive things with it like this and this. I take one lunch break and Devine made a controller and I’m like…it’s that simple‽

rewrite the way you think → to rewrite
to rewrite → rewrite the way you think

Kinda reminds me of Conway’s Game of Life and how people were finding all of these different patterns like beehives, gliders, and pulsars. I think we could and should compile something like that for rewriting (if it doesn’t already exist).

Anyway, I’ll continue updating this page with more things I try.

resources


Oh and speaking of totes, bring a tote bag when you go grocery shopping. Ditch the plastic bags.


—josh