Skip to content

Commit ef07af3

Browse files
committed
Minor fixes & safeguards for 2.4.1 by Yuri Censor
Minor fixes & safeguards for 2.4.1 by Yuri Censor
1 parent 16f8403 commit ef07af3

31 files changed

+619
-412
lines changed

src/50move.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ along with this program. If not, see http://www.gnu.org/licenses/.
3232

3333
#include "fire.h"
3434

35-
int Move50(typePos * Position)
35+
int Move50(typePos *Position)
3636
{
3737
typeMoveList List[256];
3838
typeMoveList *p;

src/Firenzina.vcxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
<InterproceduralOptimization>true</InterproceduralOptimization>
5555
<UseIntelIPP>Sequential</UseIntelIPP>
5656
<UseIntelMKL>No</UseIntelMKL>
57-
<ProfileGuidedOptimization>PGOOptimize</ProfileGuidedOptimization>
57+
<ProfileGuidedOptimization>PGOInstrument</ProfileGuidedOptimization>
5858
</PropertyGroup>
5959
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
6060
<ImportGroup Label="ExtensionSettings">

src/all_node.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ along with this program. If not, see http://www.gnu.org/licenses/.
4141
#include "black.h"
4242
#endif
4343

44-
int MyAll(typePos* Position, int value, int depth)
44+
int MyAll(typePos *Position, int value, int depth)
4545
{
4646
int move, i;
4747
TransDeclare();
@@ -119,15 +119,15 @@ int MyAll(typePos* Position, int value, int depth)
119119
if (VerifyNull && v >= value)
120120
{
121121
int Flags = Position->Dyn->flags;
122-
Position->Dyn->flags &= ~3;
122+
Position->Dyn->flags &= ~3;
123123
new_depth -= VerifyReduction;
124124
if (QSearchCondition)
125125
v = MyQsearch(Position, value, 0);
126126
else if (LowDepthCondition)
127127
v = MyLowDepth(Position, value, new_depth);
128128
else
129129
v = MyAll(Position, value, new_depth);
130-
Position->Dyn->flags = Flags;
130+
Position->Dyn->flags = Flags;
131131
CheckHalt();
132132
}
133133
if (v >= value)
@@ -256,7 +256,7 @@ int MyAll(typePos* Position, int value, int depth)
256256
HashUpper(Position->Dyn->Hash, depth, v);
257257
return(v);
258258
}
259-
int MyAllCheck(typePos* Position, int value, int depth)
259+
int MyAllCheck(typePos *Position, int value, int depth)
260260
{
261261
int move, cnt;
262262
int trans_depth, move_depth = 0, trans_move = 0, Value, new_depth, v, i;

src/arrays.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,18 @@ GNU General Public License for more details.
2929
You should have received a copy of the GNU General Public License
3030
along with this program. If not, see http://www.gnu.org/licenses/.
3131
*******************************************************************************/
32-
32+
#include "fire.h" // Added by YC on 1/9/2014
3333
#define HashWTM (0x1220ab8c00000004)
3434

3535
#ifdef OneDimensional
36-
#define InterPose(x, y) Interpose[64 * (x) + (y)]
37-
#define Evade(x, y) Evade[64 * (x) + (y)]
38-
#define Line(x, y) Line[64 * (x) + (y)]
39-
#define Hash(pi, sq) Zobrist[64 * (pi) + (sq)]
36+
//#define InterPose(x, y) Interpose[64 * (x) + (y)]
37+
//#define Evade(x, y) Evade[64 * (x) + (y)]
38+
//#define Line(x, y) Line[64 * (x) + (y)]
39+
//#define Hash(pi, sq) Zobrist[64 * (pi) + (sq)]
40+
#define InterPose(x, y) Interpose[((x)<<6) + (y)]
41+
#define Evade(x, y) Evade[((x)<<6) + (y)]
42+
#define Line(x, y) Line[((x)<<6) + (y)]
43+
#define Hash(pi, sq) Zobrist[((pi)<<6) + (sq)]
4044
SlabDeclare3(uint64, Interpose, 0100 * 0100);
4145
SlabDeclare3(uint64, Evade, 0100 * 0100);
4246
SlabDeclare3(sint8, Line, 0100 * 0100);

src/bits.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ along with this program. If not, see http://www.gnu.org/licenses/.
3131
*******************************************************************************/
3232

3333

34-
34+
#include "fire.h" // Added by YC on 1/9/2014
3535
#if defined(__GNUC__)
3636

3737
#include <limits.h>

src/board.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ GNU General Public License for more details.
2929
You should have received a copy of the GNU General Public License
3030
along with this program. If not, see http://www.gnu.org/licenses/.
3131
*******************************************************************************/
32-
32+
#include "fire.h" // Added by YC on 1/9/2014
3333
#define File(s) ((s) & 7)
3434
#define Rank(s) ((s) >> 3)
3535
#define From(s) (((s) >> 6) & 077)
@@ -107,7 +107,7 @@ typedef struct
107107
#define AttFile(sq) (AttR (sq) & FileArray[File (sq)])
108108
#define AttQ(fr) (AttR(fr) | AttB(fr))
109109
#define MaxStack 256
110-
#define NumBytesToCopy (64 + 128 + 32 + 128 + 4)
110+
#define NumBytesToCopy 356 // (64 + 128 + 32 + 128 + 4)
111111

112112
struct TP
113113
{

src/control.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@ GNU General Public License for more details.
2929
You should have received a copy of the GNU General Public License
3030
along with this program. If not, see http://www.gnu.org/licenses/.
3131
*******************************************************************************/
32-
32+
#include "fire.h"
3333
#if defined(_WIN32) || defined(_WIN64)
3434
#include <setjmp.h>
3535
#include <time.h>
3636
#endif
3737

38-
boolean EasyMove;
39-
boolean BadMove;
40-
boolean BattleMove;
41-
boolean Analysing;
38+
bool EasyMove;
39+
bool BadMove;
40+
bool BattleMove;
41+
bool Analysing;
4242

4343
extern jmp_buf J;
4444

@@ -52,4 +52,4 @@ uint32 RootBestMove;
5252
uint64 StartClock;
5353
uint64 CPUtime;
5454

55-
volatile boolean JumpIsSet;
55+
volatile bool JumpIsSet;

src/cut_node.c

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ int MyCut(typePos* Position, int value, int depth)
4646
int height, move, i, singular;
4747
TransDeclare();
4848
int trans_depth, move_depth = 0, trans_move = 0, Value, cnt;
49-
int v, extend, new_depth, move_is_check;
49+
int v, extend, new_depth, half_depth, near_half_depth, move_is_check;
5050
typeNext NextMove[1];
5151
typeDynamic *Pos0 = Position->Dyn;
5252
uint64 zob = Position->Dyn->Hash;
@@ -150,17 +150,20 @@ int MyCut(typePos* Position, int value, int depth)
150150
singular = 0;
151151
if (depth >= MinTransMoveDepth && trans_move && MyOK(Position, trans_move))
152152
{
153-
v = MyExclude(Position, value - depth, depth - DepthRed, trans_move & 0x7fff);
153+
half_depth = depth >> 1;
154+
near_half_depth = depth - (MIN (12, half_depth));
155+
v = MyExclude(Position, value - depth, near_half_depth, trans_move & 0x7fff);
154156
CheckHalt();
155157
if (v < value - depth)
156158
{
157159
singular++;
158160
height = Height(Position);
159161
if (height << 2 <= depth)
160162
singular++;
161-
v = MyExclude(Position, value - ValueRed, depth - DepthRed, trans_move & 0x7fff);
163+
164+
v = MyExclude(Position, value - half_depth, near_half_depth, trans_move & 0x7fff);
162165
CheckHalt();
163-
if (v < value - ValueRed)
166+
if (v < value - half_depth)
164167
{
165168
singular++;
166169
if (height << 3 <= depth)
@@ -295,10 +298,10 @@ int MyCut(typePos* Position, int value, int depth)
295298
HashUpperCut(Position, depth, v);
296299
return(v);
297300
}
298-
int MyCutCheck(typePos * Position, int value, int depth)
301+
int MyCutCheck(typePos *Position, int value, int depth)
299302
{
300303
int height, move, cnt, Reduction, extend;
301-
int trans_depth, move_depth = 0, trans_move = 0, Value, new_depth, v, i;
304+
int trans_depth, move_depth = 0, trans_move = 0, Value, new_depth, near_half_depth, v, i;
302305
TransDeclare();
303306
typeMoveList List[256], *list, *p, *q;
304307
uint64 zob = Position->Dyn->Hash;
@@ -363,15 +366,16 @@ int MyCutCheck(typePos * Position, int value, int depth)
363366
singular = 0;
364367
if (depth >= MinTransMoveDepth && trans_move)
365368
{
366-
v = MyExcludeCheck(Position, value - depth, depth - DepthRed, trans_move & 0x7fff);
369+
near_half_depth = depth - (MIN (12, depth >> 1));
370+
v = MyExcludeCheck(Position, value - depth, near_half_depth, trans_move & 0x7fff);
367371
CheckHalt();
368372
if (v < value - depth)
369373
{
370374
singular++;
371375
height = Height(Position);
372376
if (height << 2 <= depth)
373377
singular++;
374-
v = MyExcludeCheck(Position, value - 2 * depth, depth - DepthRed, trans_move & 0x7fff);
378+
v = MyExcludeCheck(Position, value - 2 * depth, near_half_depth, trans_move & 0x7fff);
375379
CheckHalt();
376380
if (v < value - 2 *depth)
377381
{

0 commit comments

Comments
 (0)