Play with falling sand in Emacs
add ht to Package-Requires
make aliases for dashes


browse log



#Sand mode!

Sand-mode is an unrealistic physics simulator where you can play with low-fidelity falling sand, rocks, antimatter, and more.

Simple sand falling.

As you can see, sand falls down. Let's look at a more complex example of what sand.el can do.

A more complex example of sand.el.

#How to play

  1. Load this library.
  2. Run M-x sand/play. This will create a board with items in it.
  3. At the bottom of the page, there's a button to run the tutorial. Press it.
  4. After the tutorial finishes, play around with whatever you want!
  5. You can press the representation of any item to insert the item at point.


Here are all the items in the game.

#Falling items

These items fall down each timestep, until they land on something else.

  • o: sand
  • @: rock - falls through sand
  • a: glass - crushed by rock
  • *: antimatter - explodes what it touches.
  • &: bomb -- explodes when it stops moving

#Floating items

These items float up each timestep.

  • Q: balloon

#Fixed items

These items are fixed and don't move.

  • _: ledge - holds a single item on top of it.
  • /: angle left - bounces items left.
  • \: angle right - bounces items right.
  • #: source - sometimes spawns an item (see sand//chance-of-source-dropping).
  • X: sink - absorbs what falls into it


  • B: blank the board.
  • C: clear loose items.
  • space or backspace: clear the item under point
  • P: toggle whether the board is playing.
  • R: restart -- wipe the board, and put a bunch of items back in it.
  • r: add a random element somewhere in the board.
  • h: add a random element at point.
  • t Move forward a single tick in time.

You can also press the character that represents an item to place that item. So press o to place sand, @ to place a rock, _ to place a ledge, and so forth.