├── Chess_AI.ipynb
├── README.md
├── model.h5
├── modelversion1.h5
├── modelversion2.h5
├── modelversion3.h5
└── stockfish
└── 13
├── AUTHORS
├── Copying.txt
├── INSTALL_RECEIPT.json
├── README.md
└── bin
└── stockfish
/Chess_AI.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "code",
5 | "execution_count": 13,
6 | "metadata": {
7 | "id": "QauvWk2MkddY"
8 | },
9 | "outputs": [],
10 | "source": [
11 | "import chess\n",
12 | "import chess.engine\n",
13 | "import random\n",
14 | "import numpy\n",
15 | "\n",
16 | "\n",
17 | "# this function will create our x (board)\n",
18 | "def random_board(max_depth=200):\n",
19 | " board = chess.Board()\n",
20 | " depth = random.randrange(0, max_depth)\n",
21 | "\n",
22 | " for _ in range(depth):\n",
23 | " all_moves = list(board.legal_moves)\n",
24 | " random_move = random.choice(all_moves)\n",
25 | " board.push(random_move)\n",
26 | " if board.is_game_over():\n",
27 | " break\n",
28 | "\n",
29 | " return board\n",
30 | "\n",
31 | "\n",
32 | "# this function will create our f(x) (score)\n",
33 | "def stockfish(board, depth):\n",
34 | " with chess.engine.SimpleEngine.popen_uci('stockfish/13/bin/stockfish') as sf:\n",
35 | " result = sf.analyse(board, chess.engine.Limit(depth=depth))\n",
36 | " score = result['score'].white().score()\n",
37 | " return score"
38 | ]
39 | },
40 | {
41 | "cell_type": "code",
42 | "execution_count": 14,
43 | "metadata": {
44 | "id": "ULOEWyyfYqtq"
45 | },
46 | "outputs": [
47 | {
48 | "data": {
49 | "image/svg+xml": [
50 | ""
51 | ],
52 | "text/plain": [
53 | "Board('1r6/1qNprk1P/P7/4P1p1/1Rp1b1P1/8/4R3/3K2N1 w - - 1 59')"
54 | ]
55 | },
56 | "execution_count": 14,
57 | "metadata": {},
58 | "output_type": "execute_result"
59 | }
60 | ],
61 | "source": [
62 | "board = random_board()\n",
63 | "board"
64 | ]
65 | },
66 | {
67 | "cell_type": "code",
68 | "execution_count": 15,
69 | "metadata": {
70 | "id": "QtZy4cR8ZMhq"
71 | },
72 | "outputs": [
73 | {
74 | "name": "stdout",
75 | "output_type": "stream",
76 | "text": [
77 | "769\n"
78 | ]
79 | }
80 | ],
81 | "source": [
82 | "print(stockfish(board, 10))"
83 | ]
84 | },
85 | {
86 | "cell_type": "markdown",
87 | "metadata": {
88 | "id": "6Fgr5NTWqgsA"
89 | },
90 | "source": [
91 | "The Idea is that the Deep Learning Network will predict this score based on the positions of the pieces on the board."
92 | ]
93 | },
94 | {
95 | "cell_type": "markdown",
96 | "metadata": {
97 | "id": "cMgBRL1Kdc0B"
98 | },
99 | "source": [
100 | "# Creating the dataset"
101 | ]
102 | },
103 | {
104 | "cell_type": "markdown",
105 | "metadata": {
106 | "id": "d4Sg-yu0sS4t"
107 | },
108 | "source": [
109 | "Now we need to convert the board representation to something meaningful.\n",
110 | "A 3d matrix of sizes **8 x 8 x 14** where 8x8 repersents the board and the 14 represents the 7 different pieces "
111 | ]
112 | },
113 | {
114 | "cell_type": "code",
115 | "execution_count": 16,
116 | "metadata": {
117 | "id": "Rdo64dA7dhBE"
118 | },
119 | "outputs": [],
120 | "source": [
121 | "squares_index = {\n",
122 | " 'a': 0,\n",
123 | " 'b': 1,\n",
124 | " 'c': 2,\n",
125 | " 'd': 3,\n",
126 | " 'e': 4,\n",
127 | " 'f': 5,\n",
128 | " 'g': 6,\n",
129 | " 'h': 7\n",
130 | "}\n",
131 | "\n",
132 | "\n",
133 | "# example: h3 -> 17\n",
134 | "def square_to_index(square):\n",
135 | " letter = chess.square_name(square)\n",
136 | " return 8 - int(letter[1]), squares_index[letter[0]]\n",
137 | "\n",
138 | "\n",
139 | "def split_dims(board):\n",
140 | " # this is the 3d matrix\n",
141 | " board3d = numpy.zeros((14, 8, 8), dtype=numpy.int8)\n",
142 | "\n",
143 | " # here we add the pieces's view on the matrix\n",
144 | " for piece in chess.PIECE_TYPES:\n",
145 | " for square in board.pieces(piece, chess.WHITE):\n",
146 | " idx = numpy.unravel_index(square, (8, 8))\n",
147 | " board3d[piece - 1][7 - idx[0]][idx[1]] = 1\n",
148 | " for square in board.pieces(piece, chess.BLACK):\n",
149 | " idx = numpy.unravel_index(square, (8, 8))\n",
150 | " board3d[piece + 5][7 - idx[0]][idx[1]] = 1\n",
151 | "\n",
152 | " # add attacks and valid moves too\n",
153 | " # so the network knows what is being attacked\n",
154 | " aux = board.turn\n",
155 | " board.turn = chess.WHITE\n",
156 | " for move in board.legal_moves:\n",
157 | " i, j = square_to_index(move.to_square)\n",
158 | " board3d[12][i][j] = 1\n",
159 | " board.turn = chess.BLACK\n",
160 | " for move in board.legal_moves:\n",
161 | " i, j = square_to_index(move.to_square)\n",
162 | " board3d[13][i][j] = 1\n",
163 | " board.turn = aux\n",
164 | "\n",
165 | " return board3d"
166 | ]
167 | },
168 | {
169 | "cell_type": "code",
170 | "execution_count": 17,
171 | "metadata": {
172 | "id": "gHONl_M1hG9i"
173 | },
174 | "outputs": [
175 | {
176 | "data": {
177 | "text/plain": [
178 | "array([[[0, 0, 0, 0, 0, 0, 0, 0],\n",
179 | " [0, 0, 0, 0, 0, 0, 0, 1],\n",
180 | " [1, 0, 0, 0, 0, 0, 0, 0],\n",
181 | " [0, 0, 0, 0, 1, 0, 0, 0],\n",
182 | " [0, 0, 0, 0, 0, 0, 1, 0],\n",
183 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
184 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
185 | " [0, 0, 0, 0, 0, 0, 0, 0]],\n",
186 | "\n",
187 | " [[0, 0, 0, 0, 0, 0, 0, 0],\n",
188 | " [0, 0, 1, 0, 0, 0, 0, 0],\n",
189 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
190 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
191 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
192 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
193 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
194 | " [0, 0, 0, 0, 0, 0, 1, 0]],\n",
195 | "\n",
196 | " [[0, 0, 0, 0, 0, 0, 0, 0],\n",
197 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
198 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
199 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
200 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
201 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
202 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
203 | " [0, 0, 0, 0, 0, 0, 0, 0]],\n",
204 | "\n",
205 | " [[0, 0, 0, 0, 0, 0, 0, 0],\n",
206 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
207 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
208 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
209 | " [0, 1, 0, 0, 0, 0, 0, 0],\n",
210 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
211 | " [0, 0, 0, 0, 1, 0, 0, 0],\n",
212 | " [0, 0, 0, 0, 0, 0, 0, 0]],\n",
213 | "\n",
214 | " [[0, 0, 0, 0, 0, 0, 0, 0],\n",
215 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
216 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
217 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
218 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
219 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
220 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
221 | " [0, 0, 0, 0, 0, 0, 0, 0]],\n",
222 | "\n",
223 | " [[0, 0, 0, 0, 0, 0, 0, 0],\n",
224 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
225 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
226 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
227 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
228 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
229 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
230 | " [0, 0, 0, 1, 0, 0, 0, 0]],\n",
231 | "\n",
232 | " [[0, 0, 0, 0, 0, 0, 0, 0],\n",
233 | " [0, 0, 0, 1, 0, 0, 0, 0],\n",
234 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
235 | " [0, 0, 0, 0, 0, 0, 1, 0],\n",
236 | " [0, 0, 1, 0, 0, 0, 0, 0],\n",
237 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
238 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
239 | " [0, 0, 0, 0, 0, 0, 0, 0]],\n",
240 | "\n",
241 | " [[0, 0, 0, 0, 0, 0, 0, 0],\n",
242 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
243 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
244 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
245 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
246 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
247 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
248 | " [0, 0, 0, 0, 0, 0, 0, 0]],\n",
249 | "\n",
250 | " [[0, 0, 0, 0, 0, 0, 0, 0],\n",
251 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
252 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
253 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
254 | " [0, 0, 0, 0, 1, 0, 0, 0],\n",
255 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
256 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
257 | " [0, 0, 0, 0, 0, 0, 0, 0]],\n",
258 | "\n",
259 | " [[0, 1, 0, 0, 0, 0, 0, 0],\n",
260 | " [0, 0, 0, 0, 1, 0, 0, 0],\n",
261 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
262 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
263 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
264 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
265 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
266 | " [0, 0, 0, 0, 0, 0, 0, 0]],\n",
267 | "\n",
268 | " [[0, 0, 0, 0, 0, 0, 0, 0],\n",
269 | " [0, 1, 0, 0, 0, 0, 0, 0],\n",
270 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
271 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
272 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
273 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
274 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
275 | " [0, 0, 0, 0, 0, 0, 0, 0]],\n",
276 | "\n",
277 | " [[0, 0, 0, 0, 0, 0, 0, 0],\n",
278 | " [0, 0, 0, 0, 0, 1, 0, 0],\n",
279 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
280 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
281 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
282 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
283 | " [0, 0, 0, 0, 0, 0, 0, 0],\n",
284 | " [0, 0, 0, 0, 0, 0, 0, 0]],\n",
285 | "\n",
286 | " [[1, 0, 0, 0, 1, 0, 0, 1],\n",
287 | " [1, 1, 0, 0, 0, 0, 0, 0],\n",
288 | " [0, 1, 0, 0, 1, 0, 0, 0],\n",
289 | " [0, 1, 0, 1, 0, 0, 0, 0],\n",
290 | " [1, 0, 1, 0, 1, 0, 0, 0],\n",
291 | " [0, 1, 0, 0, 1, 1, 0, 1],\n",
292 | " [1, 1, 1, 1, 0, 1, 1, 1],\n",
293 | " [0, 1, 1, 0, 1, 0, 0, 0]],\n",
294 | "\n",
295 | " [[1, 0, 1, 1, 1, 1, 1, 1],\n",
296 | " [1, 0, 1, 0, 0, 0, 1, 1],\n",
297 | " [1, 1, 1, 1, 1, 0, 1, 0],\n",
298 | " [0, 1, 0, 1, 1, 1, 0, 0],\n",
299 | " [0, 1, 0, 0, 0, 0, 0, 0],\n",
300 | " [0, 0, 1, 1, 0, 1, 0, 0],\n",
301 | " [0, 0, 1, 0, 0, 0, 1, 0],\n",
302 | " [0, 1, 0, 0, 0, 0, 0, 1]]], dtype=int8)"
303 | ]
304 | },
305 | "execution_count": 17,
306 | "metadata": {},
307 | "output_type": "execute_result"
308 | }
309 | ],
310 | "source": [
311 | "split_dims(board)"
312 | ]
313 | },
314 | {
315 | "cell_type": "markdown",
316 | "metadata": {
317 | "id": "OwpzPcsXfuVw"
318 | },
319 | "source": [
320 | "Now, all we have to do is call **random_board()** to create random boards, **stockfish()** to get a score for how good each board is for white.\n",
321 | "\n",
322 | "Then we convert each board to a 3d matrix using **split_dims()**, now creating the dataset is easy!"
323 | ]
324 | },
325 | {
326 | "cell_type": "markdown",
327 | "metadata": {
328 | "id": "ukmA7z-dlB6m"
329 | },
330 | "source": [
331 | "# TensorFlow!"
332 | ]
333 | },
334 | {
335 | "cell_type": "code",
336 | "execution_count": 18,
337 | "metadata": {
338 | "id": "6S7QNZqwmBOP"
339 | },
340 | "outputs": [],
341 | "source": [
342 | "import tensorflow.keras.models as models\n",
343 | "import tensorflow.keras.layers as layers\n",
344 | "import tensorflow.keras.utils as utils\n",
345 | "import tensorflow.keras.optimizers as optimizers\n",
346 | "\n",
347 | "\n",
348 | "def build_model(conv_size, conv_depth):\n",
349 | " board3d = layers.Input(shape=(14, 8, 8))\n",
350 | "\n",
351 | " # adding the convolutional layers\n",
352 | " x = board3d\n",
353 | " for _ in range(conv_depth):\n",
354 | " x = layers.Conv2D(filters=conv_size, kernel_size=3, padding='same', activation='relu')(x)\n",
355 | " x = layers.Flatten()(x)\n",
356 | " x = layers.Dense(64, 'relu')(x)\n",
357 | " x = layers.Dense(1, 'sigmoid')(x)\n",
358 | "\n",
359 | " return models.Model(inputs=board3d, outputs=x)"
360 | ]
361 | },
362 | {
363 | "cell_type": "markdown",
364 | "metadata": {
365 | "id": "6S1RCn3xn4Bu"
366 | },
367 | "source": [
368 | "Skip connections (residual network) will likely improve the model for deeper connections. If you want to test the residual model, check the code below."
369 | ]
370 | },
371 | {
372 | "cell_type": "code",
373 | "execution_count": 19,
374 | "metadata": {
375 | "id": "tAFSOFc8pJf8"
376 | },
377 | "outputs": [],
378 | "source": [
379 | "def build_model_residual(conv_size, conv_depth):\n",
380 | " board3d = layers.Input(shape=(14, 8, 8))\n",
381 | "\n",
382 | " # adding the convolutional layers\n",
383 | " x = layers.Conv2D(filters=conv_size, kernel_size=3, padding='same')(board3d)\n",
384 | " for _ in range(conv_depth):\n",
385 | " previous = x\n",
386 | " x = layers.Conv2D(filters=conv_size, kernel_size=3, padding='same')(x)\n",
387 | " x = layers.BatchNormalization()(x)\n",
388 | " x = layers.Activation('relu')(x)\n",
389 | " x = layers.Conv2D(filters=conv_size, kernel_size=3, padding='same')(x)\n",
390 | " x = layers.BatchNormalization()(x)\n",
391 | " x = layers.Add()([x, previous])\n",
392 | " x = layers.Activation('relu')(x)\n",
393 | " x = layers.Flatten()(x)\n",
394 | " x = layers.Dense(1, 'sigmoid')(x)\n",
395 | "\n",
396 | " return models.Model(inputs=board3d, outputs=x)"
397 | ]
398 | },
399 | {
400 | "cell_type": "code",
401 | "execution_count": 20,
402 | "metadata": {
403 | "id": "3IjDiS3Bmo5m"
404 | },
405 | "outputs": [],
406 | "source": [
407 | "model = build_model(32, 4)"
408 | ]
409 | },
410 | {
411 | "cell_type": "markdown",
412 | "metadata": {
413 | "id": "ck79-w2ZxwVB"
414 | },
415 | "source": [
416 | "# It's training time!"
417 | ]
418 | },
419 | {
420 | "cell_type": "code",
421 | "execution_count": null,
422 | "metadata": {
423 | "cellView": "both",
424 | "id": "CkOXxmoVyHdc"
425 | },
426 | "outputs": [],
427 | "source": [
428 | "import tensorflow.keras.callbacks as callbacks\n",
429 | "\n",
430 | "\n",
431 | "def get_dataset():\n",
432 | "\tcontainer = numpy.load('dataset.npz')\n",
433 | "\tb, v = container['b'], container['v']\n",
434 | "\tv = numpy.asarray(v / abs(v).max() / 2 + 0.5, dtype=numpy.float32) # normalization (0 - 1)\n",
435 | "\treturn b, v\n",
436 | "\n",
437 | "\n",
438 | "x_train, y_train = get_dataset()\n",
439 | "x_train.transpose()\n",
440 | "print(x_train.shape)\n",
441 | "print(y_train.shape)"
442 | ]
443 | },
444 | {
445 | "cell_type": "code",
446 | "execution_count": null,
447 | "metadata": {
448 | "id": "RyOYq9mv2ppC"
449 | },
450 | "outputs": [],
451 | "source": [
452 | "from tensorflow.keras.callbacks import ModelCheckpoint\n",
453 | "model.compile(optimizer=optimizers.Adam(5e-4), loss='mean_squared_error')\n",
454 | "model.summary()\n",
455 | "checkpoint_filepath = '/tmp/checkpoint/'\n",
456 | "model_checkpointing_callback = ModelCheckpoint(\n",
457 | " filepath = checkpoint_filepath,\n",
458 | " save_best_only= True,\n",
459 | ")\n",
460 | "model.fit(x_train, y_train,\n",
461 | " batch_size=2048,\n",
462 | " epochs=1000,\n",
463 | " verbose=1,\n",
464 | " validation_split=0.1,\n",
465 | " callbacks=[callbacks.ReduceLROnPlateau(monitor='loss', patience=10),\n",
466 | " callbacks.EarlyStopping(monitor='loss', patience=15, min_delta=1e-4),model_checkpointing_callback])\n",
467 | "\n",
468 | "model.save('model.h5')"
469 | ]
470 | },
471 | {
472 | "cell_type": "markdown",
473 | "metadata": {
474 | "id": "UndQQeUurAKp"
475 | },
476 | "source": [
477 | "# Playing with the AI"
478 | ]
479 | },
480 | {
481 | "cell_type": "code",
482 | "execution_count": 21,
483 | "metadata": {},
484 | "outputs": [],
485 | "source": [
486 | "from tensorflow.keras import models\n",
487 | "model = models.load_model('model.h5')"
488 | ]
489 | },
490 | {
491 | "cell_type": "code",
492 | "execution_count": 22,
493 | "metadata": {
494 | "id": "e4CfjcGorHzg"
495 | },
496 | "outputs": [],
497 | "source": [
498 | "# used for the minimax algorithm\n",
499 | "def minimax_eval(board):\n",
500 | " board3d = split_dims(board)\n",
501 | " board3d = numpy.expand_dims(board3d, 0)\n",
502 | " return model(board3d)[0][0]\n",
503 | "\n",
504 | "\n",
505 | "def minimax(board, depth, alpha, beta, maximizing_player):\n",
506 | " if depth == 0 or board.is_game_over():\n",
507 | " return minimax_eval(board)\n",
508 | " \n",
509 | " if maximizing_player:\n",
510 | " max_eval = -numpy.inf\n",
511 | " for move in board.legal_moves:\n",
512 | " board.push(move)\n",
513 | " eval = minimax(board, depth - 1, alpha, beta, False)\n",
514 | " board.pop()\n",
515 | " max_eval = max(max_eval, eval)\n",
516 | " alpha = max(alpha, eval)\n",
517 | " if beta <= alpha:\n",
518 | " break\n",
519 | " return max_eval\n",
520 | " else:\n",
521 | " min_eval = numpy.inf\n",
522 | " for move in board.legal_moves:\n",
523 | " board.push(move)\n",
524 | " eval = minimax(board, depth - 1, alpha, beta, True)\n",
525 | " board.pop()\n",
526 | " min_eval = min(min_eval, eval)\n",
527 | " beta = min(beta, eval)\n",
528 | " if beta <= alpha:\n",
529 | " break\n",
530 | " return min_eval\n",
531 | "\n",
532 | "\n",
533 | "# this is the actual function that gets the move from the neural network\n",
534 | "def get_ai_move(board, depth):\n",
535 | " max_move = None\n",
536 | " max_eval = -numpy.inf\n",
537 | "\n",
538 | " for move in board.legal_moves:\n",
539 | " board.push(move)\n",
540 | " eval = minimax(board, depth - 1, -numpy.inf, numpy.inf, False)\n",
541 | " board.pop()\n",
542 | " if eval > max_eval:\n",
543 | " max_eval = eval\n",
544 | " max_move = move\n",
545 | " \n",
546 | " return max_move"
547 | ]
548 | },
549 | {
550 | "cell_type": "code",
551 | "execution_count": 25,
552 | "metadata": {},
553 | "outputs": [
554 | {
555 | "name": "stdout",
556 | "output_type": "stream",
557 | "text": [
558 | "\n",
559 | "r . b . . . k .\n",
560 | "p p . . . . p p\n",
561 | ". . . K . . . .\n",
562 | ". . . . . r . .\n",
563 | ". . . . q . . .\n",
564 | ". . . . . . . .\n",
565 | ". P P . . . P P\n",
566 | ". . . . . . . .\n",
567 | "\n",
568 | "r . b . . . k .\n",
569 | "p p . . . . p p\n",
570 | ". . . K . . . .\n",
571 | ". . . . q r . .\n",
572 | ". . . . . . . .\n",
573 | ". . . . . . . .\n",
574 | ". P P . . . P P\n",
575 | ". . . . . . . .\n",
576 | "game_over\n"
577 | ]
578 | }
579 | ],
580 | "source": [
581 | "# Testing code AI(white) vs Stockfish(black)\n",
582 | "board = chess.Board()\n",
583 | "from IPython.display import clear_output\n",
584 | "\n",
585 | "with chess.engine.SimpleEngine.popen_uci('stockfish/7/bin/stockfish') as engine:\n",
586 | " while True:\n",
587 | " clear_output(wait=True)\n",
588 | " move = get_ai_move(board, 1)\n",
589 | " board.push(move)\n",
590 | " print(f'\\n{board}')\n",
591 | " if board.is_game_over():\n",
592 | " print('game_over')\n",
593 | " break\n",
594 | " move = engine.analyse(board, chess.engine.Limit(time=0.1), info=chess.engine.INFO_PV)['pv'][0]\n",
595 | " board.push(move)\n",
596 | " print(f'\\n{board}')\n",
597 | " if board.is_game_over():\n",
598 | " print('game_over')\n",
599 | " break"
600 | ]
601 | },
602 | {
603 | "cell_type": "code",
604 | "execution_count": null,
605 | "metadata": {
606 | "id": "C63ND0E_uffp"
607 | },
608 | "outputs": [],
609 | "source": [
610 | "# Move by move testing code AI(white) vs Stockfish(black)\n",
611 | "board = chess.Board()\n",
612 | "\n",
613 | "with chess.engine.SimpleEngine.popen_uci('stockfish/13/bin/stockfish') as engine:\n",
614 | " while True:\n",
615 | " move = get_ai_move(board, 1)\n",
616 | " board.push(move)\n",
617 | " print(f'\\n{board}')\n",
618 | " if board.is_game_over():\n",
619 | " print('game_over')\n",
620 | " break\n",
621 | " move = engine.analyse(board, chess.engine.Limit(time=1), info=chess.engine.INFO_PV)['pv'][0]\n",
622 | " board.push(move)\n",
623 | " print(f'\\n{board}')\n",
624 | " if board.is_game_over():\n",
625 | " print('game_over')\n",
626 | " break"
627 | ]
628 | },
629 | {
630 | "cell_type": "code",
631 | "execution_count": null,
632 | "metadata": {},
633 | "outputs": [],
634 | "source": [
635 | "# Move by move testing code AI(white) vs Stockfish(black)\n",
636 | "board = chess.Board()\n",
637 | "from IPython.display import clear_output\n",
638 | "\n",
639 | "with chess.engine.SimpleEngine.popen_uci('stockfish/13/bin/stockfish') as engine:\n",
640 | " while True:\n",
641 | " clear_output(wait=True)\n",
642 | " move = get_ai_move(board, 1)\n",
643 | " board.push(move)\n",
644 | " print(move)\n",
645 | " print(f'\\n{board}')\n",
646 | " if board.is_game_over():\n",
647 | " print('game_over')\n",
648 | " break\n",
649 | " input_var = input()\n",
650 | " move = chess.Move.from_uci(input_var)\n",
651 | " board.push(move)\n",
652 | " print(move)\n",
653 | " print(f'\\n{board}')\n",
654 | " if board.is_game_over():\n",
655 | " print('game_over')\n",
656 | " break"
657 | ]
658 | },
659 | {
660 | "cell_type": "code",
661 | "execution_count": null,
662 | "metadata": {},
663 | "outputs": [],
664 | "source": []
665 | }
666 | ],
667 | "metadata": {
668 | "accelerator": "GPU",
669 | "colab": {
670 | "collapsed_sections": [],
671 | "name": "Chess AI",
672 | "private_outputs": true,
673 | "provenance": []
674 | },
675 | "interpreter": {
676 | "hash": "aee8b7b246df8f9039afb4144a1f6fd8d2ca17a180786b69acc140d282b71a49"
677 | },
678 | "kernelspec": {
679 | "display_name": "Python 3 (ipykernel)",
680 | "language": "python",
681 | "name": "python3"
682 | },
683 | "language_info": {
684 | "codemirror_mode": {
685 | "name": "ipython",
686 | "version": 3
687 | },
688 | "file_extension": ".py",
689 | "mimetype": "text/x-python",
690 | "name": "python",
691 | "nbconvert_exporter": "python",
692 | "pygments_lexer": "ipython3",
693 | "version": "3.8.0"
694 | }
695 | },
696 | "nbformat": 4,
697 | "nbformat_minor": 1
698 | }
699 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Chess-AI-with-TensorFlow
--------------------------------------------------------------------------------
/model.h5:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/realnihal/Chess-AI-with-TensorFlow/2ecda18b164ec63fb38cf97b919845e595b83df0/model.h5
--------------------------------------------------------------------------------
/modelversion1.h5:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/realnihal/Chess-AI-with-TensorFlow/2ecda18b164ec63fb38cf97b919845e595b83df0/modelversion1.h5
--------------------------------------------------------------------------------
/modelversion2.h5:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/realnihal/Chess-AI-with-TensorFlow/2ecda18b164ec63fb38cf97b919845e595b83df0/modelversion2.h5
--------------------------------------------------------------------------------
/modelversion3.h5:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/realnihal/Chess-AI-with-TensorFlow/2ecda18b164ec63fb38cf97b919845e595b83df0/modelversion3.h5
--------------------------------------------------------------------------------
/stockfish/13/AUTHORS:
--------------------------------------------------------------------------------
1 | # List of authors for Stockfish, as of August 4, 2020
2 |
3 | # Founders of the Stockfish project and fishtest infrastructure
4 | Tord Romstad (romstad)
5 | Marco Costalba (mcostalba)
6 | Joona Kiiski (zamar)
7 | Gary Linscott (glinscott)
8 |
9 | # Authors and inventors of NNUE, training, NNUE port
10 | Yu Nasu (ynasu87)
11 | Motohiro Isozaki (yaneurao)
12 | Hisayori Noda (nodchip)
13 |
14 | # all other authors of the code in alphabetical order
15 | Aditya (absimaldata)
16 | Adrian Petrescu (apetresc)
17 | Ajith Chandy Jose (ajithcj)
18 | Alain Savard (Rocky640)
19 | Alayan Feh (Alayan-stk-2)
20 | Alexander Kure
21 | Alexander Pagel (Lolligerhans)
22 | Alfredo Menezes (lonfom169)
23 | Ali AlZhrani (Cooffe)
24 | Andrew Grant (AndyGrant)
25 | Andrey Neporada (nepal)
26 | Andy Duplain
27 | Aram Tumanian (atumanian)
28 | Arjun Temurnikar
29 | Auguste Pop
30 | Balint Pfliegel
31 | Ben Koshy (BKSpurgeon)
32 | Bill Henry (VoyagerOne)
33 | Bojun Guo (noobpwnftw, Nooby)
34 | braich
35 | Brian Sheppard (SapphireBrand, briansheppard-toast)
36 | Bruno de Melo Costa (BM123499)
37 | Bryan Cross (crossbr)
38 | candirufish
39 | Chess13234
40 | Chris Cain (ceebo)
41 | Dale Weiler (graphitemaster)
42 | Dan Schmidt (dfannius)
43 | Daniel Axtens (daxtens)
44 | Daniel Dugovic (ddugovic)
45 | Dariusz Orzechowski (dorzechowski)
46 | David Zar
47 | Daylen Yang (daylen)
48 | Deshawn Mohan-Smith (GoldenRare)
49 | Dieter Dobbelaere (ddobbelaere)
50 | DiscanX
51 | Dominik Schlösser (domschl)
52 | double-beep
53 | Eduardo Cáceres (eduherminio)
54 | Eelco de Groot (KingDefender)
55 | Elvin Liu (solarlight2)
56 | erbsenzaehler
57 | Ernesto Gatti
58 | Linmiao Xu (linrock)
59 | Fabian Beuke (madnight)
60 | Fabian Fichter (ianfab)
61 | Fanael Linithien (Fanael)
62 | fanon
63 | Fauzi Akram Dabat (FauziAkram)
64 | Felix Wittmann
65 | gamander
66 | Gary Heckman (gheckman)
67 | George Sobala (gsobala)
68 | gguliash
69 | Gian-Carlo Pascutto (gcp)
70 | Gontran Lemaire (gonlem)
71 | Goodkov Vasiliy Aleksandrovich (goodkov)
72 | Gregor Cramer
73 | GuardianRM
74 | Günther Demetz (pb00067, pb00068)
75 | Guy Vreuls (gvreuls)
76 | Henri Wiechers
77 | Hiraoka Takuya (HiraokaTakuya)
78 | homoSapiensSapiens
79 | Hongzhi Cheng
80 | Ivan Ivec (IIvec)
81 | Jacques B. (Timshel)
82 | Jan Ondruš (hxim)
83 | Jared Kish (Kurtbusch)
84 | Jarrod Torriero (DU-jdto)
85 | Jean Gauthier (OuaisBla)
86 | Jean-Francois Romang (jromang)
87 | Jekaa
88 | Jerry Donald Watson (jerrydonaldwatson)
89 | jjoshua2
90 | Jonathan Calovski (Mysseno)
91 | Jonathan Buladas Dumale (SFisGOD)
92 | Joost VandeVondele (vondele)
93 | Jörg Oster (joergoster)
94 | Joseph Ellis (jhellis3)
95 | Joseph R. Prostko
96 | jundery
97 | Justin Blanchard (UncombedCoconut)
98 | Kelly Wilson
99 | Ken Takusagawa
100 | kinderchocolate
101 | Kiran Panditrao (Krgp)
102 | Kojirion
103 | Krystian Kuzniarek (kuzkry)
104 | Leonardo Ljubičić (ICCF World Champion)
105 | Leonid Pechenik (lp--)
106 | Linus Arver (listx)
107 | loco-loco
108 | Lub van den Berg (ElbertoOne)
109 | Luca Brivio (lucabrivio)
110 | Lucas Braesch (lucasart)
111 | Lyudmil Antonov (lantonov)
112 | Maciej Żenczykowski (zenczykowski)
113 | Malcolm Campbell (xoto10)
114 | Mark Tenzer (31m059)
115 | marotear
116 | Matt Ginsberg (mattginsberg)
117 | Matthew Lai (matthewlai)
118 | Matthew Sullivan (Matt14916)
119 | Maxim Molchanov (Maxim)
120 | Michael An (man)
121 | Michael Byrne (MichaelB7)
122 | Michael Chaly (Vizvezdenec)
123 | Michael Stembera (mstembera)
124 | Michael Whiteley (protonspring)
125 | Michel Van den Bergh (vdbergh)
126 | Miguel Lahoz (miguel-l)
127 | Mikael Bäckman (mbootsector)
128 | Mira
129 | Miroslav Fontán (Hexik)
130 | Moez Jellouli (MJZ1977)
131 | Mohammed Li (tthsqe12)
132 | Nathan Rugg (nmrugg)
133 | Nick Pelling (nickpelling)
134 | Nicklas Persson (NicklasPersson)
135 | Niklas Fiekas (niklasf)
136 | Nikolay Kostov (NikolayIT)
137 | Nguyen Pham (nguyenpham)
138 | Norman Schmidt (FireFather)
139 | notruck
140 | Ondrej Mosnáček (WOnder93)
141 | Oskar Werkelin Ahlin
142 | Pablo Vazquez
143 | Panthee
144 | Pascal Romaret
145 | Pasquale Pigazzini (ppigazzini)
146 | Patrick Jansen (mibere)
147 | pellanda
148 | Peter Zsifkovits (CoffeeOne)
149 | Praveen Kumar Tummala (praveentml)
150 | Rahul Dsilva (silversolver1)
151 | Ralph Stößer (Ralph Stoesser)
152 | Raminder Singh
153 | renouve
154 | Reuven Peleg
155 | Richard Lloyd
156 | Rodrigo Exterckötter Tjäder
157 | Ron Britvich (Britvich)
158 | Ronald de Man (syzygy1, syzygy)
159 | rqs
160 | Ryan Schmitt
161 | Ryan Takker
162 | Sami Kiminki (skiminki)
163 | Sebastian Buchwald (UniQP)
164 | Sergei Antonov (saproj)
165 | Sergei Ivanov (svivanov72)
166 | Sergio Vieri (sergiovieri)
167 | sf-x
168 | Shane Booth (shane31)
169 | Shawn Varghese (xXH4CKST3RXx)
170 | Stefan Geschwentner (locutus2)
171 | Stefano Cardanobile (Stefano80)
172 | Steinar Gunderson (sesse)
173 | Stéphane Nicolet (snicolet)
174 | Thanar2
175 | thaspel
176 | theo77186
177 | Tom Truscott
178 | Tom Vijlbrief (tomtor)
179 | Tomasz Sobczyk (Sopel97)
180 | Torsten Franz (torfranz, tfranzer)
181 | Tracey Emery (basepr1me)
182 | tttak
183 | Unai Corzo (unaiic)
184 | Uri Blass (uriblass)
185 | Vince Negri (cuddlestmonkey)
186 | zz4032
187 |
188 |
189 | # Additionally, we acknowledge the authors and maintainers of fishtest,
190 | # an amazing and essential framework for the development of Stockfish!
191 | #
192 | # https://github.com/glinscott/fishtest/blob/master/AUTHORS
193 |
--------------------------------------------------------------------------------
/stockfish/13/Copying.txt:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/stockfish/13/INSTALL_RECEIPT.json:
--------------------------------------------------------------------------------
1 | {"homebrew_version":"3.0.2-23-g9b94234","used_options":[],"unused_options":[],"built_as_bottle":true,"poured_from_bottle":true,"installed_as_dependency":false,"installed_on_request":true,"changed_files":["INSTALL_RECEIPT.json"],"time":1615694529,"source_modified_time":1613682895,"HEAD":null,"stdlib":null,"compiler":"clang","aliases":[],"runtime_dependencies":[],"source":{"path":"/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/stockfish.rb","tap":"homebrew/core","spec":"stable","versions":{"stable":"13","head":"HEAD","version_scheme":0}},"arch":"x86_64","built_on":{"os":"Macintosh","os_version":"macOS 10.15.7","cpu_family":"penryn","xcode":"12.4","clt":"12.4.0.0.1.1610135815"}}
--------------------------------------------------------------------------------
/stockfish/13/README.md:
--------------------------------------------------------------------------------
1 | ## Overview
2 |
3 | [](https://travis-ci.org/official-stockfish/Stockfish)
4 | [](https://ci.appveyor.com/project/mcostalba/stockfish/branch/master)
5 |
6 | [Stockfish](https://stockfishchess.org) is a free, powerful UCI chess engine
7 | derived from Glaurung 2.1. Stockfish is not a complete chess program and requires a
8 | UCI-compatible graphical user interface (GUI) (e.g. XBoard with PolyGlot, Scid,
9 | Cute Chess, eboard, Arena, Sigma Chess, Shredder, Chess Partner or Fritz) in order
10 | to be used comfortably. Read the documentation for your GUI of choice for information
11 | about how to use Stockfish with it.
12 |
13 | The Stockfish engine features two evaluation functions for chess, the classical
14 | evaluation based on handcrafted terms, and the NNUE evaluation based on efficiently
15 | updatable neural networks. The classical evaluation runs efficiently on almost all
16 | CPU architectures, while the NNUE evaluation benefits from the vector
17 | intrinsics available on most CPUs (sse2, avx2, neon, or similar).
18 |
19 |
20 | ## Files
21 |
22 | This distribution of Stockfish consists of the following files:
23 |
24 | * Readme.md, the file you are currently reading.
25 |
26 | * Copying.txt, a text file containing the GNU General Public License version 3.
27 |
28 | * AUTHORS, a text file with the list of authors for the project
29 |
30 | * src, a subdirectory containing the full source code, including a Makefile
31 | that can be used to compile Stockfish on Unix-like systems.
32 |
33 | * a file with the .nnue extension, storing the neural network for the NNUE
34 | evaluation. Binary distributions will have this file embedded.
35 |
36 | ## UCI options
37 |
38 | Currently, Stockfish has the following UCI options:
39 |
40 | * #### Threads
41 | The number of CPU threads used for searching a position. For best performance, set
42 | this equal to the number of CPU cores available.
43 |
44 | * #### Hash
45 | The size of the hash table in MB. It is recommended to set Hash after setting Threads.
46 |
47 | * #### Clear Hash
48 | Clear the hash table.
49 |
50 | * #### Ponder
51 | Let Stockfish ponder its next move while the opponent is thinking.
52 |
53 | * #### MultiPV
54 | Output the N best lines (principal variations, PVs) when searching.
55 | Leave at 1 for best performance.
56 |
57 | * #### Use NNUE
58 | Toggle between the NNUE and classical evaluation functions. If set to "true",
59 | the network parameters must be available to load from file (see also EvalFile),
60 | if they are not embedded in the binary.
61 |
62 | * #### EvalFile
63 | The name of the file of the NNUE evaluation parameters. Depending on the GUI the
64 | filename might have to include the full path to the folder/directory that contains the file.
65 | Other locations, such as the directory that contains the binary and the working directory,
66 | are also searched.
67 |
68 | * #### UCI_AnalyseMode
69 | An option handled by your GUI.
70 |
71 | * #### UCI_Chess960
72 | An option handled by your GUI. If true, Stockfish will play Chess960.
73 |
74 | * #### UCI_ShowWDL
75 | If enabled, show approximate WDL statistics as part of the engine output.
76 | These WDL numbers model expected game outcomes for a given evaluation and
77 | game ply for engine self-play at fishtest LTC conditions (60+0.6s per game).
78 |
79 | * #### UCI_LimitStrength
80 | Enable weaker play aiming for an Elo rating as set by UCI_Elo. This option overrides Skill Level.
81 |
82 | * #### UCI_Elo
83 | If enabled by UCI_LimitStrength, aim for an engine strength of the given Elo.
84 | This Elo rating has been calibrated at a time control of 60s+0.6s and anchored to CCRL 40/4.
85 |
86 | * #### Skill Level
87 | Lower the Skill Level in order to make Stockfish play weaker (see also UCI_LimitStrength).
88 | Internally, MultiPV is enabled, and with a certain probability depending on the Skill Level a
89 | weaker move will be played.
90 |
91 | * #### SyzygyPath
92 | Path to the folders/directories storing the Syzygy tablebase files. Multiple
93 | directories are to be separated by ";" on Windows and by ":" on Unix-based
94 | operating systems. Do not use spaces around the ";" or ":".
95 |
96 | Example: `C:\tablebases\wdl345;C:\tablebases\wdl6;D:\tablebases\dtz345;D:\tablebases\dtz6`
97 |
98 | It is recommended to store .rtbw files on an SSD. There is no loss in storing
99 | the .rtbz files on a regular HD. It is recommended to verify all md5 checksums
100 | of the downloaded tablebase files (`md5sum -c checksum.md5`) as corruption will
101 | lead to engine crashes.
102 |
103 | * #### SyzygyProbeDepth
104 | Minimum remaining search depth for which a position is probed. Set this option
105 | to a higher value to probe less aggressively if you experience too much slowdown
106 | (in terms of nps) due to tablebase probing.
107 |
108 | * #### Syzygy50MoveRule
109 | Disable to let fifty-move rule draws detected by Syzygy tablebase probes count
110 | as wins or losses. This is useful for ICCF correspondence games.
111 |
112 | * #### SyzygyProbeLimit
113 | Limit Syzygy tablebase probing to positions with at most this many pieces left
114 | (including kings and pawns).
115 |
116 | * #### Contempt
117 | A positive value for contempt favors middle game positions and avoids draws,
118 | effective for the classical evaluation only.
119 |
120 | * #### Analysis Contempt
121 | By default, contempt is set to prefer the side to move. Set this option to "White"
122 | or "Black" to analyse with contempt for that side, or "Off" to disable contempt.
123 |
124 | * #### Move Overhead
125 | Assume a time delay of x ms due to network and GUI overheads. This is useful to
126 | avoid losses on time in those cases.
127 |
128 | * #### Slow Mover
129 | Lower values will make Stockfish take less time in games, higher values will
130 | make it think longer.
131 |
132 | * #### nodestime
133 | Tells the engine to use nodes searched instead of wall time to account for
134 | elapsed time. Useful for engine testing.
135 |
136 | * #### Debug Log File
137 | Write all communication to and from the engine into a text file.
138 |
139 | ## A note on classical evaluation versus NNUE evaluation
140 |
141 | Both approaches assign a value to a position that is used in alpha-beta (PVS) search
142 | to find the best move. The classical evaluation computes this value as a function
143 | of various chess concepts, handcrafted by experts, tested and tuned using fishtest.
144 | The NNUE evaluation computes this value with a neural network based on basic
145 | inputs (e.g. piece positions only). The network is optimized and trained
146 | on the evaluations of millions of positions at moderate search depth.
147 |
148 | The NNUE evaluation was first introduced in shogi, and ported to Stockfish afterward.
149 | It can be evaluated efficiently on CPUs, and exploits the fact that only parts
150 | of the neural network need to be updated after a typical chess move.
151 | [The nodchip repository](https://github.com/nodchip/Stockfish) provides additional
152 | tools to train and develop the NNUE networks. On CPUs supporting modern vector instructions
153 | (avx2 and similar), the NNUE evaluation results in much stronger playing strength, even
154 | if the nodes per second computed by the engine is somewhat lower (roughly 80% of nps
155 | is typical).
156 |
157 | Notes:
158 |
159 | 1) the NNUE evaluation depends on the Stockfish binary and the network parameter
160 | file (see the EvalFile UCI option). Not every parameter file is compatible with a given
161 | Stockfish binary, but the default value of the EvalFile UCI option is the name of a network
162 | that is guaranteed to be compatible with that binary.
163 |
164 | 2) to use the NNUE evaluation, the additional data file with neural network parameters
165 | needs to be available. Normally, this file is already embedded in the binary or it
166 | can be downloaded. The filename for the default (recommended) net can be found as the default
167 | value of the `EvalFile` UCI option, with the format `nn-[SHA256 first 12 digits].nnue`
168 | (for instance, `nn-c157e0a5755b.nnue`). This file can be downloaded from
169 | ```
170 | https://tests.stockfishchess.org/api/nn/[filename]
171 | ```
172 | replacing `[filename]` as needed.
173 |
174 | ## What to expect from the Syzygy tablebases?
175 |
176 | If the engine is searching a position that is not in the tablebases (e.g.
177 | a position with 8 pieces), it will access the tablebases during the search.
178 | If the engine reports a very large score (typically 153.xx), this means
179 | it has found a winning line into a tablebase position.
180 |
181 | If the engine is given a position to search that is in the tablebases, it
182 | will use the tablebases at the beginning of the search to preselect all
183 | good moves, i.e. all moves that preserve the win or preserve the draw while
184 | taking into account the 50-move rule.
185 | It will then perform a search only on those moves. **The engine will not move
186 | immediately**, unless there is only a single good move. **The engine likely
187 | will not report a mate score, even if the position is known to be won.**
188 |
189 | It is therefore clear that this behaviour is not identical to what one might
190 | be used to with Nalimov tablebases. There are technical reasons for this
191 | difference, the main technical reason being that Nalimov tablebases use the
192 | DTM metric (distance-to-mate), while the Syzygy tablebases use a variation of the
193 | DTZ metric (distance-to-zero, zero meaning any move that resets the 50-move
194 | counter). This special metric is one of the reasons that the Syzygy tablebases are
195 | more compact than Nalimov tablebases, while still storing all information
196 | needed for optimal play and in addition being able to take into account
197 | the 50-move rule.
198 |
199 | ## Large Pages
200 |
201 | Stockfish supports large pages on Linux and Windows. Large pages make
202 | the hash access more efficient, improving the engine speed, especially
203 | on large hash sizes. Typical increases are 5..10% in terms of nodes per
204 | second, but speed increases up to 30% have been measured. The support is
205 | automatic. Stockfish attempts to use large pages when available and
206 | will fall back to regular memory allocation when this is not the case.
207 |
208 | ### Support on Linux
209 |
210 | Large page support on Linux is obtained by the Linux kernel
211 | transparent huge pages functionality. Typically, transparent huge pages
212 | are already enabled, and no configuration is needed.
213 |
214 | ### Support on Windows
215 |
216 | The use of large pages requires "Lock Pages in Memory" privilege. See
217 | [Enable the Lock Pages in Memory Option (Windows)](https://docs.microsoft.com/en-us/sql/database-engine/configure-windows/enable-the-lock-pages-in-memory-option-windows)
218 | on how to enable this privilege, then run [RAMMap](https://docs.microsoft.com/en-us/sysinternals/downloads/rammap)
219 | to double-check that large pages are used. We suggest that you reboot
220 | your computer after you have enabled large pages, because long Windows
221 | sessions suffer from memory fragmentation, which may prevent Stockfish
222 | from getting large pages: a fresh session is better in this regard.
223 |
224 | ## Compiling Stockfish yourself from the sources
225 |
226 | Stockfish has support for 32 or 64-bit CPUs, certain hardware
227 | instructions, big-endian machines such as Power PC, and other platforms.
228 |
229 | On Unix-like systems, it should be easy to compile Stockfish
230 | directly from the source code with the included Makefile in the folder
231 | `src`. In general it is recommended to run `make help` to see a list of make
232 | targets with corresponding descriptions.
233 |
234 | ```
235 | cd src
236 | make help
237 | make net
238 | make build ARCH=x86-64-modern
239 | ```
240 |
241 | When not using the Makefile to compile (for instance, with Microsoft MSVC) you
242 | need to manually set/unset some switches in the compiler command line; see
243 | file *types.h* for a quick reference.
244 |
245 | When reporting an issue or a bug, please tell us which version and
246 | compiler you used to create your executable. These informations can
247 | be found by typing the following commands in a console:
248 |
249 | ```
250 | ./stockfish compiler
251 | ```
252 |
253 | ## Understanding the code base and participating in the project
254 |
255 | Stockfish's improvement over the last couple of years has been a great
256 | community effort. There are a few ways to help contribute to its growth.
257 |
258 | ### Donating hardware
259 |
260 | Improving Stockfish requires a massive amount of testing. You can donate
261 | your hardware resources by installing the [Fishtest Worker](https://github.com/glinscott/fishtest/wiki/Running-the-worker:-overview)
262 | and view the current tests on [Fishtest](https://tests.stockfishchess.org/tests).
263 |
264 | ### Improving the code
265 |
266 | If you want to help improve the code, there are several valuable resources:
267 |
268 | * [In this wiki,](https://www.chessprogramming.org) many techniques used in
269 | Stockfish are explained with a lot of background information.
270 |
271 | * [The section on Stockfish](https://www.chessprogramming.org/Stockfish)
272 | describes many features and techniques used by Stockfish. However, it is
273 | generic rather than being focused on Stockfish's precise implementation.
274 | Nevertheless, a helpful resource.
275 |
276 | * The latest source can always be found on [GitHub](https://github.com/official-stockfish/Stockfish).
277 | Discussions about Stockfish take place these days mainly in the [FishCooking](https://groups.google.com/forum/#!forum/fishcooking)
278 | group and on the [Stockfish Discord channel](https://discord.gg/nv8gDtt).
279 | The engine testing is done on [Fishtest](https://tests.stockfishchess.org/tests).
280 | If you want to help improve Stockfish, please read this [guideline](https://github.com/glinscott/fishtest/wiki/Creating-my-first-test)
281 | first, where the basics of Stockfish development are explained.
282 |
283 |
284 | ## Terms of use
285 |
286 | Stockfish is free, and distributed under the **GNU General Public License version 3**
287 | (GPL v3). Essentially, this means you are free to do almost exactly
288 | what you want with the program, including distributing it among your
289 | friends, making it available for download from your website, selling
290 | it (either by itself or as part of some bigger software package), or
291 | using it as the starting point for a software project of your own.
292 |
293 | The only real limitation is that whenever you distribute Stockfish in
294 | some way, you MUST always include the full source code, or a pointer
295 | to where the source code can be found, to generate the exact binary
296 | you are distributing. If you make any changes to the source code,
297 | these changes must also be made available under the GPL.
298 |
299 | For full details, read the copy of the GPL v3 found in the file named
300 | *Copying.txt*.
301 |
--------------------------------------------------------------------------------
/stockfish/13/bin/stockfish:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/realnihal/Chess-AI-with-TensorFlow/2ecda18b164ec63fb38cf97b919845e595b83df0/stockfish/13/bin/stockfish
--------------------------------------------------------------------------------