2013-09-29 00:21:18 +04:00
|
|
|
/* j/6/ut_park.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-09-04 01:33:18 +04:00
|
|
|
u2_bean
|
2014-09-03 09:46:55 +04:00
|
|
|
_cqfu_park(
|
2014-09-04 01:33:18 +04:00
|
|
|
u2_noun van,
|
|
|
|
u2_noun sut,
|
|
|
|
u2_noun way,
|
|
|
|
u2_atom axe)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-08-21 01:18:34 +04:00
|
|
|
if ( u2_no == u2du(sut) || c3__core != u2h(sut) ) {
|
|
|
|
return u2_cm_bail(c3__fail);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
2014-08-21 01:24:29 +04:00
|
|
|
// else if ( u2_no == u2_cj_hook(u2k(van), "vet") ) {
|
2014-09-03 09:46:55 +04:00
|
|
|
else if ( u2_no == u2_cr_at(u2_cqfu_van_vet, van) ) {
|
2013-09-29 00:21:18 +04:00
|
|
|
return u2_yes;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
u2_noun p_sut, q_sut, pq_sut;
|
|
|
|
|
2014-08-21 01:18:34 +04:00
|
|
|
u2_cx_cell(u2t(sut), &p_sut, &q_sut);
|
|
|
|
u2_cx_cell(q_sut, &pq_sut, 0);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2013-12-18 05:47:20 +04:00
|
|
|
if ( c3__both == way ) {
|
2013-12-27 00:58:55 +04:00
|
|
|
if ( c3__gold == pq_sut ) {
|
2013-12-18 05:47:20 +04:00
|
|
|
return u2_yes;
|
|
|
|
} else return u2_no;
|
|
|
|
}
|
2013-09-29 00:21:18 +04:00
|
|
|
if ( c3__read == way ) {
|
|
|
|
switch ( pq_sut ) {
|
2014-08-21 01:18:34 +04:00
|
|
|
default: return u2_cm_bail(c3__fail);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
|
|
|
case c3__gold: return u2_yes;
|
|
|
|
case c3__lead: return u2_no;
|
|
|
|
case c3__iron: return u2_no;
|
2014-04-22 05:22:11 +04:00
|
|
|
case c3__zinc: return
|
2014-08-21 01:18:34 +04:00
|
|
|
u2_and(u2_not(u2_cr_sing(1, axe)),
|
2014-09-03 07:36:29 +04:00
|
|
|
u2_cr_sing(2, u2_cqc_cap(axe)));
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ( c3__rite == way ) {
|
|
|
|
switch ( pq_sut ) {
|
2014-08-21 01:18:34 +04:00
|
|
|
default: return u2_cm_bail(c3__fail);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
|
|
|
case c3__gold: return u2_yes;
|
|
|
|
case c3__lead: return u2_no;
|
2014-04-22 05:22:11 +04:00
|
|
|
case c3__iron: return
|
2014-08-21 01:18:34 +04:00
|
|
|
u2_and(u2_not(u2_cr_sing(1, axe)),
|
2014-09-03 07:36:29 +04:00
|
|
|
u2_cr_sing(2, u2_cqc_cap(axe)));
|
2013-09-29 00:21:18 +04:00
|
|
|
case c3__zinc: return u2_no;
|
|
|
|
}
|
|
|
|
}
|
2014-01-04 06:59:56 +04:00
|
|
|
else if ( c3__free == way ) { return u2_yes; }
|
2014-08-21 01:18:34 +04:00
|
|
|
else return u2_cm_bail(c3__fail);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* boilerplate
|
|
|
|
*/
|
2014-09-04 01:33:18 +04:00
|
|
|
u2_noun
|
2014-09-03 09:46:55 +04:00
|
|
|
u2_cwfu_park(
|
2014-09-04 01:33:18 +04:00
|
|
|
u2_noun cor)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
|
|
|
u2_noun sut, way, axe, van;
|
|
|
|
|
2014-08-21 01:18:34 +04:00
|
|
|
if ( (u2_no == u2_cr_mean(cor, u2_cv_sam_2, &way,
|
2013-09-29 00:21:18 +04:00
|
|
|
u2_cv_sam_3, &axe,
|
2014-04-22 05:22:11 +04:00
|
|
|
u2_cv_con, &van,
|
2013-09-29 00:21:18 +04:00
|
|
|
0)) ||
|
2014-08-21 01:18:34 +04:00
|
|
|
(u2_no == u2ud(axe)) ||
|
|
|
|
(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_park(van, sut, way, axe);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-04 01:33:18 +04:00
|
|
|
u2_noun
|
|
|
|
u2_cqfu_park(u2_noun van,
|
|
|
|
u2_noun sut,
|
|
|
|
u2_noun way,
|
|
|
|
u2_noun axe)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-09-03 09:46:55 +04:00
|
|
|
return _cqfu_park(van, sut, way, axe);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
|