2013-09-29 00:21:18 +04:00
|
|
|
/* j/6/ut_park.c
|
|
|
|
**
|
|
|
|
*/
|
|
|
|
#include "all.h"
|
2014-09-04 07:10:43 +04:00
|
|
|
|
2013-09-29 00:21:18 +04:00
|
|
|
|
|
|
|
/* logic
|
|
|
|
*/
|
2014-11-06 06:10:22 +03:00
|
|
|
u3_noun
|
2014-09-03 09:46:55 +04:00
|
|
|
_cqfu_park(
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun van,
|
|
|
|
u3_noun sut,
|
|
|
|
u3_noun way,
|
|
|
|
u3_atom axe)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-11-05 04:18:47 +03:00
|
|
|
if ( c3n == u3du(sut) || c3__core != u3h(sut) ) {
|
2014-11-06 03:20:01 +03:00
|
|
|
return u3m_bail(c3__fail);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
2014-11-06 03:20:01 +03:00
|
|
|
// else if ( c3n == u3j_hook(u3k(van), "vet") ) {
|
2014-11-06 22:13:57 +03:00
|
|
|
else if ( c3n == u3r_at(u3qfu_van_vet, van) ) {
|
2014-11-05 04:18:47 +03:00
|
|
|
return c3y;
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
else {
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun p_sut, q_sut, pq_sut;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-06 03:20:01 +03:00
|
|
|
u3x_cell(u3t(sut), &p_sut, &q_sut);
|
|
|
|
u3x_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 ) {
|
2014-11-05 04:18:47 +03:00
|
|
|
return c3y;
|
|
|
|
} else return c3n;
|
2013-12-18 05:47:20 +04:00
|
|
|
}
|
2013-09-29 00:21:18 +04:00
|
|
|
if ( c3__read == way ) {
|
|
|
|
switch ( pq_sut ) {
|
2014-11-06 03:20:01 +03:00
|
|
|
default: return u3m_bail(c3__fail);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-05 04:18:47 +03:00
|
|
|
case c3__gold: return c3y;
|
|
|
|
case c3__lead: return c3n;
|
|
|
|
case c3__iron: return c3n;
|
2014-04-22 05:22:11 +04:00
|
|
|
case c3__zinc: return
|
2014-11-06 03:20:01 +03:00
|
|
|
c3a(!(u3r_sing(1, axe)),
|
2014-11-06 22:13:57 +03:00
|
|
|
u3r_sing(2, u3qc_cap(axe)));
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ( c3__rite == way ) {
|
|
|
|
switch ( pq_sut ) {
|
2014-11-06 03:20:01 +03:00
|
|
|
default: return u3m_bail(c3__fail);
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-05 04:18:47 +03:00
|
|
|
case c3__gold: return c3y;
|
|
|
|
case c3__lead: return c3n;
|
2014-04-22 05:22:11 +04:00
|
|
|
case c3__iron: return
|
2014-11-06 03:20:01 +03:00
|
|
|
c3a(!(u3r_sing(1, axe)),
|
2014-11-06 22:13:57 +03:00
|
|
|
u3r_sing(2, u3qc_cap(axe)));
|
2014-11-05 04:18:47 +03:00
|
|
|
case c3__zinc: return c3n;
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
}
|
2014-11-05 04:18:47 +03:00
|
|
|
else if ( c3__free == way ) { return c3y; }
|
2014-11-06 03:20:01 +03:00
|
|
|
else return u3m_bail(c3__fail);
|
2013-09-29 00:21:18 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* boilerplate
|
|
|
|
*/
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun
|
2014-11-06 22:13:57 +03:00
|
|
|
u3wfu_park(
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun cor)
|
2013-09-29 00:21:18 +04:00
|
|
|
{
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun sut, way, axe, van;
|
2013-09-29 00:21:18 +04:00
|
|
|
|
2014-11-18 00:56:51 +03:00
|
|
|
if ( (c3n == u3r_mean(cor, u3x_sam_2, &way,
|
|
|
|
u3x_sam_3, &axe,
|
|
|
|
u3x_con, &van,
|
2013-09-29 00:21:18 +04:00
|
|
|
0)) ||
|
2014-11-05 04:18:47 +03:00
|
|
|
(c3n == u3ud(axe)) ||
|
2014-11-18 00:56:51 +03:00
|
|
|
(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_park(van, sut, way, axe);
|
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_park(u3_noun van,
|
2014-09-06 00:13:24 +04:00
|
|
|
u3_noun sut,
|
|
|
|
u3_noun way,
|
|
|
|
u3_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
|
|
|
}
|
|
|
|
|