+#include <math.h>
+#include <limits.h>
#include "shogi.h"
-int
+int CONV
solve_problems( tree_t * restrict ptree, unsigned int nposition )
{
const char *str_move;
for ( uposition = 0; uposition < nposition; uposition++ )
{
istatus = in_CSA( ptree, &record_problems, NULL,
- ( flag_nomake_move | flag_detect_hang
- | flag_rejections ) );
+ ( flag_nomake_move | flag_detect_hang ) );
if ( istatus < 0 ) { return istatus; }
if ( istatus > record_next )
game_status_save = game_status;
game_status |= flag_problem | flag_nopeek | flag_thinking;
- iresult = iterate( ptree, 0 );
+ iresult = iterate( ptree );
game_status = game_status_save;
if ( iresult < 0 ) { return iresult; }
return 1;
}
+
+
+#if defined(DFPN)
+int CONV
+solve_mate_problems( tree_t * restrict ptree, unsigned int nposition )
+{
+ unsigned int uposition;
+ int iret;
+
+ for ( uposition = 0; uposition < nposition; uposition++ )
+ {
+ int imove, istatus;
+ unsigned int record_move;
+
+ for ( imove = 0; ; imove++ )
+ {
+ istatus = in_CSA( ptree, &record_problems, &record_move,
+ ( flag_nomake_move | flag_detect_hang
+ | flag_nofmargin ) );
+ if ( istatus < 0 )
+ {
+ str_error = str_illegal_move;
+ return -1;
+ }
+
+ if ( istatus >= record_eof ) { break; }
+
+ iret = make_move_root( ptree, record_move, 0 );
+ if ( iret < 0 ) { return iret; }
+ }
+
+ Out( "Problem #%d %s\n",
+ uposition, ptree->nsuc_check[1] ? "(in check)" : "" );
+
+ iret = dfpn( ptree, root_turn, 1 );
+ if ( iret < 0 ) { return iret; }
+
+ if ( istatus == record_eof ) { break; }
+ if ( istatus == record_misc )
+ {
+ iret = record_wind( &record_problems );
+ if ( iret < 0 ) { return iret; }
+ if ( iret == record_eof ) { break; }
+ }
+ }
+
+ return 1;
+}
+#endif