Top 1,000 Features Creators Resources Blog Explorer Download
GitHub icon

Carpet

< >

Carpet is a programming language created in 1997 by Giandomenico Spezzano and Domenico Talia.

#1253on PLDB 27Years Old


Example from the web:
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

View source

- Build the next great programming language About Acknowledgements Extensions Day 626 feedback@pldb.io