urbit/jets/f/ut_play.c

607 lines
13 KiB
C
Raw Normal View History

2013-09-29 00:21:18 +04:00
/* j/6/play.c
**
*/
#include "all.h"
2014-09-04 07:10:43 +04:00
2013-09-29 00:21:18 +04:00
/* logic
*/
2014-08-21 01:18:34 +04:00
# define _play_used()
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
static u3_noun
_play_in(u3_noun, u3_noun, u3_noun);
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
static u3_noun
2015-12-27 23:26:23 +03:00
_play_bean()
2013-09-29 00:21:18 +04:00
{
2016-01-14 12:52:50 +03:00
return u3kf_fork(u3nt(u3nq(c3__atom, 'f', u3_nul, 0),
u3nq(c3__atom, 'f', u3_nul, 1),
u3_nul));
2015-12-28 23:53:10 +03:00
}
static u3_noun
2015-12-30 00:52:51 +03:00
_play_rock(u3_noun odo, u3_noun bob)
2015-12-28 23:53:10 +03:00
{
if ( c3y == u3ud(bob) ) {
return u3nq(c3__atom, u3k(odo), u3_nul, u3k(bob));
}
2015-12-30 00:52:51 +03:00
else return u3nt(c3__cell, _play_rock(odo, u3h(bob)),
_play_rock(odo, u3t(bob)));
}
static u3_noun
_play_sand(u3_noun odo, u3_noun bob)
{
if ( c3y == u3ud(bob) ) {
if ( 'n' == odo ) {
if ( (bob != 0) ) {
return u3m_bail(c3__exit);
} else {
return u3nq(c3__atom, odo, u3_nul, bob);
}
}
2015-12-30 00:52:51 +03:00
if ( 'f' == odo ) {
if ( (bob > 1) ) {
return u3m_bail(c3__exit);
} else {
return _play_bean();
}
}
return u3nt(c3__atom, u3k(odo), u3_nul);
}
else return u3nt(c3__cell, _play_rock(odo, u3h(bob)),
_play_rock(odo, u3t(bob)));
2013-09-29 00:21:18 +04:00
}
2014-09-06 00:13:24 +04:00
static u3_noun
2015-08-28 19:34:36 +03:00
_play_core(u3_noun pac,
2014-09-06 00:13:24 +04:00
u3_noun con)
2013-09-29 00:21:18 +04:00
{
if ( (c3__void == pac) ) {
2014-09-06 00:13:24 +04:00
u3z(con);
2013-09-29 00:21:18 +04:00
return c3__void;
} else {
2014-09-06 00:13:24 +04:00
return u3nt(c3__core, pac, con);
2013-09-29 00:21:18 +04:00
}
}
2014-09-06 00:13:24 +04:00
static u3_noun
2015-08-28 19:34:36 +03:00
_play_loc(u3_noun van,
2014-09-06 00:13:24 +04:00
u3_noun loc)
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun mol = u3nc('o', u3k(loc));
2018-04-27 02:36:29 +03:00
u3_noun sho = u3j_cook("_play_loc-show", u3k(van), "show");
2014-11-18 00:56:51 +03:00
u3_noun ret = u3i_molt(u3k(sho), u3x_sam, u3k(mol), 0);
2014-09-06 00:13:24 +04:00
u3z(mol);
u3z(sho);
2013-09-29 00:21:18 +04:00
return ret;
}
2018-03-20 19:41:54 +03:00
static u3_noun
_play_feel(u3_noun van,
u3_noun sut,
u3_noun rot)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
u3_noun gat = u3j_hook(von, "feel");
return u3n_kick_on(u3i_molt(gat,
u3x_sam,
u3k(rot),
0));
}
2017-11-09 01:15:58 +03:00
#if 0
static u3_noun
_play_loc_term(u3_noun van,
u3_noun loc)
{
u3_noun fop = u3kb_flop(u3k(u3h(loc)));
u3_noun nam = ((0 == fop) ? c3__none : u3k(u3h(fop)));
u3_noun lys = u3nt(u3k(u3h(u3t(loc))), u3k(u3t(u3t(loc))), u3_nul);
u3_noun rup = u3nc(nam, lys);
c3_c* pre_c = u3m_pretty(rup);
u3_noun pro = u3i_string(pre_c);
u3z(fop);
u3z(rup);
free(pre_c);
return pro;
}
#endif
2016-01-16 04:42:50 +03:00
#if 1
static u3_noun
2016-01-16 04:42:50 +03:00
_play_cnts(u3_noun van,
u3_noun sut,
u3_noun hyp,
u3_noun rig)
{
u3_noun von = u3i_molt(u3k(van), u3x_sam, u3k(sut), 0);
2018-04-27 02:36:29 +03:00
u3_noun gat = u3j_cook("_play_cnts-epla", von, "epla");
return u3n_kick_on(u3i_molt(gat,
u3x_sam_2,
u3k(hyp),
u3x_sam_3,
u3k(rig),
0));
}
#else
2014-09-06 00:13:24 +04:00
static u3_noun
2015-08-28 19:34:36 +03:00
_play_edit(u3_noun van,
2014-09-06 00:13:24 +04:00
u3_noun sut,
u3_noun mew,
u3_noun rag)
2013-09-29 00:21:18 +04:00
{
while ( 1 ) {
2014-11-05 04:18:47 +03:00
if ( c3n == u3du(mew) ) {
2013-09-29 00:21:18 +04:00
return rag;
} else {
2014-09-06 00:13:24 +04:00
u3_noun i_mew = u3h(mew);
u3_noun t_mew = u3t(mew);
u3_noun pi_mew = u3h(i_mew);
u3_noun qi_mew = u3t(i_mew);
u3_noun laf = _play_in(van, sut, qi_mew);
2015-12-26 14:44:32 +03:00
u3_noun ruz = u3qfu_toss(van, sut, pi_mew, laf, rag);
2014-09-06 00:13:24 +04:00
u3z(laf);
u3z(rag);
rag = u3k(u3t(ruz));
u3z(ruz);
2013-09-29 00:21:18 +04:00
mew = t_mew;
}
}
}
static u3_noun
_play_cnts_old(u3_noun van,
u3_noun sut,
u3_noun hyp,
u3_noun rig)
{
u3_noun lar = u3qfu_seek(van, sut, c3__read, hyp);
u3_noun q_lar = u3t(lar);
u3_noun qq_lar = u3t(q_lar);
u3_noun mew = rig;
u3_noun rag = _play_edit(van, sut, mew, u3k(qq_lar));
u3_noun ret = u3qfu_fire(van, sut, rag);
u3z(rag);
u3z(lar);
return ret;
}
#endif
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
static u3_noun
2015-08-28 19:34:36 +03:00
_play_grow(u3_noun van,
2014-09-06 00:13:24 +04:00
u3_noun sut,
u3_atom mel,
2018-05-20 22:34:38 +03:00
u3_noun nym,
u3_noun hud,
2014-09-06 00:13:24 +04:00
u3_noun ruf,
2017-09-28 03:40:12 +03:00
u3_noun dom)
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun dan = _play_in(van, sut, ruf);
2013-09-29 00:21:18 +04:00
2015-08-28 19:34:36 +03:00
return _play_core(dan,
2018-05-20 22:34:38 +03:00
u3nt(u3nt(u3k(nym), u3k(hud), u3k(mel)),
2015-08-28 19:34:36 +03:00
u3k(dan),
2018-02-20 04:24:16 +03:00
u3nc(u3nc(u3nc(c3__full, u3_nul), u3_nul),
2017-09-28 03:40:12 +03:00
u3k(dom))));
2013-09-29 00:21:18 +04:00
}
2014-09-06 00:13:24 +04:00
static u3_noun
2015-08-28 19:34:36 +03:00
_play_in(u3_noun van,
2014-09-06 00:13:24 +04:00
u3_noun sut,
u3_noun gen);
2013-12-14 00:52:06 +04:00
2014-09-06 00:13:24 +04:00
static u3_noun
2015-08-28 19:34:36 +03:00
_play_x(u3_noun van,
2014-09-06 00:13:24 +04:00
u3_noun sut,
u3_noun gen)
2013-12-14 00:52:06 +04:00
{
2013-12-20 21:34:13 +04:00
#if 1
2014-08-21 01:18:34 +04:00
return _play_in(van, sut, gen);
2013-12-20 21:34:13 +04:00
#else
2014-11-06 22:13:57 +03:00
u3_noun zix = u3qfu_shep
2014-09-06 00:13:24 +04:00
(van, "gene", 'q', u3k(gen));
u3_noun ret;
2013-12-14 00:52:06 +04:00
2014-11-06 03:20:01 +03:00
u3t_push(u3nc(c3__mean, zix));
2013-12-14 00:52:06 +04:00
2014-08-21 01:18:34 +04:00
ret = _play_in(van, sut, gen);
2013-12-14 00:52:06 +04:00
2014-11-06 03:20:01 +03:00
u3t_drop();
2013-12-14 00:52:06 +04:00
return ret;
2013-12-20 21:34:13 +04:00
#endif
2013-12-14 00:52:06 +04:00
}
2014-09-06 00:13:24 +04:00
static u3_noun
2015-08-28 19:34:36 +03:00
_play_in(u3_noun van,
2014-09-06 00:13:24 +04:00
u3_noun sut,
u3_noun gen)
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun p_gen, q_gen, r_gen;
2013-09-29 00:21:18 +04:00
2014-11-05 04:18:47 +03:00
if ( c3n == u3du(gen) ) {
2013-09-29 00:21:18 +04:00
open: {
2014-11-18 00:56:51 +03:00
u3_noun ter = u3r_at(u3x_con_3, van);
u3_noun fab = u3r_at(u3qfu_van_fab, van);
u3_noun rex = u3qfp_open(ter, fab, gen);
2014-09-06 00:13:24 +04:00
u3_noun ret;
2013-09-29 00:21:18 +04:00
2014-11-06 03:20:01 +03:00
if ( c3y == u3r_sing(rex, gen) ) {
2015-08-28 19:34:36 +03:00
u3_noun zix = u3qfu_shep(van, "gene", 'q', u3k(gen));
2013-09-29 00:21:18 +04:00
2014-11-06 03:20:01 +03:00
u3t_push(u3nc(c3__mean, zix));
2017-09-28 03:40:12 +03:00
return u3m_error("play-open-z");
2013-09-29 00:21:18 +04:00
}
2014-08-21 01:18:34 +04:00
ret = _play_x(van, sut, rex);
2014-09-06 00:13:24 +04:00
u3z(rex);
2013-09-29 00:21:18 +04:00
return ret;
}
}
2014-11-05 04:18:47 +03:00
else if ( c3y == u3du(u3h(gen)) ) {
2014-08-21 01:18:34 +04:00
_play_used();
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun dis = _play_x(van, sut, u3h(gen));
u3_noun dat = _play_x(van, sut, u3t(gen));
2014-11-06 22:13:57 +03:00
u3_noun ret = u3qf_cell(dis, dat);
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
u3z(dis);
u3z(dat);
2013-09-29 00:21:18 +04:00
return ret;
}
}
2014-09-06 00:13:24 +04:00
else switch ( u3h(gen) ) {
2013-09-29 00:21:18 +04:00
default: goto open;
2014-01-04 11:28:16 +04:00
2017-12-04 23:07:29 +03:00
case c3__fits: u3x_cell(u3t(gen), &p_gen, &q_gen);
2014-08-21 01:18:34 +04:00
_play_used();
2013-12-27 06:43:25 +04:00
{
2014-08-21 01:18:34 +04:00
return _play_bean();
2013-12-27 06:43:25 +04:00
}
2016-02-05 12:25:58 +03:00
2017-09-28 03:40:12 +03:00
case c3__wtcl: u3x_trel(u3t(gen), &p_gen, &q_gen, &r_gen);
2014-08-21 01:18:34 +04:00
_play_used();
2013-09-29 00:21:18 +04:00
{
2014-11-06 22:13:57 +03:00
u3_noun fex = u3qfu_gain(van, sut, p_gen);
u3_noun wux = u3qfu_lose(van, sut, p_gen);
2014-09-06 00:13:24 +04:00
u3_noun dez = (fex == c3__void) ? c3__void
2014-08-21 01:18:34 +04:00
: _play_x(van, fex, q_gen);
2014-09-06 00:13:24 +04:00
u3_noun doz = (wux == c3__void) ? c3__void
2014-08-21 01:18:34 +04:00
: _play_x(van, wux, r_gen);
2016-01-11 07:23:32 +03:00
u3_noun ret = u3qf_forq(dez, doz);
2014-09-06 00:13:24 +04:00
u3z(dez); u3z(doz);
u3z(fex); u3z(wux);
2013-09-29 00:21:18 +04:00
return ret;
}
2016-02-05 12:25:58 +03:00
2017-09-28 03:40:12 +03:00
case c3__clhp: u3x_cell(u3t(gen), &p_gen, &q_gen);
2014-08-21 01:18:34 +04:00
_play_used();
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun dis = _play_x(van, sut, p_gen);
u3_noun dat = _play_x(van, sut, q_gen);
2014-11-06 22:13:57 +03:00
u3_noun ret = u3qf_cell(dis, dat);
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
u3z(dis);
u3z(dat);
2013-09-29 00:21:18 +04:00
return ret;
}
2016-02-05 12:25:58 +03:00
2017-09-28 03:40:12 +03:00
case c3__dtkt: u3x_cell(u3t(gen), &p_gen, &q_gen);
2014-08-21 01:18:34 +04:00
_play_used();
2013-09-29 00:21:18 +04:00
{
2018-05-27 22:16:13 +03:00
u3_noun nog = u3nc(c3__kttr, u3k(p_gen));
u3_noun ret = _play_x(van, sut, nog);
u3z(nog);
return ret;
}
2016-02-05 12:25:58 +03:00
2017-09-28 03:40:12 +03:00
case c3__dtwt: p_gen = u3t(gen);
2014-08-21 01:18:34 +04:00
_play_used();
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
return _play_bean();
2013-09-29 00:21:18 +04:00
}
2016-02-05 12:25:58 +03:00
2017-09-28 03:40:12 +03:00
case c3__dtts: u3x_cell(u3t(gen), &p_gen, &q_gen);
2014-08-21 01:18:34 +04:00
_play_used();
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
return _play_bean();
2013-09-29 00:21:18 +04:00
}
2016-02-05 12:25:58 +03:00
2017-09-28 03:40:12 +03:00
case c3__dtls: p_gen = u3t(gen);
2014-08-21 01:18:34 +04:00
_play_used();
2013-09-29 00:21:18 +04:00
{
return u3nt(c3__atom, u3_blip, u3_nul);
2013-09-29 00:21:18 +04:00
}
2016-02-05 12:25:58 +03:00
2015-12-30 00:52:51 +03:00
case c3__rock: u3x_cell(u3t(gen), &p_gen, &q_gen);
2014-08-21 01:18:34 +04:00
_play_used();
2013-09-29 00:21:18 +04:00
{
2015-12-30 00:52:51 +03:00
return _play_rock(p_gen, q_gen);
2013-09-29 00:21:18 +04:00
}
2016-02-05 12:25:58 +03:00
2017-09-28 03:40:12 +03:00
case c3__dttr: u3x_cell(u3t(gen), &p_gen, &q_gen);
2014-08-21 01:18:34 +04:00
_play_used();
2013-09-29 00:21:18 +04:00
{
return c3__noun;
}
2016-02-05 12:25:58 +03:00
2015-12-29 22:52:22 +03:00
case c3__sand: u3x_cell(u3t(gen), &p_gen, &q_gen);
2014-08-21 01:18:34 +04:00
_play_used();
2013-09-29 00:21:18 +04:00
{
2015-12-30 00:52:51 +03:00
return _play_sand(p_gen, q_gen);
2013-09-29 00:21:18 +04:00
}
2016-02-05 12:25:58 +03:00
2016-01-26 22:03:05 +03:00
case c3__hand: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
return u3k(p_gen);
}
2016-02-05 12:25:58 +03:00
2017-09-28 03:40:12 +03:00
case c3__ktbr: p_gen = u3t(gen);
2014-08-21 01:18:34 +04:00
_play_used();
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun boc = _play_x(van, sut, p_gen);
2014-11-06 22:13:57 +03:00
u3_noun pro = u3qfu_wrap(van, boc, c3__iron);
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
u3z(boc);
2013-09-29 00:21:18 +04:00
return pro;
}
2016-02-05 12:25:58 +03:00
case c3__ktpd: p_gen = u3t(gen);
2014-08-21 01:18:34 +04:00
_play_used();
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun boc = _play_x(van, sut, p_gen);
2014-11-06 22:13:57 +03:00
u3_noun pro = u3qfu_wrap(van, boc, c3__zinc);
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
u3z(boc);
2013-09-29 00:21:18 +04:00
return pro;
}
2016-02-05 12:25:58 +03:00
2017-09-28 03:40:12 +03:00
case c3__ktwt: p_gen = u3t(gen);
2014-08-21 01:18:34 +04:00
_play_used();
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun boc = _play_x(van, sut, p_gen);
2014-11-06 22:13:57 +03:00
u3_noun pro = u3qfu_wrap(van, boc, c3__lead);
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
u3z(boc);
2013-09-29 00:21:18 +04:00
return pro;
}
2018-04-25 07:57:54 +03:00
case c3__note: u3x_cell(u3t(gen), &p_gen, &q_gen);
2014-08-21 01:18:34 +04:00
_play_used();
{
2014-09-06 00:13:24 +04:00
u3_noun boc = _play_x(van, sut, q_gen);
2018-05-03 01:11:06 +03:00
u3_noun hit = u3nc(u3k(sut), u3k(p_gen));
u3_noun ret = u3qf_hint(hit, boc);
2018-05-03 01:11:06 +03:00
u3z(hit);
2014-09-06 00:13:24 +04:00
u3z(boc);
return ret;
}
2016-02-05 12:25:58 +03:00
2017-09-28 03:40:12 +03:00
case c3__tune: p_gen = u3t(gen);
_play_used();
{
return u3qf_face(p_gen, sut);
}
case c3__ktsg: p_gen = u3t(gen);
2014-08-21 01:18:34 +04:00
_play_used();
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
return _play_x(van, sut, p_gen);
2013-09-29 00:21:18 +04:00
}
2016-02-05 12:25:58 +03:00
2017-09-28 03:40:12 +03:00
case c3__ktls: u3x_cell(u3t(gen), &p_gen, &q_gen);
2016-01-01 04:01:19 +03:00
_play_used();
{
return _play_x(van, sut, p_gen);
}
2016-02-05 12:25:58 +03:00
2018-05-27 23:00:55 +03:00
case c3__tsbn: u3x_cell(u3t(gen), &p_gen, &q_gen);
2014-08-21 01:18:34 +04:00
_play_used();
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun boc = _play_x(van, sut, p_gen);
u3_noun ret = _play_x(van, boc, q_gen);
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
u3z(boc);
2013-09-29 00:21:18 +04:00
return ret;
}
2016-02-05 12:25:58 +03:00
2017-09-28 03:40:12 +03:00
case c3__tscm: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
u3_noun boc = u3qfu_busk(van, sut, p_gen);
u3_noun ret = _play_x(van, boc, q_gen);
u3z(boc);
return ret;
}
case c3__cnts: u3x_cell(u3t(gen), &p_gen, &q_gen);
2014-08-21 01:18:34 +04:00
_play_used();
2016-01-16 04:42:50 +03:00
{
return _play_cnts(van, sut, p_gen, q_gen);
}
2016-02-05 12:25:58 +03:00
2017-09-28 03:40:12 +03:00
case c3__brcn: u3x_cell(u3t(gen), &p_gen, &q_gen);
2014-08-21 01:18:34 +04:00
_play_used();
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun ruf = u3nc(u3_nul, 1);
2018-05-20 22:34:38 +03:00
u3_noun ret = _play_grow
2018-05-21 02:07:28 +03:00
(van, sut, c3__gold, p_gen, c3__dry, ruf, q_gen);
2018-05-20 22:34:38 +03:00
u3z(ruf);
return ret;
}
case c3__brvt: u3x_cell(u3t(gen), &p_gen, &q_gen);
_play_used();
{
u3_noun ruf = u3nc(u3_nul, 1);
u3_noun ret = _play_grow
(van, sut, c3__gold, p_gen, c3__wet, ruf, q_gen);
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
u3z(ruf);
2013-09-29 00:21:18 +04:00
return ret;
}
2016-02-05 12:25:58 +03:00
2017-09-28 03:40:12 +03:00
case c3__sgzp: u3x_cell(u3t(gen), &p_gen, &q_gen);
2014-08-21 01:18:34 +04:00
_play_used();
2013-12-05 02:30:09 +04:00
{
2014-11-06 22:13:57 +03:00
u3_noun typ = u3qfu_play(van, sut, p_gen);
u3_noun dug = u3qfu_duck(van, typ);
2014-09-06 00:13:24 +04:00
u3_noun ret;
2013-12-05 02:30:09 +04:00
2014-11-06 03:20:01 +03:00
u3t_push(u3nc(c3__mean, dug));
2013-12-05 02:30:09 +04:00
{
2014-08-21 01:18:34 +04:00
ret = _play_x(van, sut, q_gen);
}
2014-11-06 03:20:01 +03:00
u3t_drop();
2013-12-05 02:30:09 +04:00
2014-09-06 00:13:24 +04:00
u3z(typ);
2013-12-05 02:30:09 +04:00
return ret;
}
2016-02-05 12:25:58 +03:00
2018-05-27 23:00:55 +03:00
case c3__sgbn: u3x_cell(u3t(gen), &p_gen, &q_gen);
2014-08-21 01:18:34 +04:00
_play_used();
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
return _play_x(van, sut, q_gen);
2013-09-29 00:21:18 +04:00
}
2016-02-05 12:25:58 +03:00
2017-09-28 03:40:12 +03:00
case c3__zpts: p_gen = u3t(gen);
2014-08-21 01:18:34 +04:00
_play_used();
2013-09-29 00:21:18 +04:00
{
return c3__noun;
}
2016-02-05 12:25:58 +03:00
2017-09-28 03:40:12 +03:00
case c3__ktcn: p_gen = u3t(gen);
2017-08-06 04:37:00 +03:00
{
u3_noun von = u3i_molt(u3k(van), u3qfu_van_fab, c3n, 0);
u3_noun ret = _play_x(von, sut, p_gen);
u3z(von);
return ret;
}
2017-09-28 03:40:12 +03:00
case c3__zpcm: u3x_cell(u3t(gen), &p_gen, &q_gen);
2014-08-21 01:18:34 +04:00
_play_used();
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
return _play_x(van, sut, p_gen);
2013-09-29 00:21:18 +04:00
}
2016-02-05 12:25:58 +03:00
2015-12-21 08:05:19 +03:00
case c3__dbug: u3x_cell(u3t(gen), &p_gen, &q_gen);
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun ret;
2013-09-29 00:21:18 +04:00
2017-11-09 01:15:58 +03:00
#if 0
{
u3_noun cog = _play_loc_term(van, p_gen);
u3t_heck(cog);
u3z(cog);
}
#endif
2014-11-06 03:20:01 +03:00
u3t_push(u3nc(c3__mean, _play_loc(van, p_gen)));
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
ret = _play_x(van, sut, q_gen);
2013-09-29 00:21:18 +04:00
}
2014-11-06 03:20:01 +03:00
u3t_drop();
2013-09-29 00:21:18 +04:00
return ret;
}
case c3__zpmc:
2017-09-28 03:40:12 +03:00
case c3__zpsm: u3x_cell(u3t(gen), &p_gen, &q_gen);
2014-08-21 01:18:34 +04:00
_play_used();
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun zur = _play_x(van, sut, p_gen);
u3_noun vos = _play_x(van, sut, q_gen);
2014-11-06 22:13:57 +03:00
u3_noun ret = u3qf_cell(zur, vos);
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
u3z(zur);
u3z(vos);
2013-09-29 00:21:18 +04:00
return ret;
}
2016-02-05 12:25:58 +03:00
2018-03-20 19:41:54 +03:00
case c3__zpvt: u3x_trel(u3t(gen), &p_gen, &q_gen, &r_gen);
_play_used();
{
if ( c3y == _play_feel(van, sut, p_gen) ) {
return _play_x(van, sut, q_gen);
} else {
return _play_x(van, sut, r_gen);
}
}
2015-12-21 08:05:19 +03:00
case c3__lost:
2016-02-05 12:25:58 +03:00
case c3__fail:
2017-09-28 03:40:12 +03:00
case c3__zpzp:
2014-08-21 01:18:34 +04:00
_play_used();
2013-09-29 00:21:18 +04:00
{
return c3__void;
}
}
}
2017-09-28 03:40:12 +03:00
static u3_noun
2015-08-28 19:34:36 +03:00
_cqfu_play(u3_noun van,
u3_noun sut,
u3_noun gen)
2013-09-29 00:21:18 +04:00
{
2014-11-06 22:13:57 +03:00
u3_noun von = u3i_molt(u3k(van), u3qfu_van_vet, c3n, 0);
2014-09-06 00:13:24 +04:00
u3_noun ret = _play_x(von, sut, gen);
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
u3z(von);
2013-09-29 00:21:18 +04:00
return ret;
}
/* boilerplate
*/
2014-09-06 00:13:24 +04:00
u3_noun
2015-08-28 19:34:36 +03:00
u3wfu_play(u3_noun cor)
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun sut, gen, van;
2013-09-29 00:21:18 +04:00
2014-11-18 00:56:51 +03:00
if ( (c3n == u3r_mean(cor, u3x_sam, &gen, u3x_con, &van, 0)) ||
(u3_none == (sut = u3r_at(u3x_sam, van))) )
2013-09-29 00:21:18 +04:00
{
2014-11-06 03:20:01 +03:00
return u3m_bail(c3__fail);
2013-09-29 00:21:18 +04:00
} else {
2014-09-03 09:46:55 +04:00
return _cqfu_play(van, sut, gen);
2013-09-29 00:21:18 +04:00
}
}
2014-09-06 00:13:24 +04:00
u3_noun
2014-11-06 22:13:57 +03:00
u3qfu_play(u3_noun van,
2015-08-28 19:34:36 +03:00
u3_noun sut,
u3_noun gen)
2013-09-29 00:21:18 +04:00
{
2017-11-09 01:15:58 +03:00
#if 1
2018-05-25 01:40:28 +03:00
c3_m fun_m = 141 + c3__play;
2017-11-09 01:15:58 +03:00
u3_noun vrf = u3r_at(u3qfu_van_vrf, van);
u3_noun pro = u3z_find_3(fun_m, vrf, sut, gen);
if ( u3_none != pro ) {
return pro;
}
else {
pro = _cqfu_play(van, sut, gen);
return u3z_save_3(fun_m, vrf, sut, gen, pro);
}
#else
2014-09-03 09:46:55 +04:00
return _cqfu_play(van, sut, gen);
2017-11-09 01:15:58 +03:00
#endif
2013-09-29 00:21:18 +04:00
}