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
macro_rules! iter { | |
($item:expr) => (std::iter::once($item)); | |
($item:expr, $($rest:tt)*) => (std::iter::once($item).chain(iter!($($rest)*))); | |
} | |
use std::collections::*; | |
#[derive(PartialOrd, Ord, PartialEq, Eq, Clone, Copy, Hash, Debug)] | |
enum Unit { | |
Elf, | |
Gnome, | |
} |
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
const OPERATIONS: [fn(usize, usize, usize, usize) -> usize; 16] = [ | |
|a, ra, b, rb| ra+rb, // addr | |
|a, ra, b, rb| ra+b, // addi | |
|a, ra, b, rb| ra*rb, // mulr | |
|a, ra, b, rb| ra*b, // muli | |
|a, ra, b, rb| ra & rb, // banr | |
|a, ra, b, rb| ra & b, // bani | |
|a, ra, b, rb| ra | rb, // borr | |
|a, ra, b, rb| ra | b, // bori | |
|a, ra, _, rb| ra, // setr |
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
pub trait TypeName { | |
const NAME: &'static str; | |
} | |
macro_rules! typename { | |
($($typ:ty,)*) => { | |
$(impl TypeName for $typ { | |
const NAME: &'static str = stringify!($typ); | |
})* | |
} |
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
#!/usr/bin/env bash | |
declare -A small=( | |
['W']='ⱽ' | |
['A']='ᴬ' | |
['B']='ᴮ' | |
['D']='ᴰ' | |
['E']='ᴱ' | |
['G']='ᴳ' | |
['H']='ᴴ' |
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
[package] | |
name = "bork" | |
version = "0.1.0" | |
authors = ["Matthew Tran <0e4ef622@gmail.com>"] | |
edition = "2018" | |
[dependencies] | |
# conrod_core = "0.63.0" | |
# conrod_piston = "0.63.0" | |
conrod_core = { git = "https://github.com/tdaffin/conrod", branch = "fix_crop" } |
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
from hell import * | |
y (lambda f: lambda n: | |
n | |
(lambda x: lambda x: | |
f (pred (n)) (lambda x: | |
and_ (dividesBy (n) (nm(3))) (dividesBy (n) (nm(5))) | |
(prnts ("FizzBuzz")) | |
(dividesBy (n) (nm(3)) | |
(prnts ("Fizz")) |
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::*; | |
pub fn part1(input: &str) -> usize { | |
let mut graph = HashMap::new(); | |
for line in input.lines() { | |
let mut s = line.split(")"); | |
let c = s.next().unwrap(); | |
let o = s.next().unwrap(); |
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::io::BufRead; | |
fn main() { | |
let reader = std::io::BufReader::new(std::fs::File::open(std::env::args().nth(1).unwrap()).unwrap()); | |
let mut input = String::new(); | |
for line in reader.lines() { | |
for ch in line.unwrap().chars() { | |
match ch { | |
'#' => break, | |
' ' | '\t' | '\r' | '\n' => (), | |
c => input.push(c), |
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
pub fn part1(input: &str) -> isize { | |
let mut max = 0isize; | |
let mut phases = [0,0,0,0,0]; | |
for a in 0..5 { | |
for b in 0..5 { | |
if a==b { continue;} | |
for c in 0..5 { | |
if c==a { continue;} | |
if c==b { continue;} | |
for d in 0..5 { |
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::VecDeque; | |
#[derive(Copy, Clone, PartialEq, Eq, Debug)] | |
pub enum Status { | |
Ready, | |
WaitingForInput, | |
Finished, | |
} | |
#[derive(Clone, Debug)] |