Skip to content

Instantly share code, notes, and snippets.

@danielcristofani
danielcristofani / 2025day7a.b
Last active December 7, 2025 18:11
brainfuck solution for Advent of Code, day 7, part 1
[2025day7a.b -- 2025 Advent of Code Day 7 Part 1
(c) 2025 Daniel B. Cristofani
http://brainfuck.org/
This program is licensed under a Creative Commons Attribution-ShareAlike 4.0
International License (http://creativecommons.org/licenses/by-sa/4.0/).
This program solves Advent of Code 2025, Day 7, Part 1.
(https://adventofcode.com/2025/day/7)
Assumes EOF="no change" or EOF=0. No assumptions about cell size.
@danielcristofani
danielcristofani / 2025day6b.b
Created December 7, 2025 07:34
brainfuck solution for Advent of Code 2025, day 6, part 2
[2025day6b.b -- 2025 Advent of Code Day 6 Part 2
(c) 2025 Daniel B. Cristofani
http://brainfuck.org/
This program is licensed under a Creative Commons Attribution-ShareAlike 4.0
International License (http://creativecommons.org/licenses/by-sa/4.0/).
This program solves Advent of Code 2025, Day 6, Part 2.
(https://adventofcode.com/2025/day/6)
Assumes EOF="no change" or EOF=0. No assumptions about cell size.]
@danielcristofani
danielcristofani / 2025day3.b
Last active December 4, 2025 04:53
brainfuck solution for day 3 of Advent of Code 2025
[2025day3.b -- 2025 Advent of Code Day 3
(c) 2025 Daniel B. Cristofani
http://brainfuck.org/
This program is licensed under a Creative Commons Attribution-ShareAlike 4.0
International License (http://creativecommons.org/licenses/by-sa/4.0/).
This program solves Advent of Code 2025, Day 3.
(https://adventofcode.com/2025/day/3)
You can change battery count in parentheses at the start for part 1 or 2.
@danielcristofani
danielcristofani / pearson.b
Created April 10, 2024 11:39
This implements Pearson hashing using the table from Pearson's original paper, and outputs the hash as a byte. Verbose but fairly fast.
>>,[
[[>>]++[-<<]>>]
++++++++[>[>-<-]>[<+>+[-]]<<-[>>+<<-]+>>]
<[-<
<[-<
<[-<
<[-<
<[-<
<[-<
<[-<
@danielcristofani
danielcristofani / day9a.b
Last active December 29, 2022 13:47
Advent of Code, Day 9 part 1, handcoded in brainfuck
[day9a.b -- 2022 Advent of Code Day 9 Part 1
(c) 2022 Daniel B. Cristofani
http://brainfuck.org/
This program is licensed under a Creative Commons Attribution-ShareAlike 4.0
International License (http://creativecommons.org/licenses/by-sa/4.0/).]
[This program solves Advent of Code 2022, Day 9, Part 1.
(https://adventofcode.com/2022/day/9/)
Basic data layout is, roughly:
@danielcristofani
danielcristofani / siercarpet.b
Created April 20, 2021 06:05
Sierpinski Carpet program
[siercarpet.b -- Sierpinski Carpet
(c) 2021 Daniel B. Cristofani
http://brainfuck.org/]
>-->->->>>>>(>>>>>>>>>)+++++[>++++++<-]>+[>+>+++<<-]>+[
[<]<++[<++]--<[>>[-->]>..<<<]>>[[-->]>>--.++.<<]<<<<<<<+[
[--->++++++<[+++>--------->>[->>>]->>>]+<<<+]
>[<->>>[->>>]++++++++++.[-]<<+>+++[-]]<
]>>>->>
]
@danielcristofani
danielcristofani / quine.ook
Created April 2, 2021 09:53
Quine in Ook! (core part taken directly from Erik Bosman's 410-byte brainfuck quine)
Ook! Ook! Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook. Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook. Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook. Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook. Ook. Ook. Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook? Ook. Ook? Ook. Ook. Ook. Ook? Ook
@danielcristofani
danielcristofani / life.b
Last active March 6, 2024 01:21
Game of Life program.
[life.b -- John Horton Conway's Game of Life
(c) 2021 Daniel B. Cristofani
http://brainfuck.org/]
>>>->+>+++++>(++++++++++)[[>>>+<<<-]>+++++>+>>+[<<+>>>>>+<<<-]<-]>>>>[
[>>>+>+<<<<-]+++>>+[<+>>>+>+<<<-]>>[>[[>>>+<<<-]<]<<++>+>>>>>>-]<-
]+++>+>[[-]<+<[>+++++++++++++++++<-]<+]>>[
[+++++++++brainfuck.org-------->>>]+[-<<<]>>>[>>,----------[>]<]<<[
<<<[
>--[<->>+>-<<-]<[[>>>]+>-[+>>+>-]+[<<<]<-]>++>[<+>-]
@danielcristofani
danielcristofani / ackermann.b
Created January 8, 2021 14:14
Ackermann–Péter function
>,>+>>>,+<++++++++[<<<------>>>>------<-]>-[+<]<<[>]<[
<[
->>>>[
<+[->-[[>>]>-<]++++++++++>+]<[-]<<-[+>>]<<
[[>>+<<-]<<]
<<[>+<-]->[<+>>+<-]+>>+>>>>
]<<<[
>>>++<<
]
]>[
@danielcristofani
danielcristofani / brainfuck_function_tutorial.b
Last active March 27, 2021 12:20
A way to do functions in brainfuck.
[How to do functions in brainfuck.
Okay. We'll translate the following program into brainfuck, with no thought of efficiency:
char fib (char a){
switch(a):
case 0: return 0
case 1: return 1
default: return fib(a-2)+fib(a-1)
}