Skip to content

Instantly share code, notes, and snippets.

View solson's full-sized avatar

Scott Olson solson

  • Canada/Ireland
  • 14:08 (UTC +01:00)
View GitHub Profile
@solson
solson / playground.rs
Created December 15, 2017 19:41 — forked from anonymous/playground.rs
Rust code shared from the playground
use std::cmp::max;
const INPUT: &str = "se,ne,se,ne,n,n,n,n,ne,nw,nw,n,nw,nw,sw,sw,sw,sw,sw,sw,sw,sw,s,sw,sw,sw,ne,sw,sw,s,n,s,s,s,s,nw,s,s,s,s,s,se,s,s,n,s,n,se,se,s,se,s,s,s,se,nw,se,se,se,se,se,ne,se,se,se,se,se,n,se,se,se,ne,se,se,se,se,se,se,n,se,se,ne,ne,ne,n,ne,ne,ne,nw,ne,ne,ne,ne,ne,nw,ne,ne,nw,ne,ne,ne,se,ne,ne,ne,sw,se,sw,ne,n,s,sw,ne,n,n,ne,ne,n,ne,ne,n,n,n,n,n,n,se,sw,ne,n,n,n,ne,n,nw,n,ne,ne,ne,n,n,n,n,n,ne,n,ne,sw,nw,ne,sw,nw,n,n,s,nw,n,n,n,n,n,n,n,nw,s,sw,nw,n,se,se,nw,s,nw,nw,nw,nw,nw,se,n,nw,n,s,sw,n,nw,sw,n,nw,se,nw,n,nw,n,nw,sw,n,nw,ne,se,n,nw,ne,nw,nw,se,n,n,nw,nw,se,n,nw,sw,nw,n,n,nw,nw,s,nw,ne,nw,nw,nw,ne,nw,se,n,nw,nw,sw,nw,sw,nw,nw,se,sw,sw,nw,s,nw,nw,nw,nw,sw,n,ne,nw,s,nw,nw,sw,nw,nw,sw,s,nw,nw,nw,se,nw,nw,sw,sw,nw,se,ne,nw,nw,sw,nw,sw,sw,nw,sw,s,sw,sw,sw,sw,nw,n,nw,nw,sw,sw,nw,nw,nw,nw,sw,sw,sw,sw,sw,sw,sw,sw,sw,sw,nw,sw,sw,se,sw,sw,sw,nw,sw,sw,sw,sw,sw,sw,nw,sw,sw,s,sw,se,sw,sw,sw,ne,n,sw,sw,sw,sw,sw,sw,se,sw,sw,n,sw,sw,s,sw,n,se,s,sw,s,sw,sw,sw,nw,sw,n,s,sw,sw,s,sw,sw,sw,sw,sw,s,
@solson
solson / playground.rs
Created December 15, 2017 20:15 — forked from anonymous/playground.rs
Rust code shared from the playground
// const STARTING_A: i64 = 65;
// const STARTING_B: i64 = 8921;
const STARTING_A: i64 = 634;
const STARTING_B: i64 = 301;
const FACTOR_A: i64 = 16807;
const FACTOR_B: i64 = 48271;
const DIVISOR_A: i64 = 4;
@solson
solson / playground.rs
Created December 15, 2017 20:44 — forked from anonymous/playground.rs
Rust code shared from the playground
#[derive(Debug)]
struct Layer {
depth: usize,
range: usize,
}
const _SAMPLE_INPUT: &str = "\
0: 3
1: 2
4: 4
@solson
solson / playground.rs
Created December 15, 2017 22:06 — forked from anonymous/playground.rs
Rust code shared from the playground
use std::collections::{HashSet, VecDeque};
const _INPUT: &str = "\
0 <-> 2
1 <-> 1
2 <-> 0, 3, 4
3 <-> 2, 4
4 <-> 2, 3, 6
5 <-> 6
6 <-> 4, 5\
@solson
solson / playground.rs
Created December 15, 2017 22:09 — forked from anonymous/playground.rs
Rust code shared from the playground
use std::collections::VecDeque;
const _INPUT: &str = "\
0 <-> 2
1 <-> 1
2 <-> 0, 3, 4
3 <-> 2, 4
4 <-> 2, 3, 6
5 <-> 6
6 <-> 4, 5\
@solson
solson / playground.rs
Created December 15, 2017 22:27 — forked from anonymous/playground.rs
Rust code shared from the playground
const _INPUT: &str = "3,4,1,5";
const INPUT: &str = "63,144,180,149,1,255,167,84,125,65,188,0,2,254,229,24";
const SIZE: usize = 256;
fn main() {
let mut circle: Vec<usize> = (0..SIZE).collect();
let mut pos = 0;
let mut skip_size = 0;
@solson
solson / playground.rs
Created December 16, 2017 09:55 — forked from anonymous/playground.rs
Rust code shared from the playground
const _INPUT: &str = "1,2,4";
const INPUT: &str = "63,144,180,149,1,255,167,84,125,65,188,0,2,254,229,24";
const SIZE: usize = 256;
const ROUNDS: usize = 64;
fn main() {
let mut circle: Vec<usize> = (0..SIZE).collect();
let mut pos = 0;
let mut skip_size = 0;
@solson
solson / playground.rs
Created December 16, 2017 10:37 — forked from anonymous/playground.rs
Rust code shared from the playground
#![feature(i128_type)]
use std::collections::VecDeque;
const _INPUT: &str = "flqrgnkx";
const INPUT: &str = "wenycdww";
const SIZE: usize = 256;
const ROUNDS: usize = 64;
@solson
solson / playground.rs
Created December 16, 2017 14:42 — forked from anonymous/playground.rs
Rust code shared from the playground
use std::str;
use self::State::*;
enum State {
Normal,
Escaped,
Garbage,
}
const _INPUT: &str = "{{<!!>},{<!!>},{<!!>},{<!!>}}";
@solson
solson / playground.rs
Created December 16, 2017 15:07 — forked from anonymous/playground.rs
Rust code shared from the playground
use std::collections::HashMap;
use std::cmp::Ordering::*;
use std::cmp::max;
const _INPUT: &str = "\
b inc 5 if a > 1
a inc 1 if b < 5
c dec -10 if a >= 1
c inc -20 if c == 10\
";