Warm up
- I used
UInt
s, but it seems Julia expects one to just useInt
s for any decimal integers, signed or otherwise.
Strict parser
Loops and moduli
Strict parser
"Assembley" interpreter
Loops
- see nacci.jl
Cellular automaton with steady state
Number theory
- Chinese remainder theorem
- Compute using proof construction. Easy proof, although not most efficient - two links:
Binary numbers
- Bitmask
- Bit twiddling
- You can prove this sequence does not evolve to a repeating pattern
- Array too slow/big? Try a dictionary.
The naivest brute force is factorial time, so you have to think of a moderately more clever algorithm.
Cellular automata: B3/S23 (Conway's Game of Life) in 3 and 4 dimensions
- Implemented this one with hash sets for a change
- Moore neighbourhood
Recursive decent parser for ficticious arithmetic
- Consider shunting-yard algorithm
More parsing
- I did part one by generating all possible strings and comparing messages to these. This was too slow for part two, so I used:
- CYK algorithm
- pseudocode algorithm
- visualisation
- i19t0
A -> BC B -> a C -> BD | DB D -> b
- i19t0
- Rules must be in CNF
- also
- see grammar.jl
Jigsaw
Sets
- To print out the gameplay, use
JULIA_DEBUG="d22" ./d22.jl
Data structures
- I used a circular singly linked list implemented on a (contiguous memory) array. The starting position is not recorded in the "container" (it's a circle). Each element has value given by index and next value in list given by entry.
Hexagonal B2/S12 cellular automaton.
Cryptography