Enlightened WaterFall  

Project Home    Tools     Code    Prelims    Final Product

     
Code
 

The nylon board uses a unique API. With this programming interface, I am able to experiment with different functionality on my board. I plan on using the board's capabilities to the fullest in hopes of having a multiplexed waterfall. Here is my final code:

//Cesar Villarreal
//Enlightened WaterFall:
//Simulates water falling from
//the nylon board and provides
//scenery through Hotpants


void reset()
{
:0=0;
:1=0;
:2=0;
:3=0;
:4=0;
:5=0;
:6=0;
:7=0;
return;
}

//Draw a sun on Hotpants
void sun()
{
stroke(1);
circle(4,6,3);
line(4,1,4,0);
pause(5);
line(4,11,4,12);
pause(5);
line(0,2,1,3);
pause(5);
line(7,3,8,2);
pause(5);
line(0,10,1,9);
pause(5);
line(7,9,8,10);
pause(5);
point(9,6);
pause(5);
stroke(2);
line(4,1,4,0);
pause(5);
line(4,11,4,12);
pause(5);
line(0,2,1,3);
pause(5);
line(7,3,8,2);
pause(5);
line(0,10,1,9);
pause(5);
line(7,9,8,10);
pause(5);
point(9,6);
}

//Draw a moon and stars
//on Hotpants
void moon()
{
stroke(2);
line(5,7,7,6);
line(5,1,7,2);
line(6,4,8,4);
line(6,5,8,5);
line(6,3,8,3);
point(6,2);
point(6,6);
point(0,2);
pause(5);
point(3,4);
pause(5);
point(4,11);
pause(5);
point(2,13);
pause(5);
point(1,9);
pause(5);
point(8,10);
pause(5);
point(7,12);
pause(5);
stroke(1);
point(0,2);
pause(15);
point(3,4);
pause(15);
point(4,11);
pause(15);
point(2,13);
pause(15);
point(1,9);
pause(15);
point(8,10);
pause(15);
point(7,12);
}

//Draw clouds and birds
//on Hotpants
void clouds()
{
stroke(0);
point(0,9);
point(4,9);
point(5,11);
point(9,11);
stroke(1);
line(1,4,9,4);
line(2,3,4,2);
line(5,2,6,1);
line(7,2,9,4);
line(0,1,3,1);
line(1,0,2,0);
line(5,7,8,7);
line(6,6,7,6);
line(1,9,2,10);
point(3,9);
line(6,11,7,12);
point(8,11);
point(0,10);
point(4,10);
point(5,12);
point(9,12);
pause(20);
stroke(0);
point(0,10);
point(4,10);
point(5,12);
point(9,12);
stroke(1);
point(0,9);
point(4,9);
point(5,11);
point(9,11);
}

//Simulate the Waterfall

while(true)
{

//Switches that change
//direction of Waterfall
int x = @3;
int y = @1;

//Water falling down
if(x == 0)
{

//analog switch to
//change the scenery
int scenery = #2;
if(scenery < 33)
{
canvas();
sun();
}
else
if(scenery < 66)
{
canvas();
clouds();
}
else
if (scenery < 100)
{
canvas();
moon();
}

//waterfall
seq flash = ~ ((1,12), (0,12)) ^ 5 ;
:7=flash;
pause(17);
:6=flash;
pause(17);
:5=flash;
pause(17);
:4=flash;
pause(17);
:3=flash;
pause(17);
:2=flash;
pause(17);
:1=flash;
pause(17);
:0=flash;
pause(17);
}
else
//water flowing upward
if (y == 0)
{

//analog switch to
//change the scenery
int scenery1 = #2;
if(scenery1 < 33)
{
canvas();
sun();
}
else
if(scenery1 < 66)
{
canvas();
clouds();
}
else
if (scenery1 < 100)
{
canvas();
moon();
}

//waterspout
seq flash1 = ~ ((1,12), (0,12)) ^ 5 ;
:0=flash1;
pause(17);
:1=flash1;
pause(17);
:2=flash1;
pause(17);
:3=flash1;
pause(17);
:4=flash1;
pause(17);
:5=flash1;
pause(17);
:6=flash1;
pause(17);
:7=flash1;
pause(17);
}
else
{
//stop waterfall
//and clear Hotpants
reset();
canvas();
}
}