This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |