52 lines
1.5 KiB
TeX
Executable File
52 lines
1.5 KiB
TeX
Executable File
% use [nosolutions] flag to hide solutions.
|
|
% use [solutions] flag to show solutions.
|
|
\documentclass[
|
|
nosolutions,
|
|
singlenumbering
|
|
]{../../resources/ormc_handout}
|
|
\usepackage{../../resources/macros}
|
|
|
|
|
|
% Factorial (print x! from x=0 onwards)
|
|
% >++++++++++>>>+>+[>>>+[-[<<<<<[+<<<<<]>>[[-]>[<<+>+>-]<[>+<-]<[>+<-[>+<-[>
|
|
% +<-[>+<-[>+<-[>+<-[>+<-[>+<-[>+<-[>[-]>>>>+>+<<<<<<-[>+<-]]]]]]]]]]]>[<+>-
|
|
% ]+>>>>>]<<<<<[<<<<<]>>>>>>>[>>>>>]++[-<<<<<]>>>>>>-]+>>>>>]<[>++<-]<<<<[<[
|
|
% >+<-]<<<<]>>[->[-]++++++[<++++++++>-]>>>>]<<<<<[<[>+>+<<-]>.<<<<<]>.>>>>]
|
|
%
|
|
% Same, fibonacci:
|
|
% >++++++++++>+>+[
|
|
% [+++++[>++++++++<-]>.<++++++[>--------<-]+<<<]>.>>[
|
|
% [-]<[>+<-]>>[<<+>+>-]<[>+<-[>+<-[>+<-[>+<-[>+<-[>+<-
|
|
% [>+<-[>+<-[>+<-[>[-]>+>+<<<-[>+<-]]]]]]]]]]]+>>>
|
|
% ]<<<
|
|
% ]
|
|
% https://brainfuck.org/fib_explained.b
|
|
%
|
|
% Useful:
|
|
% https://brainfuck.org/
|
|
%
|
|
%
|
|
% +++[[<+>>++<-]>]
|
|
% This sets up the tape in the format 3*n^2, which looks like
|
|
% 3 6 12 24 48 96 192 128 0 0
|
|
% Why is this so important?
|
|
% Let's go down the list:
|
|
% - 3 and 6 are boring
|
|
% - 12: Close to 10 (newline) or 13 (carriage return). Can also be used for the counter for 0-9
|
|
% - 24: Close to 26, the number of letters in the alphabet
|
|
% - 48: ASCII for 0
|
|
% - 96: Close to 97, ASCII for a
|
|
% - 196 and 128: 196-128=64, close to 65, the ASCII for A.
|
|
|
|
|
|
\uptitlel{Advanced 2}
|
|
\uptitler{\smallurl{}}
|
|
\title{Esoteric Programming}
|
|
\subtitle{Prepared by Mark on \today}
|
|
|
|
\begin{document}
|
|
\maketitle
|
|
|
|
\input{parts/00 turing.tex}
|
|
\input{parts/01 befunge.tex}
|
|
\end{document} |