Skip to content

Instantly share code, notes, and snippets.

@dashaw92
dashaw92 / caesar-cipher.rs
Last active October 23, 2017 19:45 — forked from Xinayder/caesar-cipher.rs
Caesar's cipher implemented in Rust
// Caesar's cipher implemented in Rust
// Made by Xinayder with the help of folks from #rust at irc.mozilla.org
//
fn encrypt(msg: &str, shift: u32) -> String {
let alphabet_upper: &str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
let alphabet_lower: &str = "abcdefghijklmnopqrstuvwxyz";
let mut result: String = String::new();
if msg.trim().is_empty() {
return msg.to_owned()
@dashaw92
dashaw92 / mahjong_board.rs
Last active February 1, 2017 17:27 — forked from anonymous/playground.rs
My mahjong board implementation prototype
use std::collections::HashMap;
use std::fmt;
/*
Hello, this is my prototype for storing boards in my mahjong project.
I defined the Board as a struct, and TileType as an enum with both an Empty option and a Used struct option
The entire game board is stored in a HashMap<i32, Vec<TileType>>
^-layer ^-Allows me to easily see if a tile is empty or not (empty spot on board)
The layer refers to what level of the game board the Vec<TileType> is on.