Carpet is a programming language created in 1997 by Giandomenico Spezzano and Domenico Talia.
#2424on PLDB | 27Years Old |
This paper describes CARPET, a high-level programming language based on the cellular automata model. CARPET is a programming language designed to support the development of parallel high performance software. It exploits the computing power of a highly parallel computer releasing a user from using explicit parallel constructs. A CARPET implementation has been used for programming cellular algorithms in the CAMEL parallel environment. By CARPET a user might write programs to describe the actions of thousands of simple active agents interacting locally, then the CAMEL environment allows a user to observe the global complex evolution that arises from their parallel execution and their local interactions.
cadef
{
dimension 2;
radius 1;
state (short which, rand, gas);
neighbor Margolus[9]([1,0]East,[1,1]SE,[0,1]South,[-1,1]SO,
[-1,0]West,[-1,-1]NW,[0,-1]North,[1,-1] NE,[1,0] East);
}
int i; short temp, temprand;
{
if((cell_which == 0 && step %2 == 1)||(cell_which == 3 && step % 2 == 0))
{ temprand = 0;
for(i=0; i < 3; i++)
temprand = temprand + Margolus_rand[i];
temprand = temprand + cell_rand;
if (temprand % 2 == 1)
update(cell_gas, South_gas);
else
update(cell_gas, East_gas);
} else
if((cell_which == 1 && step % 2 == 1)||(cell_which == 2 && step % 2 == 0))
{ temprand = 0;
for(i=2; i < 5; i++)
temprand = temprand + Margolus_rand[i];
temprand = temprand + cell_rand;
if (temprand % 2 == 1)
update(cell_gas, West_gas);
else
update(cell_gas, South_gas);
} else
if((cell_which == 3 && step %2 == 1)||(cell_which == 0 && step % 2 == 0))
{ temprand = 0;
for(i=4; i < 7; i++)
temprand = temprand + Margolus_rand[i];
temprand = temprand + cell_rand;
if (temprand % 2 == 1)
update(cell_gas, North_gas);
else
update(cell_gas, West_gas);
} else
{ temprand = 0;
for (i=6; i < 9; i++)
temprand= temprand + Margolus_rand[i];
temprand = temprand + cell_rand;
if (temprand % 2 == 1)
update(cell_gas, East_gas);
else
update(cell_gas, North_gas);
}
temp = (cell_rand + East_rand + North_rand + West_rand + South_rand ) % 2
up