-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTypes.cs
148 lines (122 loc) · 2.24 KB
/
Types.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Move = System.Int32;
using Score = System.Int32;
namespace NSRapchess
{
public class CDataOut
{
public string moveBst = String.Empty;
public string movePonder = String.Empty;
public void Restart()
{
moveBst = String.Empty;
movePonder = String.Empty;
}
}
public class COptions
{
public bool ponder = true;
public COptions()
{
ponder = true;
}
}
public class CDataIn
{
public bool infinite = false;
public bool ponder = false;
public bool post = true;
public int time = 0;
public int depth = 0;
public ulong nodes = 0;
public CDataIn()
{
Reset();
}
public void Reset()
{
infinite = false;
ponder = false;
post = true;
}
}
public enum NodeType : byte
{
Root,
Pv,
NonPv
}
public struct MoveStack
{
internal Move move;
internal int score;
public MoveStack(Move move, Score score)
{
this.move = move;
this.score = score;
}
};
public class MList
{
internal readonly MoveStack[] table = new MoveStack[Constants.MAX_MOVES];
internal int count = 0;
public int bst = 0;
public void Add(Move move)
{
table[count++].move = move;
}
public void Add(MoveStack ms)
{
table[count++] = ms;
}
public int Find(Move m)
{
for (int n = 0; n < count; n++)
if (table[n].move == m)
return n;
return -1;
}
public bool Remove(Move m)
{
for (int n = 0; n < count; n++)
if (table[n].move == m)
{
table[n]=table[--count];
return true;
}
return false;
}
public void RemoveAt(int i)
{
table[i] = table[--count];
}
public void CopyTo(MList to)
{
Array.Copy(table, to.table, count);
to.count = count;
to.bst = bst;
}
public MList Copy()
{
MList copy = new MList();
Array.Copy(table, copy.table, count);
copy.count = count;
copy.bst = bst;
return copy;
}
public void Best(Move m)
{
for (int n = bst; n < count; n++)
if (table[n].move == m)
{
(table[n], table[bst]) = (table[bst],table[n]);
bst++;
return;
}
}
}
}