This file contains hidden or 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
x = sum(load("in.txt")(:) == [0:8])'; | |
A = diag(ones(1, 8), 1); | |
A(9, 1) = 1; | |
A(7, 1) = 1; | |
format rat | |
sum(A^80*x) | |
sum(A^256*x) |
This file contains hidden or 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 aoc12 | |
import "core:fmt" | |
import "core:slice" | |
import "core:strings" | |
when ODIN_DEBUG { | |
input :: `start-A | |
start-b | |
A-c |
This file contains hidden or 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::ops::{Index, IndexMut}; | |
use itertools::Itertools; | |
struct Bitmap { | |
rows: usize, | |
cols: usize, | |
backing: Vec<bool>, | |
boundary: bool, | |
} |
This file contains hidden or 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 itertools::Itertools; | |
use std::collections::HashSet; | |
const N6: [(i64, i64, i64); 6] = [ | |
( 1, 0, 0), (0, 1, 0), (0, 0, 1), | |
(-1, 0, 0), (0, -1, 0), (0, 0, -1) | |
]; | |
const N14: [(i64, i64, i64); 18]= [ | |
( 1, 0, 0), (0, 1, 0), ( 0, 0, 1), | |
(-1, 0, 0), (0, -1, 0), ( 0, 0, -1), |
This file contains hidden or 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 main | |
import "core:os" | |
import "core:fmt" | |
import "core:slice" | |
import "core:mem" | |
import "core:strings" | |
import "core:strconv" | |
mix :: proc (numbers: []int, mix: int) -> (result: int) { |
This file contains hidden or 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 main | |
import "core:fmt" | |
import "core:math" | |
import "core:mem" | |
import "core:os" | |
import "core:slice" | |
import "core:unicode" | |
import "core:strconv" | |
import "core:strings" |
This file contains hidden or 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 main | |
import "core:os" | |
import "core:strings" | |
import "core:fmt" | |
import "core:slice" | |
import "core:strconv" | |
import "core:time" | |
State :: enum u8 { |
This file contains hidden or 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
; syntax M68k | |
Font_height equ 10 | |
Font_width equ 8 | |
font: | |
dcb.b Font_height*(32-0),$55; | |
; spc | |
dc.b %00000000 | |
dc.b %00000000 | |
dc.b %00000000 | |
dc.b %00000000 |
This file contains hidden or 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
#include <stdio.h> | |
#include <assert.h> | |
#include <string.h> | |
#include <stdbool.h> | |
#include <stdlib.h> | |
#define ENSURE(p) ({__typeof(p) _p = p; assert(_p); _p; }) | |
typedef struct { | |
size_t dot; |
This file contains hidden or 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
n ← 6 | |
k ← 4 | |
d ← ↕n | |
poly ← (0.5×d+1)≍¨(-0.5×d-1) | |
limits ← ⌈{a‿b‿c: (2×a)÷˜-b-√(טb)-4×a×c}¨ poly ∾⌜ -10⋆k-1‿0 | |
values ← poly {+´𝕨×(ט𝕩)‿𝕩}¨ {a‿b:<a+↕b-a}˘limits # the numbers to be tested | |
perm ← (n-1) ∾˘˜ (≍↕0){∾˝(0∾˘1+𝕩)⊸⊏˘⍒˘=⌜˜↕𝕨}´-⟜↕n-1 # distinct cycles of number class | |
{ |
OlderNewer