From 2222d48075ab6d225f3cff7b444e35c70c7472fb Mon Sep 17 00:00:00 2001 From: Lily Lin Date: Mon, 24 Oct 2022 22:46:06 -0700 Subject: Add entries --- entries/lilylin/fractran/src/core.rs | 40 ++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 entries/lilylin/fractran/src/core.rs (limited to 'entries/lilylin/fractran/src/core.rs') diff --git a/entries/lilylin/fractran/src/core.rs b/entries/lilylin/fractran/src/core.rs new file mode 100644 index 0000000..2595d48 --- /dev/null +++ b/entries/lilylin/fractran/src/core.rs @@ -0,0 +1,40 @@ +use num_traits::Pow; + +pub type FracSize = u16; + +#[derive(Debug)] +pub struct Program { + pub fractions: Vec<(FracSize, FracSize)>, + pub initial: u64, +} + +impl Program { + pub fn fibonacci(i: u32) -> Program { + Program { + fractions: vec![ + (17, 65), + (133, 34), + (17, 19), + (23, 17), + (2233, 69), + (23, 29), + (31, 23), + (74, 341), + (31, 37), + (41, 31), + (129, 287), + (41, 43), + (13, 41), + (1, 13), + (1, 3), + ], + initial: 78 * 5u64.pow(i), + } + } +} + +pub trait FractranEngine: IntoIterator +where + Value: From, +{ +} -- cgit v1.2.3-70-g09d2 From bea8092ecca8f4bf61a4df88c06f4eeb61ab3a56 Mon Sep 17 00:00:00 2001 From: Lily Lin Date: Mon, 24 Oct 2022 22:52:30 -0700 Subject: Cleanup --- .gitignore | 1 + entries/lilylin/cursed-x86/README.md | 1 + entries/lilylin/fractran/src/core.rs | 4 ++++ people.json | 6 +++--- 4 files changed, 9 insertions(+), 3 deletions(-) create mode 100644 entries/lilylin/cursed-x86/README.md (limited to 'entries/lilylin/fractran/src/core.rs') diff --git a/.gitignore b/.gitignore index c7e318c..69cff8a 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ node_modules *.log *.pem .DS_Store +entries/lilylin/fractran/target diff --git a/entries/lilylin/cursed-x86/README.md b/entries/lilylin/cursed-x86/README.md new file mode 100644 index 0000000..4cba657 --- /dev/null +++ b/entries/lilylin/cursed-x86/README.md @@ -0,0 +1 @@ +![A very cursed looking control flow graph with many many blocks, obviously something much more complicated than what a normal fib would be](./control_flow_graph.png) diff --git a/entries/lilylin/fractran/src/core.rs b/entries/lilylin/fractran/src/core.rs index 2595d48..26e1a67 100644 --- a/entries/lilylin/fractran/src/core.rs +++ b/entries/lilylin/fractran/src/core.rs @@ -9,6 +9,10 @@ pub struct Program { } impl Program { + // http://lomont.org/posts/2017/fractran/ + // A lesser known Conway FRACTRAN program is FIBONACCIGAME: + // `{17/65, 133/34, 17/19, 23/17, 2233/69, 23/29, 31/23, 74/341, 31/37, 41/31, 129/287, 41/43, 13/41, 1/13, 1/3}` + // Starting with `78*5^(n-1)`, it halts on `2^Fn` where Fn is the nth [Fibonacci number] pub fn fibonacci(i: u32) -> Program { Program { fractions: vec![ diff --git a/people.json b/people.json index 6a1852d..7c9b8a1 100644 --- a/people.json +++ b/people.json @@ -90,11 +90,11 @@ "entries": [ { "name": "fractran", - "link": "./entries/lilylin/fractran/" + "link": "./entries/lilylin/fractran/src/core.rs" }, { - "name": "cursed x86 (look at the control flow graph)", - "link": "./entries/lilylin/cursed-x86" + "name": "cursed-x86", + "link": "./entries/lilylin/cursed-x86/" }, { "name": "mov", -- cgit v1.2.3-70-g09d2