@@ -2,13 +2,14 @@ use core::panic;
2use murmur3::murmur3_32;
2use murmur3::murmur3_32;
3use num_integer::Integer;
3use num_integer::Integer;
5 collections::BTreeMap,
6 collections::BTreeMap,
6 iter::{once, repeat_n, zip},
7 iter::{once, repeat_n, zip},
10use crate::{
11use crate::{
11− interpreter::{slam_pulled_gate, InterpreterContext, TTanks},
12+ interpreter::{slam_pulled_gate, InterpreterContext, TTanks, EMPTY_TANKS},
12 noun::{self, cell, Atom, Edge, Hair, Nail, Noun},
13 noun::{self, cell, Atom, Edge, Hair, Nail, Noun},
@@ -107,6 +108,10 @@ pub fn generate_jets() -> Jets {
107 (124976064672625230427889101290245200507, TRIP),
108 (124976064672625230427889101290245200507, TRIP),
108 (4078279288073906183633157465551067635, MUK),
109 (4078279288073906183633157465551067635, MUK),
109 (261900159748071234702685239353558471892, MUG),
110 (261900159748071234702685239353558471892, MUG),
111+ (198191257620924788695943358402651905954, AOR),
112+ (299422828284010240628877806738195667652, DOR),
113+ (166326796552601297695313176538120818632, GOR),
114+ (7942398240152905363972500667649380756, MOR),
@@ -1007,6 +1012,105 @@ static MUK: Jet = |_ctx, n| {
1007 Ok(Rc::new(Noun::from_u32(muk(seed, len, key))))
1012 Ok(Rc::new(Noun::from_u32(muk(seed, len, key))))
1015+static AOR: Jet = |ctx, n| {
1016+ let (a, b) = n.as_cell().ok_or(EMPTY_TANKS)?;
1019+ Ok(ctx.nouns.y.clone())
1021+ match (a.borrow(), b.borrow()) {
1022+ (Noun::Cell { .. }, Noun::Atom(_)) => Ok(ctx.nouns.n.clone()),
1023+ (Noun::Cell { p: a_p, q: a_q, .. }, Noun::Cell { p: b_p, q: b_q, .. }) => {
1025+ AOR(ctx, &cell(a_q, b_q))
1027+ AOR(ctx, &cell(a_p, b_p))
1030+ (Noun::Atom(_), Noun::Cell { .. }) => Ok(ctx.nouns.y.clone()),
1031+ (Noun::Atom(a), Noun::Atom(b)) => {
1032+ let a = a.to_bytes_le();
1033+ let b = b.to_bytes_le();
1037+ let c = a.get(i).unwrap_or(&0);
1038+ let d = b.get(i).unwrap_or(&0);
1044+ return Ok(ctx.nouns.y.clone());
1046+ return Ok(ctx.nouns.n.clone());
1055+static DOR: Jet = |ctx, n| {
1056+ let (a, b) = n.as_cell().ok_or(EMPTY_TANKS)?;
1059+ Ok(ctx.nouns.y.clone())
1061+ match (a.borrow(), b.borrow()) {
1062+ (Noun::Cell { .. }, Noun::Atom(_)) => Ok(ctx.nouns.n.clone()),
1063+ (Noun::Cell { p: a_p, q: a_q, .. }, Noun::Cell { p: b_p, q: b_q, .. }) => {
1065+ DOR(ctx, &cell(a_q, b_q))
1067+ DOR(ctx, &cell(a_p, b_p))
1070+ (Noun::Atom(_), Noun::Cell { .. }) => Ok(ctx.nouns.y.clone()),
1071+ (Noun::Atom(a), Noun::Atom(b)) => {
1073+ Ok(ctx.nouns.y.clone())
1075+ Ok(ctx.nouns.n.clone())
1082+static GOR: Jet = |ctx, n| {
1083+ let (a, b) = n.as_cell().ok_or(EMPTY_TANKS)?;
1091+ Ok(ctx.nouns.y.clone())
1093+ Ok(ctx.nouns.n.clone())
1098+static MOR: Jet = |ctx, n| {
1099+ let (a, b) = n.as_cell().ok_or(EMPTY_TANKS)?;
1100+ let c = Noun::from_u32(a.mug()).mug();
1101+ let d = Noun::from_u32(b.mug()).mug();
1107+ Ok(ctx.nouns.y.clone())
1109+ Ok(ctx.nouns.n.clone())
1010static JUST: DoubleJet = |ctx, n, m| {
1114static JUST: DoubleJet = |ctx, n, m| {
1011 let char = n.as_atom()?;
1115 let char = n.as_atom()?;
1012 let nail = m.as_nail()?;
1116 let nail = m.as_nail()?;