urbit/j/6/ut_play.c

542 lines
12 KiB
C
Raw Normal View History

2013-09-29 00:21:18 +04:00
/* j/6/play.c
**
** This file is in the public domain.
*/
#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
2014-08-21 01:18:34 +04:00
_play_bean(void)
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
return u3nt(c3__fork,
u3nq(c3__cube, 0, c3__atom, 'f'),
u3nq(c3__cube, 1, c3__atom, 'f'));
2013-09-29 00:21:18 +04:00
}
2014-09-06 00:13:24 +04:00
static u3_noun
2014-08-21 01:18:34 +04:00
_play_core(
2014-09-06 00:13:24 +04:00
u3_noun pac,
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
2014-08-21 01:18:34 +04:00
_play_loc(
2014-09-06 00:13:24 +04:00
u3_noun van,
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));
u3_noun sho = u3_cj_hook(u3k(van), "show");
u3_noun ret = u3_ci_molt(u3k(sho), u3_cv_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;
}
2014-09-06 00:13:24 +04:00
static u3_noun
2014-08-21 01:18:34 +04:00
_play_foil(
2014-09-06 00:13:24 +04:00
u3_noun pok)
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun p_pok = u3h(pok);
u3_noun q_pok = u3t(pok);
u3_noun ret;
2014-11-05 04:18:47 +03:00
if ( c3y == u3h(q_pok) ) {
2014-09-06 00:13:24 +04:00
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)));
2013-09-29 00:21:18 +04:00
}
else {
2014-09-06 00:13:24 +04:00
u3_noun pq_pok = u3h(u3t(q_pok));
u3_noun qq_pok = u3t(u3t(q_pok));
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
ret = u3nc(u3k(p_pok),
u3nc(u3k(pq_pok),
u3k(qq_pok)));
2013-09-29 00:21:18 +04:00
}
2014-09-06 00:13:24 +04:00
u3z(pok);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-09-06 00:13:24 +04:00
static u3_noun
2014-08-21 01:18:34 +04:00
_play_edit(
2014-09-06 00:13:24 +04:00
u3_noun van,
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);
u3_noun ruz = u3_cqfu_tock(van, sut, pi_mew, laf, rag);
u3z(laf);
u3z(rag);
rag = u3k(u3t(ruz));
u3z(ruz);
2013-09-29 00:21:18 +04:00
mew = t_mew;
}
}
}
2014-09-06 00:13:24 +04:00
static u3_noun
2014-08-21 01:18:34 +04:00
_play_grow(
2014-09-06 00:13:24 +04:00
u3_noun van,
u3_noun sut,
u3_atom mel,
u3_noun ruf,
u3_noun dab)
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
return _play_core
2014-08-21 01:18:34 +04:00
(dan,
2014-09-06 00:13:24 +04:00
u3nt(u3k(mel),
u3k(dan),
u3nc(u3nc(u3_nul, u3_nul),
u3k(dab))));
2013-09-29 00:21:18 +04:00
}
2014-09-06 00:13:24 +04:00
static u3_noun
2014-08-21 01:18:34 +04:00
_play_in(
2014-09-06 00:13:24 +04:00
u3_noun van,
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
2014-08-21 01:18:34 +04:00
_play_x(
2014-09-06 00:13:24 +04:00
u3_noun van,
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-09-06 00:13:24 +04:00
u3_noun zix = u3_cqfu_shep
(van, "gene", 'q', u3k(gen));
u3_noun ret;
2013-12-14 00:52:06 +04:00
2014-09-06 00:13:24 +04:00
u3_ct_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-09-06 00:13:24 +04:00
u3_ct_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
2014-08-21 01:18:34 +04:00
_play_in(
2014-09-06 00:13:24 +04:00
u3_noun van,
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-09-06 00:13:24 +04:00
u3_noun ter = u3_cr_at(u3_cv_con_3, van);
u3_noun rex = u3_cqfp_open(ter, gen);
u3_noun ret;
2013-09-29 00:21:18 +04:00
2014-11-05 04:18:47 +03:00
if ( c3y == u3_cr_sing(rex, gen) ) {
2014-09-06 00:13:24 +04:00
u3_noun zix = u3_cqfu_shep
(van, "gene", 'q', u3k(gen));
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
u3_ct_push(u3nc(c3__mean, zix));
return u3_cm_error("play-open");
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));
u3_noun ret = u3_cqf_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
2014-09-06 00:13:24 +04:00
case c3__bcpt: u3_cx_cell(u3t(gen), &p_gen, &q_gen);
2014-08-21 01:18:34 +04:00
_play_used();
2014-01-04 11:28:16 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun sep = u3_cqfu_seep(van, sut, c3__read, p_gen);
u3_noun axe = u3h(sep);
u3_noun rex = u3_cqfl_whip(van, q_gen, axe);
u3_noun ret = _play_x(van, sut, rex);
2014-01-04 11:28:16 +04:00
2014-09-06 00:13:24 +04:00
u3z(sep);
u3z(rex);
2014-01-04 11:28:16 +04:00
return ret;
}
2014-09-06 00:13:24 +04:00
case c3__wtts: u3_cx_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
}
2014-09-06 00:13:24 +04:00
case c3__wtcl: u3_cx_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-09-06 00:13:24 +04:00
u3_noun fex = u3_cqfu_gain(van, sut, p_gen);
u3_noun wux = u3_cqfu_lose(van, sut, p_gen);
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);
2014-09-06 00:13:24 +04:00
u3_noun ret = u3_cqf_fork(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;
}
2014-09-06 00:13:24 +04:00
case c3__clhp: u3_cx_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);
u3_noun ret = u3_cqf_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
case c3__dtkt: 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;
}
2014-09-06 00:13:24 +04: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
}
2014-09-06 00:13:24 +04:00
case c3__dtts: u3_cx_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
}
2014-09-06 00:13:24 +04: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
{
2014-09-06 00:13:24 +04:00
return u3nc(c3__atom, u3_blip);
2013-09-29 00:21:18 +04:00
}
2014-09-06 00:13:24 +04:00
case c3__dtzz: u3_cx_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-11-05 04:18:47 +03:00
u3_noun boc = (c3n == u3ud(q_gen))
2013-09-29 00:21:18 +04:00
? c3__noun
2014-09-06 00:13:24 +04:00
: u3nc(c3__atom, u3k(p_gen));
u3_noun ret = u3_cqf_cube(q_gen, boc);
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;
}
2014-09-06 00:13:24 +04:00
case c3__dttr: u3_cx_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;
}
2014-09-06 00:13:24 +04:00
case c3__dtzy: u3_cx_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
{
if ( 'f' == p_gen ) {
if ( (q_gen > 1) ) {
2014-09-06 00:13:24 +04:00
return u3_cm_bail(c3__exit);
2013-09-29 00:21:18 +04:00
} else {
2014-08-21 01:18:34 +04:00
return _play_bean();
2013-09-29 00:21:18 +04:00
}
}
2014-09-06 00:13:24 +04:00
else return u3nc(c3__atom, u3k(p_gen));
2013-09-29 00:21:18 +04:00
}
2014-09-06 00:13:24 +04: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);
u3_noun pro = u3_cqfu_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;
}
2014-09-06 00:13:24 +04:00
case c3__ktpm: 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);
u3_noun pro = u3_cqfu_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;
}
2014-09-06 00:13:24 +04: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);
u3_noun pro = u3_cqfu_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;
}
2014-09-06 00:13:24 +04:00
case c3__ktts: u3_cx_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, q_gen);
u3_noun ret = u3_cqfu_conk(van, boc, p_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;
}
2014-09-06 00:13:24 +04:00
case c3__ktzp: u3_cx_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);
u3_noun ret = u3_cqfu_conk(van, boc, p_gen);
2014-09-06 00:13:24 +04:00
u3z(boc);
return ret;
}
2014-09-06 00:13:24 +04:00
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
}
2014-09-06 00:13:24 +04:00
case c3__kthx: u3_cx_cell(u3t(gen), &p_gen, &q_gen);
2014-08-21 01:18:34 +04:00
_play_used();
2014-06-11 18:06:36 +04:00
{
2014-08-21 01:18:34 +04:00
return _play_x(van, sut, p_gen);
2014-06-11 18:06:36 +04:00
}
2014-09-06 00:13:24 +04:00
case c3__ktls: u3_cx_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
}
2014-09-06 00:13:24 +04:00
case c3__tsgr: u3_cx_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;
}
2014-09-06 00:13:24 +04:00
case c3__tstr: u3_cx_trel(u3t(gen), &p_gen, &q_gen, &r_gen);
2014-08-21 01:18:34 +04:00
_play_used();
2013-12-26 21:12:07 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun sep = u3_cqfu_seep(van, sut, c3__both, q_gen);
u3_noun bid = u3nt(u3k(p_gen), u3k(q_gen), sep);
u3_noun boc = u3_cqf_bull(bid, sut);
u3_noun ret = _play_x(van, boc, r_gen);
2013-12-26 21:12:07 +04:00
2014-09-06 00:13:24 +04:00
u3z(bid);
u3z(boc);
2013-12-26 21:12:07 +04:00
return ret;
}
2014-09-06 00:13:24 +04:00
case c3__cnts: u3_cx_cell(u3t(gen), &p_gen, &q_gen);
2014-08-21 01:18:34 +04:00
_play_used();
2013-12-15 12:23:23 +04:00
{
2014-09-06 00:13:24 +04:00
u3_noun sec = u3_cqfu_seek(van, sut, c3__read, p_gen);
u3_noun lar = _play_foil(sec);
u3_noun q_lar = u3t(lar);
u3_noun qq_lar = u3t(q_lar);
u3_noun mew = u3_cqfu_snub(van, sut, q_gen);
u3_noun rag = _play_edit(van, sut, mew, u3k(qq_lar));
u3_noun ret = u3_cqfu_fire(van, sut, rag);
2013-12-15 12:23:23 +04:00
2014-09-06 00:13:24 +04:00
u3z(rag);
u3z(mew);
u3z(lar);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-09-06 00:13:24 +04:00
case c3__pmcl: u3_cx_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 = u3nt
2014-08-21 01:18:34 +04:00
(c3__clhp,
2014-09-06 00:13:24 +04:00
u3nc(u3_nul, 1),
u3k(p_gen));
u3_noun ret = _play_grow(van, sut, c3__zinc, 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;
}
2014-09-06 00:13:24 +04:00
case c3__brcn: 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 ruf = u3nc(u3_nul, 1);
u3_noun ret = _play_grow(van, sut, c3__gold, ruf, p_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;
}
2014-09-06 00:13:24 +04:00
case c3__pmcn: 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 ruf = u3nc(u3_nul, 1);
u3_noun ret = _play_grow(van, sut, c3__lead, ruf, p_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;
}
2014-09-06 00:13:24 +04:00
case c3__pmls: u3_cx_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 = u3nt
2014-08-21 01:18:34 +04:00
(c3__clhp,
2014-09-06 00:13:24 +04:00
u3nc(u3_nul, 1),
u3k(p_gen));
u3_noun ret = _play_grow(van, sut, c3__iron, 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;
}
2014-09-06 00:13:24 +04:00
case c3__sgzp: u3_cx_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-09-06 00:13:24 +04:00
u3_noun typ = u3_cqfu_play(van, sut, p_gen);
u3_noun dug = u3_cqfu_duck(van, typ);
u3_noun ret;
2013-12-05 02:30:09 +04:00
2014-09-06 00:13:24 +04:00
u3_ct_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-09-06 00:13:24 +04:00
u3_ct_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;
}
2014-09-06 00:13:24 +04:00
case c3__sggr: u3_cx_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
}
2014-09-06 00:13:24 +04: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;
}
2014-09-06 00:13:24 +04:00
case c3__zpcm: u3_cx_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
}
2014-09-06 00:13:24 +04:00
case c3__zpcb: u3_cx_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
2014-09-06 00:13:24 +04:00
u3_ct_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-09-06 00:13:24 +04:00
u3_ct_drop();
2013-09-29 00:21:18 +04:00
return ret;
}
case c3__zpcn:
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 pet = u3_cj_hook(u3k(van), "seed");
u3_noun ret = u3k(u3h(pet));
2013-09-29 00:21:18 +04:00
2014-09-06 00:13:24 +04:00
u3z(pet);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-09-06 00:13:24 +04:00
case c3__zpsm: u3_cx_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);
u3_noun ret = u3_cqf_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;
}
case c3__zpfs:
case c3__zpzp:
2014-08-21 01:18:34 +04:00
_play_used();
2013-09-29 00:21:18 +04:00
{
return c3__void;
}
}
}
2014-09-06 00:13:24 +04:00
u3_noun
2014-09-03 09:46:55 +04:00
_cqfu_play(
2014-09-06 00:13:24 +04:00
u3_noun van,
u3_noun sut,
u3_noun gen)
2013-09-29 00:21:18 +04:00
{
2014-11-05 04:18:47 +03:00
u3_noun von = u3_ci_molt(u3k(van), u3_cqfu_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
u3_cwfu_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-05 04:18:47 +03:00
if ( (c3n == u3_cr_mean(cor, u3_cv_sam, &gen, u3_cv_con, &van, 0)) ||
2014-11-06 02:36:30 +03:00
(u3_none == (sut = u3_cr_at(u3_cv_sam, van))) )
2013-09-29 00:21:18 +04:00
{
2014-09-06 00:13:24 +04:00
return u3_cm_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
u3_cqfu_play(u3_noun van,
u3_noun sut,
u3_noun gen)
2013-09-29 00:21:18 +04:00
{
2014-09-03 09:46:55 +04:00
return _cqfu_play(van, sut, gen);
2013-09-29 00:21:18 +04:00
}