aoc

My solutions for the Advent of Code
git clone https://git.tronto.net/aoc
Download | Log | Files | Refs | README

common.rs (217B)


      1 pub fn value(c: char) -> i64 {
      2     match c {
      3         'a'..='z' => (c as i64) - ('a' as i64) + 1,
      4         'A'..='Z' => (c as i64) - ('A' as i64) + 27,
      5         _ => panic!("Error: unexpected character '{}'", c)
      6     }
      7 }