Merge remote-tracking branch 'cgyarvin/newdeal' into newdeal

This commit is contained in:
C. Guy Yarvin 2016-01-08 12:47:13 -08:00
commit 645e7dbc42
6 changed files with 36 additions and 246 deletions

View File

@ -221,7 +221,7 @@
u3_noun u3qfu_repo(u3_noun, u3_noun);
u3_noun u3qfu_rest(u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_seek(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_seep(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_sick(u3_noun, u3_noun, u3_noun, u3_noun);
u3_noun u3qfu_shep(u3_noun, const c3_c*, u3_noun, u3_noun);
u3_noun u3qfu_shew(u3_noun, u3_noun);
u3_noun u3qfu_sift(u3_noun, u3_noun, u3_noun);

View File

@ -6,6 +6,19 @@
/* logic
*/
static u3_noun
_fire_vet(u3_noun van)
{
// u3_noun vet = u3j_hook(u3k(van), "vet");
u3_noun vet = u3r_at(u3qfu_van_vet, van);
switch ( vet ) {
case c3n:
case c3y: return vet;
default: return u3m_bail(c3__fail);
}
}
static u3_noun
_fire_mull(u3_noun van,
u3_noun sut,
@ -18,6 +31,9 @@
u3k(gen));
u3_noun ret;
if ( c3n == _fire_vet(van) ) {
ret = c3y;
}
if ( c3y == u3qdi_has(rib, key) ) {
ret = c3y;
}
@ -27,8 +43,11 @@
u3qfu_van_rib,
u3k(rob),
0);
ret = u3qfu_mull(von, sut, c3__noun, dox, gen);
u3_noun mul = u3qfu_mull(von, sut, c3__noun, dox, gen);
ret = c3y;
u3z(mul);
u3z(von);
u3z(rob);
}

View File

@ -40,34 +40,6 @@
}
}
static u3_noun
_mint_foil(u3_noun pok)
{
u3_noun p_pok = u3h(pok);
u3_noun q_pok = u3t(pok);
u3_noun ret;
if ( c3y == u3h(q_pok) ) {
u3_noun pq_pok = u3t(q_pok);
ret = u3nc(u3k(p_pok),
u3nc(u3_nul,
u3nc(u3nc(u3k(pq_pok),
u3nt(c3__elm, u3_nul, 1)),
u3_nul)));
}
else {
u3_noun pq_pok = u3h(u3t(q_pok));
u3_noun qq_pok = u3t(u3t(q_pok));
ret = u3nc(u3k(p_pok),
u3nc(u3k(pq_pok),
u3k(qq_pok)));
}
u3z(pok);
return ret;
}
static u3_noun
_mint_cond(u3_noun pex,
u3_noun yom,
@ -656,8 +628,7 @@
case c3__cnts: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mint_used();
{
u3_noun sec = u3qfu_seek(van, sut, c3__read, p_gen);
u3_noun lar = _mint_foil(sec);
u3_noun lar = u3qfu_seek(van, sut, c3__read, p_gen);
u3_noun p_lar = u3h(lar);
u3_noun q_lar = u3t(lar);
u3_noun pq_lar = u3h(q_lar);

View File

@ -9,19 +9,6 @@
static u3_noun
_mull_in(u3_noun, u3_noun, u3_noun, u3_noun, u3_noun);
static u3_noun
_mull_vet(u3_noun van)
{
// u3_noun vet = u3j_hook(u3k(van), "vet");
u3_noun vet = u3r_at(u3qfu_van_vet, van);
switch ( vet ) {
case c3n:
case c3y: return vet;
default: return u3m_bail(c3__fail);
}
}
static u3_noun
_mull_core(u3_noun pac,
u3_noun con)
@ -55,34 +42,6 @@
return ret;
}
static u3_noun
_mull_foil(u3_noun pok)
{
u3_noun p_pok = u3h(pok);
u3_noun q_pok = u3t(pok);
u3_noun ret;
if ( c3y == u3h(q_pok) ) {
u3_noun pq_pok = u3t(q_pok);
ret = u3nc(u3k(p_pok),
u3nc(u3_nul,
u3nc(u3nc(u3k(pq_pok),
u3nt(c3__elm, u3_nul, 1)),
u3_nul)));
}
else {
u3_noun pq_pok = u3h(u3t(q_pok));
u3_noun qq_pok = u3t(u3t(q_pok));
ret = u3nc(u3k(p_pok),
u3nc(u3k(pq_pok),
u3k(qq_pok)));
}
u3z(pok);
return ret;
}
static u3_noun
_mull_coke(u3_noun nug)
{
@ -598,14 +557,12 @@
case c3__cnts: u3x_cell(u3t(gen), &p_gen, &q_gen);
_mull_used();
{
u3_noun sec = u3qfu_seek(van, sut, c3__read, p_gen);
u3_noun suc = u3qfu_seek(van, dox, c3__read, p_gen);
u3_noun lar = _mull_foil(sec);
u3_noun lar = u3qfu_seek(van, sut, c3__read, p_gen);
u3_noun vug = u3qfu_seek(van, dox, c3__read, p_gen);
u3_noun p_lar = u3h(lar);
u3_noun q_lar = u3t(lar);
u3_noun pq_lar = u3h(q_lar);
u3_noun qq_lar = u3t(q_lar);
u3_noun vug = _mull_foil(suc);
u3_noun p_vug = u3h(vug);
u3_noun q_vug = u3t(vug);
u3_noun pq_vug = u3h(q_vug);
@ -728,14 +685,7 @@
u3_noun dox,
u3_noun gen)
{
if ( c3n == _mull_vet(van) ) {
return c3y;
} else {
u3_noun mul = _mull_in(van, sut, gol, dox, gen);
u3z(mul);
return c3y;
}
return _mull_in(van, sut, gol, dox, gen);
}
/* boilerplate

View File

@ -73,34 +73,6 @@
return ret;
}
static u3_noun
_play_foil(u3_noun pok)
{
u3_noun p_pok = u3h(pok);
u3_noun q_pok = u3t(pok);
u3_noun ret;
if ( c3y == u3h(q_pok) ) {
u3_noun pq_pok = u3t(q_pok);
ret = u3nc(u3k(p_pok),
u3nc(u3_nul,
u3nc(u3nc(u3k(pq_pok),
u3nt(c3__elm, u3_nul, 1)),
u3_nul)));
}
else {
u3_noun pq_pok = u3h(u3t(q_pok));
u3_noun qq_pok = u3t(u3t(q_pok));
ret = u3nc(u3k(p_pok),
u3nc(u3k(pq_pok),
u3k(qq_pok)));
}
u3z(pok);
return ret;
}
static u3_noun
_play_edit(u3_noun van,
u3_noun sut,
@ -362,8 +334,7 @@
case c3__cnts: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
u3_noun sec = u3qfu_seek(van, sut, c3__read, p_gen);
u3_noun lar = _play_foil(sec);
u3_noun lar = u3qfu_seek(van, sut, c3__read, p_gen);
u3_noun q_lar = u3t(lar);
u3_noun qq_lar = u3t(q_lar);
u3_noun mew = q_gen;

View File

@ -4,123 +4,6 @@
#include "all.h"
/* logic
*/
static u3_noun
_seek_flat(u3_noun wob)
{
if ( u3_nul == wob ) {
return u3_nul;
} else {
u3_noun i_wob = u3h(wob);
u3_noun t_wob = u3t(wob);
return u3nc(u3nc(u3k(u3h(i_wob)),
u3nt(c3__ash, u3_nul, 1)),
_seek_flat(t_wob));
}
}
u3_noun
_cqfu_seek(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun hyp)
{
c3_assert(0);
if ( u3_nul == hyp ) {
return u3nt
(1, c3y, u3k(sut));
}
else if ( c3n == u3du(hyp) ) {
return u3m_bail(c3__fail);
}
else {
u3_noun i_hyp = u3h(hyp);
u3_noun t_hyp = u3t(hyp);
u3_noun zar;
u3_noun p_zar, q_zar;
u3_noun yip, syp, ret;
if ( c3y == u3du(i_hyp) ) {
yip = u3k(i_hyp);
} else {
yip = u3nt(c3n, 0, u3nc(u3_nul, u3k(i_hyp)));
}
zar = _cqfu_seek(van, sut, way, t_hyp);
u3r_cell(zar, &p_zar, &q_zar);
if ( c3y == u3h(q_zar) ) {
syp = u3k(u3t(q_zar));
} else {
u3_noun pq_zar, qq_zar;
u3_noun wip;
u3r_cell(u3t(q_zar), &pq_zar, &qq_zar);
wip = _seek_flat(qq_zar);
syp = u3qfu_fire(van, sut, wip);
u3z(wip);
}
if ( c3n == u3h(yip) ) {
u3_noun p_yip, q_yip, hud;
if ( c3n == u3r_cell(u3t(yip), &p_yip, &q_yip) ) {
return u3m_bail(c3__fail);
}
hud = u3qfu_fink(van, syp, p_yip, way, q_yip);
{
u3_noun p_hud, q_hud;
u3r_cell(hud, &p_hud, &q_hud);
ret = u3nc(u3qc_peg(p_zar, p_hud),
u3k(q_hud));
u3z(hud);
}
}
else {
u3_noun p_yip = u3t(yip);
if ( c3n == u3ud(p_yip) ) {
return u3m_bail(c3__fail);
}
else {
ret = u3nt(u3qc_peg(p_zar, p_yip),
c3y,
u3qfu_peek(van, syp, way, p_yip));
}
}
u3z(yip);
u3z(syp);
u3z(zar);
return ret;
}
}
/* boilerplate
*/
u3_noun
u3wfu_seek(u3_noun cor)
{
u3_noun sut, way, hyp, van;
if ( (c3n == u3r_mean(cor, u3x_sam_2, &way,
u3x_sam_3, &hyp,
u3x_con, &van,
0)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
{
return u3m_bail(c3__fail);
} else {
return _cqfu_seek(van, sut, way, hyp);
}
}
#if 1
u3_noun
u3qfu_seek(u3_noun van,
u3_noun sut,
@ -137,24 +20,20 @@
u3k(hyp),
0));
}
#else
u3_noun
u3qfu_seek(u3_noun van,
u3qfu_sick(u3_noun van,
u3_noun sut,
u3_noun way,
u3_noun hyp)
{
c3_m fun_m = c3__seek + !!u3r_at(u3qfu_van_vet, van);
u3_noun pro = u3z_find_3(fun_m, sut, way, hyp);
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "sick");
if ( u3_none != pro ) {
return pro;
}
else {
pro = _cqfu_seek(van, sut, way, hyp);
return u3z_save_3(fun_m, sut, way, hyp, pro);
}
return u3n_kick_on(u3i_molt(gat,
u3x_sam_2,
u3k(way),
u3x_sam_3,
u3k(hyp),
0));
}
#endif