Skip to content

chinmaydd/Sandpile

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sandpile

Sandpile implementation in Rust. WIP.

Build Status

Usage Example

extern crate sandpile;
use sandpile::Sandpile;

fn main() {
    let rows = 3;
    let cols = 3;

    // Create a new sandpile.
    let a = Sandpile::new(rows, cols, Some(vec![1,2,3,1,2,3,1,2,3]));

    // Create another sandpile.
    // Since no initialization data is provided,
    // the sandpile will be populated with 0s
    let b = Sandpile::new(rows, cols, None);

    // We have overloaded the '+' operator for sandpiles.
    let c = a + b;

    println!("{}", c);
}
/*
Output: 
1 | 2 | 3 | 
1 | 2 | 3 | 
1 | 2 | 3 | 
*/

License

MIT

About

Implementation of Sandpile structure in Rust!

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages