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
static u2_noun
2014-08-21 01:18:34 +04:00
_play_in(u2_noun, u2_noun, u2_noun);
2013-09-29 00:21:18 +04:00
2014-09-04 01:33:18 +04:00
static u2_noun
2014-08-21 01:18:34 +04:00
_play_bean(void)
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
return u2nt(c3__fork,
u2nq(c3__cube, 0, c3__atom, 'f'),
u2nq(c3__cube, 1, c3__atom, 'f'));
2013-09-29 00:21:18 +04:00
}
2014-09-04 01:33:18 +04:00
static u2_noun
2014-08-21 01:18:34 +04:00
_play_core(
2014-09-04 01:33:18 +04:00
u2_noun pac,
u2_noun con)
2013-09-29 00:21:18 +04:00
{
if ( (c3__void == pac) ) {
2014-08-21 01:18:34 +04:00
u2z(con);
2013-09-29 00:21:18 +04:00
return c3__void;
} else {
2014-08-21 01:18:34 +04:00
return u2nt(c3__core, pac, con);
2013-09-29 00:21:18 +04:00
}
}
2014-09-04 01:33:18 +04:00
static u2_noun
2014-08-21 01:18:34 +04:00
_play_loc(
2014-09-04 01:33:18 +04:00
u2_noun van,
u2_noun loc)
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
u2_noun mol = u2nc('o', u2k(loc));
2014-08-21 01:24:29 +04:00
u2_noun sho = u2_cj_hook(u2k(van), "show");
2014-08-21 01:18:34 +04:00
u2_noun ret = u2_ci_molt(u2k(sho), u2_cv_sam, u2k(mol), 0);
2014-08-21 01:18:34 +04:00
u2z(mol);
u2z(sho);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-09-04 01:33:18 +04:00
static u2_noun
2014-08-21 01:18:34 +04:00
_play_foil(
2014-09-04 01:33:18 +04:00
u2_noun pok)
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
u2_noun p_pok = u2h(pok);
u2_noun q_pok = u2t(pok);
2013-09-29 00:21:18 +04:00
u2_noun ret;
2014-08-21 01:18:34 +04:00
if ( u2_yes == u2h(q_pok) ) {
u2_noun pq_pok = u2t(q_pok);
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
ret = u2nc(
u2k(p_pok),
u2nc(u2_nul,
u2nc(
u2nc(
u2k(pq_pok),
u2nt(c3__elm, u2_nul, 1)),
2013-09-29 00:21:18 +04:00
u2_nul)));
}
else {
2014-08-21 01:18:34 +04:00
u2_noun pq_pok = u2h(u2t(q_pok));
u2_noun qq_pok = u2t(u2t(q_pok));
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
ret = u2nc(u2k(p_pok),
u2nc(u2k(pq_pok),
u2k(qq_pok)));
2013-09-29 00:21:18 +04:00
}
2014-08-21 01:18:34 +04:00
u2z(pok);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-09-04 01:33:18 +04:00
static u2_noun
2014-08-21 01:18:34 +04:00
_play_edit(
2014-09-04 01:33:18 +04:00
u2_noun van,
u2_noun sut,
u2_noun mew,
u2_noun rag)
2013-09-29 00:21:18 +04:00
{
while ( 1 ) {
2014-08-21 01:18:34 +04:00
if ( u2_no == u2du(mew) ) {
2013-09-29 00:21:18 +04:00
return rag;
} else {
2014-08-21 01:18:34 +04:00
u2_noun i_mew = u2h(mew);
u2_noun t_mew = u2t(mew);
u2_noun pi_mew = u2h(i_mew);
u2_noun qi_mew = u2t(i_mew);
u2_noun laf = _play_in(van, sut, qi_mew);
2014-09-03 07:36:29 +04:00
u2_noun ruz = u2_cqfu_tock(van, sut, pi_mew, laf, rag);
2014-08-21 01:18:34 +04:00
u2z(laf);
u2z(rag);
rag = u2k(u2t(ruz));
u2z(ruz);
2013-09-29 00:21:18 +04:00
mew = t_mew;
}
}
}
static u2_noun
2014-08-21 01:18:34 +04:00
_play_grow(
2013-09-29 00:21:18 +04:00
u2_noun van,
u2_noun sut,
u2_atom mel,
u2_noun ruf,
u2_noun dab)
{
2014-08-21 01:18:34 +04:00
u2_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,
u2nt(u2k(mel),
u2k(dan),
u2nc(u2nc(u2_nul, u2_nul),
u2k(dab))));
2013-09-29 00:21:18 +04:00
}
2013-12-14 00:52:06 +04:00
static u2_noun
2014-08-21 01:18:34 +04:00
_play_in(
2013-12-14 00:52:06 +04:00
u2_noun van,
u2_noun sut,
u2_noun gen);
static u2_noun
2014-08-21 01:18:34 +04:00
_play_x(
2013-12-14 00:52:06 +04:00
u2_noun van,
u2_noun sut,
u2_noun gen)
{
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-03 07:36:29 +04:00
u2_noun zix = u2_cqfu_shep
2014-08-21 01:18:34 +04:00
(van, "gene", 'q', u2k(gen));
2013-12-14 00:52:06 +04:00
u2_noun ret;
2014-08-21 01:18:34 +04:00
u2_ct_push(u2nc(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-08-21 01:18:34 +04:00
u2_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
}
2013-09-29 00:21:18 +04:00
static u2_noun
2014-08-21 01:18:34 +04:00
_play_in(
2013-09-29 00:21:18 +04:00
u2_noun van,
u2_noun sut,
u2_noun gen)
{
u2_noun p_gen, q_gen, r_gen;
2014-08-21 01:18:34 +04:00
if ( u2_no == u2du(gen) ) {
2013-09-29 00:21:18 +04:00
open: {
2014-08-21 01:18:34 +04:00
u2_noun ter = u2_cr_at(u2_cv_con_3, van);
2014-09-03 07:36:29 +04:00
u2_noun rex = u2_cqfp_open(ter, gen);
2013-09-29 00:21:18 +04:00
u2_noun ret;
2014-08-21 01:18:34 +04:00
if ( u2_yes == u2_cr_sing(rex, gen) ) {
2014-09-03 07:36:29 +04:00
u2_noun zix = u2_cqfu_shep
2014-08-21 01:18:34 +04:00
(van, "gene", 'q', u2k(gen));
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
u2_ct_push(u2nc(c3__mean, zix));
return u2_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);
u2z(rex);
2013-09-29 00:21:18 +04:00
return ret;
}
}
2014-08-21 01:18:34 +04:00
else if ( u2_yes == u2du(u2h(gen)) ) {
_play_used();
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
u2_noun dis = _play_x(van, sut, u2h(gen));
u2_noun dat = _play_x(van, sut, u2t(gen));
2014-09-03 07:36:29 +04:00
u2_noun ret = u2_cqf_cell(dis, dat);
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
u2z(dis);
u2z(dat);
2013-09-29 00:21:18 +04:00
return ret;
}
}
2014-08-21 01:18:34 +04:00
else switch ( u2h(gen) ) {
2013-09-29 00:21:18 +04:00
default: goto open;
2014-01-04 11:28:16 +04:00
2014-08-21 01:18:34 +04:00
case c3__bcpt: u2_cx_cell(u2t(gen), &p_gen, &q_gen);
_play_used();
2014-01-04 11:28:16 +04:00
{
2014-09-03 07:36:29 +04:00
u2_noun sep = u2_cqfu_seep(van, sut, c3__read, p_gen);
2014-01-04 11:28:16 +04:00
u2_noun axe = u2h(sep);
2014-09-03 07:36:29 +04:00
u2_noun rex = u2_cqfl_whip(van, q_gen, axe);
2014-08-21 01:18:34 +04:00
u2_noun ret = _play_x(van, sut, rex);
2014-01-04 11:28:16 +04:00
u2z(sep);
u2z(rex);
return ret;
}
2014-08-21 01:18:34 +04:00
case c3__wtts: u2_cx_cell(u2t(gen), &p_gen, &q_gen);
_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-08-21 01:18:34 +04:00
case c3__wtcl: u2_cx_trel(u2t(gen), &p_gen, &q_gen, &r_gen);
_play_used();
2013-09-29 00:21:18 +04:00
{
2014-09-03 07:36:29 +04:00
u2_noun fex = u2_cqfu_gain(van, sut, p_gen);
u2_noun wux = u2_cqfu_lose(van, sut, p_gen);
u2_noun dez = (fex == c3__void) ? c3__void
2014-08-21 01:18:34 +04:00
: _play_x(van, fex, q_gen);
u2_noun doz = (wux == c3__void) ? c3__void
2014-08-21 01:18:34 +04:00
: _play_x(van, wux, r_gen);
2014-09-03 07:36:29 +04:00
u2_noun ret = u2_cqf_fork(dez, doz);
2014-08-21 01:18:34 +04:00
u2z(dez); u2z(doz);
u2z(fex); u2z(wux);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-08-21 01:18:34 +04:00
case c3__clhp: u2_cx_cell(u2t(gen), &p_gen, &q_gen);
_play_used();
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
u2_noun dis = _play_x(van, sut, p_gen);
u2_noun dat = _play_x(van, sut, q_gen);
2014-09-03 07:36:29 +04:00
u2_noun ret = u2_cqf_cell(dis, dat);
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
u2z(dis);
u2z(dat);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-08-21 01:18:34 +04:00
case c3__dtkt: p_gen = u2t(gen);
_play_used();
2013-09-29 00:21:18 +04:00
{
return c3__noun;
}
2014-08-21 01:18:34 +04:00
case c3__dtwt: p_gen = u2t(gen);
_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-08-21 01:18:34 +04:00
case c3__dtts: u2_cx_cell(u2t(gen), &p_gen, &q_gen);
_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-08-21 01:18:34 +04:00
case c3__dtls: p_gen = u2t(gen);
_play_used();
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
return u2nc(c3__atom, u2_blip);
2013-09-29 00:21:18 +04:00
}
2014-08-21 01:18:34 +04:00
case c3__dtzz: u2_cx_cell(u2t(gen), &p_gen, &q_gen);
_play_used();
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
u2_noun boc = (u2_no == u2ud(q_gen))
2013-09-29 00:21:18 +04:00
? c3__noun
2014-08-21 01:18:34 +04:00
: u2nc(c3__atom, u2k(p_gen));
2014-09-03 07:36:29 +04:00
u2_noun ret = u2_cqf_cube(q_gen, boc);
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
u2z(boc);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-08-21 01:18:34 +04:00
case c3__dttr: u2_cx_cell(u2t(gen), &p_gen, &q_gen);
_play_used();
2013-09-29 00:21:18 +04:00
{
return c3__noun;
}
2014-08-21 01:18:34 +04:00
case c3__dtzy: u2_cx_cell(u2t(gen), &p_gen, &q_gen);
_play_used();
2013-09-29 00:21:18 +04:00
{
if ( 'f' == p_gen ) {
if ( (q_gen > 1) ) {
return u2_cm_bail(c3__exit);
} else {
2014-08-21 01:18:34 +04:00
return _play_bean();
2013-09-29 00:21:18 +04:00
}
}
2014-08-21 01:18:34 +04:00
else return u2nc(c3__atom, u2k(p_gen));
2013-09-29 00:21:18 +04:00
}
2014-08-21 01:18:34 +04:00
case c3__ktbr: p_gen = u2t(gen);
_play_used();
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
u2_noun boc = _play_x(van, sut, p_gen);
2014-09-03 07:36:29 +04:00
u2_noun pro = u2_cqfu_wrap(van, boc, c3__iron);
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
u2z(boc);
2013-09-29 00:21:18 +04:00
return pro;
}
2014-08-21 01:18:34 +04:00
case c3__ktpm: p_gen = u2t(gen);
_play_used();
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
u2_noun boc = _play_x(van, sut, p_gen);
2014-09-03 07:36:29 +04:00
u2_noun pro = u2_cqfu_wrap(van, boc, c3__zinc);
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
u2z(boc);
2013-09-29 00:21:18 +04:00
return pro;
}
2014-08-21 01:18:34 +04:00
case c3__ktwt: p_gen = u2t(gen);
_play_used();
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
u2_noun boc = _play_x(van, sut, p_gen);
2014-09-03 07:36:29 +04:00
u2_noun pro = u2_cqfu_wrap(van, boc, c3__lead);
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
u2z(boc);
2013-09-29 00:21:18 +04:00
return pro;
}
2014-08-21 01:18:34 +04:00
case c3__ktts: u2_cx_cell(u2t(gen), &p_gen, &q_gen);
_play_used();
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
u2_noun boc = _play_x(van, sut, q_gen);
2014-09-03 07:36:29 +04:00
u2_noun ret = u2_cqfu_conk(van, boc, p_gen);
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
u2z(boc);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-08-21 01:18:34 +04:00
case c3__ktzp: u2_cx_cell(u2t(gen), &p_gen, &q_gen);
_play_used();
{
2014-08-21 01:18:34 +04:00
u2_noun boc = _play_x(van, sut, q_gen);
2014-09-03 07:36:29 +04:00
u2_noun ret = u2_cqfu_conk(van, boc, p_gen);
2014-08-21 01:18:34 +04:00
u2z(boc);
return ret;
}
2014-08-21 01:18:34 +04:00
case c3__ktsg: p_gen = u2t(gen);
_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-08-21 01:18:34 +04:00
case c3__kthx: u2_cx_cell(u2t(gen), &p_gen, &q_gen);
_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-08-21 01:18:34 +04:00
case c3__ktls: u2_cx_cell(u2t(gen), &p_gen, &q_gen);
_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-08-21 01:18:34 +04:00
case c3__tsgr: u2_cx_cell(u2t(gen), &p_gen, &q_gen);
_play_used();
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
u2_noun boc = _play_x(van, sut, p_gen);
u2_noun ret = _play_x(van, boc, q_gen);
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
u2z(boc);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-08-21 01:18:34 +04:00
case c3__tstr: u2_cx_trel(u2t(gen), &p_gen, &q_gen, &r_gen);
_play_used();
2013-12-26 21:12:07 +04:00
{
2014-09-03 07:36:29 +04:00
u2_noun sep = u2_cqfu_seep(van, sut, c3__both, q_gen);
2014-08-21 01:18:34 +04:00
u2_noun bid = u2nt(u2k(p_gen), u2k(q_gen), sep);
2014-09-03 07:36:29 +04:00
u2_noun boc = u2_cqf_bull(bid, sut);
2014-08-21 01:18:34 +04:00
u2_noun ret = _play_x(van, boc, r_gen);
2013-12-26 21:12:07 +04:00
u2z(bid);
u2z(boc);
return ret;
}
2014-08-21 01:18:34 +04:00
case c3__cnts: u2_cx_cell(u2t(gen), &p_gen, &q_gen);
_play_used();
2013-12-15 12:23:23 +04:00
{
2014-09-03 07:36:29 +04:00
u2_noun sec = u2_cqfu_seek(van, sut, c3__read, p_gen);
2014-08-21 01:18:34 +04:00
u2_noun lar = _play_foil(sec);
u2_noun q_lar = u2t(lar);
u2_noun qq_lar = u2t(q_lar);
2014-09-03 07:36:29 +04:00
u2_noun mew = u2_cqfu_snub(van, sut, q_gen);
2014-08-21 01:18:34 +04:00
u2_noun rag = _play_edit(van, sut, mew, u2k(qq_lar));
2014-09-03 07:36:29 +04:00
u2_noun ret = u2_cqfu_fire(van, sut, rag);
2013-12-15 12:23:23 +04:00
2014-08-21 01:18:34 +04:00
u2z(rag);
u2z(mew);
u2z(lar);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-08-21 01:18:34 +04:00
case c3__pmcl: u2_cx_cell(u2t(gen), &p_gen, &q_gen);
_play_used();
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
u2_noun ruf = u2nt
(c3__clhp,
u2nc(u2_nul, 1),
u2k(p_gen));
u2_noun ret = _play_grow(van, sut, c3__zinc, ruf, q_gen);
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
u2z(ruf);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-08-21 01:18:34 +04:00
case c3__brcn: p_gen = u2t(gen);
_play_used();
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
u2_noun ruf = u2nc(u2_nul, 1);
u2_noun ret = _play_grow(van, sut, c3__gold, ruf, p_gen);
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
u2z(ruf);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-08-21 01:18:34 +04:00
case c3__pmcn: p_gen = u2t(gen);
_play_used();
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
u2_noun ruf = u2nc(u2_nul, 1);
u2_noun ret = _play_grow(van, sut, c3__lead, ruf, p_gen);
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
u2z(ruf);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-08-21 01:18:34 +04:00
case c3__pmls: u2_cx_cell(u2t(gen), &p_gen, &q_gen);
_play_used();
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
u2_noun ruf = u2nt
(c3__clhp,
u2nc(u2_nul, 1),
u2k(p_gen));
u2_noun ret = _play_grow(van, sut, c3__iron, ruf, q_gen);
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
u2z(ruf);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-08-21 01:18:34 +04:00
case c3__sgzp: u2_cx_cell(u2t(gen), &p_gen, &q_gen);
_play_used();
2013-12-05 02:30:09 +04:00
{
2014-09-03 07:36:29 +04:00
u2_noun typ = u2_cqfu_play(van, sut, p_gen);
u2_noun dug = u2_cqfu_duck(van, typ);
2013-12-05 02:30:09 +04:00
u2_noun ret;
2014-08-21 01:18:34 +04:00
u2_ct_push(u2nc(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-08-21 01:18:34 +04:00
u2_ct_drop();
2013-12-05 02:30:09 +04:00
2014-08-21 01:18:34 +04:00
u2z(typ);
2013-12-05 02:30:09 +04:00
return ret;
}
2014-08-21 01:18:34 +04:00
case c3__sggr: u2_cx_cell(u2t(gen), &p_gen, &q_gen);
_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-08-21 01:18:34 +04:00
case c3__zpts: p_gen = u2t(gen);
_play_used();
2013-09-29 00:21:18 +04:00
{
return c3__noun;
}
2014-08-21 01:18:34 +04:00
case c3__zpcm: u2_cx_cell(u2t(gen), &p_gen, &q_gen);
_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-08-21 01:18:34 +04:00
case c3__zpcb: u2_cx_cell(u2t(gen), &p_gen, &q_gen);
2013-09-29 00:21:18 +04:00
{
u2_noun ret;
2014-08-21 01:18:34 +04:00
u2_ct_push(u2nc(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-08-21 01:18:34 +04:00
u2_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-08-21 01:24:29 +04:00
u2_noun pet = u2_cj_hook(u2k(van), "seed");
2014-08-21 01:18:34 +04:00
u2_noun ret = u2k(u2h(pet));
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
u2z(pet);
2013-09-29 00:21:18 +04:00
return ret;
}
2014-08-21 01:18:34 +04:00
case c3__zpsm: u2_cx_cell(u2t(gen), &p_gen, &q_gen);
_play_used();
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
u2_noun zur = _play_x(van, sut, p_gen);
u2_noun vos = _play_x(van, sut, q_gen);
2014-09-03 07:36:29 +04:00
u2_noun ret = u2_cqf_cell(zur, vos);
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
u2z(zur);
u2z(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-04 01:33:18 +04:00
u2_noun
2014-09-03 09:46:55 +04:00
_cqfu_play(
2014-09-04 01:33:18 +04:00
u2_noun van,
u2_noun sut,
u2_noun gen)
2013-09-29 00:21:18 +04:00
{
2014-09-03 09:46:55 +04:00
u2_noun von = u2_ci_molt(u2k(van), u2_cqfu_van_vet, u2_no, 0);
2014-08-21 01:18:34 +04:00
u2_noun ret = _play_x(von, sut, gen);
2013-09-29 00:21:18 +04:00
2014-08-21 01:18:34 +04:00
u2z(von);
2013-09-29 00:21:18 +04:00
return ret;
}
/* boilerplate
*/
2014-09-04 01:33:18 +04:00
u2_noun
2014-09-03 09:46:55 +04:00
u2_cwfu_play(
2014-09-04 01:33:18 +04:00
u2_noun cor)
2013-09-29 00:21:18 +04:00
{
u2_noun sut, gen, van;
2014-08-21 01:18:34 +04:00
if ( (u2_no == u2_cr_mean(cor, u2_cv_sam, &gen, u2_cv_con, &van, 0)) ||
(u2_none == (sut = u2_cr_at(u2_cv_sam, van))) )
2013-09-29 00:21:18 +04:00
{
2014-08-21 01:18:34 +04:00
return u2_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-04 01:33:18 +04:00
u2_noun
u2_cqfu_play(u2_noun van,
u2_noun sut,
u2_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
}