This browser does not have a Java Plug-in.
Get the latest Java Plug-in here.

Source code: MunchingSquares

Built with Processing

				
				
				
///////////////////////////////////////////////////////////////////
//
// MUNCHING SQUARES! ( y = x XOR t )
//
// Processing implementation of Munching Squares display hack. 
// This is based off the original algorithm by an MIT scientist, 
// which can be found at
// http://www.inwap.com/pdp10/hbaker/hakmem/hacks.html#item147
//
// For more information see:
// http://mathworld.wolfram.com/MunchingSquares.html
// http://en.wikipedia.org/wiki/Munching_square
//
// by Richard Caceres, rcaceres [ at ] ucla [ dot ] edu, 11/26/08
//
///////////////////////////////////////////////////////////////////

void setup()
{
  size (256, 256);
  frameRate(30);
  stroke (200, 255, 50);
}

void draw()
{
  background (0);

  int t = frameCount % 255;
  //t = mouseX; // Try uncommenting this for fun.

  // Plot the graph of y = x XOR t for values of T = time

  for ( int x = 0; x <= width; x++)
  {
    point (x, x ^ t);
  }
}