SI 413 Fall 2021 / Project


This is the archived website of SI 413 from the Fall 2021 semester. Feel free to browse around; you may also find more recent offerings at my teaching page.

Rust

The Rust language was first created by a Mozilla employee in 2006. It was later adopted by the whole Mozilla organization, and subsequently developed a huge following of community support. The main idea is to make a language that looks and behaves kind of like C++, but with significant improvements to memory safety and parallelism. So things like null pointer exceptions, tack overflows, and seg faults should be impossible in the language, and parallelism is built-in without allowing for race conditions between threads.

Useful Links

  • Rust is under very active development, with a huge community producing lots of useful documentation. Just go to the Rust language homepage to find some great learning resources.
  • Wikipedia page
  • Dr. Roche's version of the 99 bottles of beer program in Rust, inspired by this version which doesn't follow the complete lyrics:
    trait Lyrics {
        fn bottles(&self, bool) -> Self;
        fn take(&self) -> Self;
        fn wall(&self) -> Self;
        fn mid(&self) -> Self;
        fn end(&self);
    }
    
    impl Lyrics for u32 {
        fn bottles(&self, cap:bool) -> u32 {
            match *self {
                0 => print!("{}o more bottles of beer", if cap {"N"} else {"n"}),
                1 => print!("{} bottle of beer", self),
                _ => print!("{} bottles of beer", self)
            }
            *self
        }
    
        fn take(&self) -> u32 {
            match *self {
                0 => { print!("Go to the store and buy some more, "); 99 }
                _ => { print!("Take one down and pass it around, "); *self - 1 }
            }
        }
    
        fn wall(&self) -> u32 {
            print!(" on the wall");
            *self
        }
    
        fn mid(&self) -> u32 {
            print!(", ");
            *self
        }
    
        fn end(&self) {
            println!(".");
        }
    }
    
    fn main() {
        for i in (0..100).rev() {
            i.bottles(true).wall().mid().bottles(false).end();
            i.take().bottles(false).wall().end();
            println!();
        }
    }

Tools

We will use version 1.25 of the Rust compiler for this project, although similar versions will probably also be compatible.

Everything you need is already installed on CS department lab machines.

To install on your virtual machine, follow these steps:

  1. Run sudo apt install -y rustc rust-doc cargo
  2. Try running rustc --version to check the installation worked.

How I will run your code

The programs you submit should be in a single file called proj.rs, for either part of the project. I will test your code by running the following commands using the software available in the lab environment or using the instructions above:

rustc proj.rs
./proj

Phase 1 Requirements

For this language, you need to implement modifications B,C,D,F,G,H, and I. See the Phase 1 page for details on what this means.

Phase 2

See the Phase 2 Page for the list of suggested problems. Of the ones listed, I recommend the following as being most well-suited for Rust:

  1. Make
  2. Image Creator
  3. TODO list
  4. Game with hidden agenda
  5. Guess the language
  6. Sports Ticker
  7. Music Maker
  8. ??? (you choose!)