chess 0.3.6 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +7 -12
- data/Gemfile.lock +1 -1
- data/README.md +2 -2
- data/docs/Chess/BadNotationError.html +3 -3
- data/docs/Chess/Board.html +180 -43
- data/docs/Chess/CGame.html +33 -33
- data/docs/Chess/Game.html +44 -44
- data/docs/Chess/Gnuchess.html +3 -3
- data/docs/Chess/IllegalMoveError.html +5 -5
- data/docs/Chess/InvalidFenFormatError.html +3 -3
- data/docs/Chess/InvalidPgnFormatError.html +3 -3
- data/docs/Chess/Pgn.html +8 -8
- data/docs/Chess/UTF8Notation.html +7 -7
- data/docs/Chess.html +5 -5
- data/docs/_index.html +3 -3
- data/docs/file.README.html +5 -5
- data/docs/frames.html +9 -4
- data/docs/index.html +5 -5
- data/docs/method_list.html +61 -53
- data/docs/top-level-namespace.html +3 -3
- data/ext/chess/chess.c +33 -0
- data/ext/chess/chess.h +1 -0
- data/ext/chess/extconf.rb +1 -26
- data/lib/chess/version.rb +1 -1
- data/test/test_move_generator.rb +7 -0
- metadata +2 -2
data/docs/method_list.html
CHANGED
@@ -46,16 +46,16 @@
|
|
46
46
|
|
47
47
|
<li class="odd ">
|
48
48
|
<div class="item">
|
49
|
-
<span class='object_link'><a href="Chess/
|
50
|
-
<small>Chess::
|
49
|
+
<span class='object_link'><a href="Chess/CGame.html#[]-instance_method" title="Chess::CGame#[] (method)">#[]</a></span>
|
50
|
+
<small>Chess::CGame</small>
|
51
51
|
</div>
|
52
52
|
</li>
|
53
53
|
|
54
54
|
|
55
55
|
<li class="even ">
|
56
56
|
<div class="item">
|
57
|
-
<span class='object_link'><a href="Chess/
|
58
|
-
<small>Chess::
|
57
|
+
<span class='object_link'><a href="Chess/Board.html#[]-instance_method" title="Chess::Board#[] (method)">#[]</a></span>
|
58
|
+
<small>Chess::Board</small>
|
59
59
|
</div>
|
60
60
|
</li>
|
61
61
|
|
@@ -174,13 +174,21 @@
|
|
174
174
|
|
175
175
|
<li class="odd ">
|
176
176
|
<div class="item">
|
177
|
-
<span class='object_link'><a href="Chess/Board.html#
|
177
|
+
<span class='object_link'><a href="Chess/Board.html#generate_all_moves-instance_method" title="Chess::Board#generate_all_moves (method)">#generate_all_moves</a></span>
|
178
178
|
<small>Chess::Board</small>
|
179
179
|
</div>
|
180
180
|
</li>
|
181
181
|
|
182
182
|
|
183
183
|
<li class="even ">
|
184
|
+
<div class="item">
|
185
|
+
<span class='object_link'><a href="Chess/Board.html#generate_moves-instance_method" title="Chess::Board#generate_moves (method)">#generate_moves</a></span>
|
186
|
+
<small>Chess::Board</small>
|
187
|
+
</div>
|
188
|
+
</li>
|
189
|
+
|
190
|
+
|
191
|
+
<li class="odd ">
|
184
192
|
<div class="item">
|
185
193
|
<span class='object_link'><a href="Chess/Gnuchess.html#gnuchess_move-instance_method" title="Chess::Gnuchess#gnuchess_move (method)">#gnuchess_move</a></span>
|
186
194
|
<small>Chess::Gnuchess</small>
|
@@ -188,7 +196,7 @@
|
|
188
196
|
</li>
|
189
197
|
|
190
198
|
|
191
|
-
<li class="
|
199
|
+
<li class="even ">
|
192
200
|
<div class="item">
|
193
201
|
<span class='object_link'><a href="Chess/Gnuchess.html#gnuchess_move!-instance_method" title="Chess::Gnuchess#gnuchess_move! (method)">#gnuchess_move!</a></span>
|
194
202
|
<small>Chess::Gnuchess</small>
|
@@ -196,7 +204,7 @@
|
|
196
204
|
</li>
|
197
205
|
|
198
206
|
|
199
|
-
<li class="
|
207
|
+
<li class="odd ">
|
200
208
|
<div class="item">
|
201
209
|
<span class='object_link'><a href="Chess/Board.html#halfmove_clock-instance_method" title="Chess::Board#halfmove_clock (method)">#halfmove_clock</a></span>
|
202
210
|
<small>Chess::Board</small>
|
@@ -204,7 +212,7 @@
|
|
204
212
|
</li>
|
205
213
|
|
206
214
|
|
207
|
-
<li class="
|
215
|
+
<li class="even ">
|
208
216
|
<div class="item">
|
209
217
|
<span class='object_link'><a href="Chess/Game.html#inactive_player-instance_method" title="Chess::Game#inactive_player (method)">#inactive_player</a></span>
|
210
218
|
<small>Chess::Game</small>
|
@@ -212,6 +220,14 @@
|
|
212
220
|
</li>
|
213
221
|
|
214
222
|
|
223
|
+
<li class="odd ">
|
224
|
+
<div class="item">
|
225
|
+
<span class='object_link'><a href="Chess/InvalidFenFormatError.html#initialize-instance_method" title="Chess::InvalidFenFormatError#initialize (method)">#initialize</a></span>
|
226
|
+
<small>Chess::InvalidFenFormatError</small>
|
227
|
+
</div>
|
228
|
+
</li>
|
229
|
+
|
230
|
+
|
215
231
|
<li class="even ">
|
216
232
|
<div class="item">
|
217
233
|
<span class='object_link'><a href="Chess/Game.html#initialize-instance_method" title="Chess::Game#initialize (method)">#initialize</a></span>
|
@@ -245,14 +261,6 @@
|
|
245
261
|
|
246
262
|
|
247
263
|
<li class="even ">
|
248
|
-
<div class="item">
|
249
|
-
<span class='object_link'><a href="Chess/InvalidFenFormatError.html#initialize-instance_method" title="Chess::InvalidFenFormatError#initialize (method)">#initialize</a></span>
|
250
|
-
<small>Chess::InvalidFenFormatError</small>
|
251
|
-
</div>
|
252
|
-
</li>
|
253
|
-
|
254
|
-
|
255
|
-
<li class="odd ">
|
256
264
|
<div class="item">
|
257
265
|
<span class='object_link'><a href="Chess/Board.html#insufficient_material%3F-instance_method" title="Chess::Board#insufficient_material? (method)">#insufficient_material?</a></span>
|
258
266
|
<small>Chess::Board</small>
|
@@ -260,7 +268,7 @@
|
|
260
268
|
</li>
|
261
269
|
|
262
270
|
|
263
|
-
<li class="
|
271
|
+
<li class="odd ">
|
264
272
|
<div class="item">
|
265
273
|
<span class='object_link'><a href="Chess/Pgn.html#load-instance_method" title="Chess::Pgn#load (method)">#load</a></span>
|
266
274
|
<small>Chess::Pgn</small>
|
@@ -268,7 +276,7 @@
|
|
268
276
|
</li>
|
269
277
|
|
270
278
|
|
271
|
-
<li class="
|
279
|
+
<li class="even ">
|
272
280
|
<div class="item">
|
273
281
|
<span class='object_link'><a href="Chess/Game.html#load_fen-class_method" title="Chess::Game.load_fen (method)">load_fen</a></span>
|
274
282
|
<small>Chess::Game</small>
|
@@ -276,7 +284,7 @@
|
|
276
284
|
</li>
|
277
285
|
|
278
286
|
|
279
|
-
<li class="
|
287
|
+
<li class="odd ">
|
280
288
|
<div class="item">
|
281
289
|
<span class='object_link'><a href="Chess/Pgn.html#load_from_string-instance_method" title="Chess::Pgn#load_from_string (method)">#load_from_string</a></span>
|
282
290
|
<small>Chess::Pgn</small>
|
@@ -284,7 +292,7 @@
|
|
284
292
|
</li>
|
285
293
|
|
286
294
|
|
287
|
-
<li class="
|
295
|
+
<li class="even ">
|
288
296
|
<div class="item">
|
289
297
|
<span class='object_link'><a href="Chess/Game.html#load_pgn-class_method" title="Chess::Game.load_pgn (method)">load_pgn</a></span>
|
290
298
|
<small>Chess::Game</small>
|
@@ -292,7 +300,7 @@
|
|
292
300
|
</li>
|
293
301
|
|
294
302
|
|
295
|
-
<li class="
|
303
|
+
<li class="odd ">
|
296
304
|
<div class="item">
|
297
305
|
<span class='object_link'><a href="Chess/CGame.html#move-instance_method" title="Chess::CGame#move (method)">#move</a></span>
|
298
306
|
<small>Chess::CGame</small>
|
@@ -300,7 +308,7 @@
|
|
300
308
|
</li>
|
301
309
|
|
302
310
|
|
303
|
-
<li class="
|
311
|
+
<li class="even ">
|
304
312
|
<div class="item">
|
305
313
|
<span class='object_link'><a href="Chess/Game.html#move-instance_method" title="Chess::Game#move (method)">#move</a></span>
|
306
314
|
<small>Chess::Game</small>
|
@@ -308,7 +316,7 @@
|
|
308
316
|
</li>
|
309
317
|
|
310
318
|
|
311
|
-
<li class="
|
319
|
+
<li class="odd ">
|
312
320
|
<div class="item">
|
313
321
|
<span class='object_link'><a href="Chess/CGame.html#move2-instance_method" title="Chess::CGame#move2 (method)">#move2</a></span>
|
314
322
|
<small>Chess::CGame</small>
|
@@ -316,7 +324,7 @@
|
|
316
324
|
</li>
|
317
325
|
|
318
326
|
|
319
|
-
<li class="
|
327
|
+
<li class="even ">
|
320
328
|
<div class="item">
|
321
329
|
<span class='object_link'><a href="Chess/CGame.html#move3-instance_method" title="Chess::CGame#move3 (method)">#move3</a></span>
|
322
330
|
<small>Chess::CGame</small>
|
@@ -324,23 +332,23 @@
|
|
324
332
|
</li>
|
325
333
|
|
326
334
|
|
327
|
-
<li class="
|
335
|
+
<li class="odd ">
|
328
336
|
<div class="item">
|
329
|
-
<span class='object_link'><a href="Chess/
|
330
|
-
<small>Chess::
|
337
|
+
<span class='object_link'><a href="Chess/CGame.html#moves-instance_method" title="Chess::CGame#moves (method)">#moves</a></span>
|
338
|
+
<small>Chess::CGame</small>
|
331
339
|
</div>
|
332
340
|
</li>
|
333
341
|
|
334
342
|
|
335
|
-
<li class="
|
343
|
+
<li class="even ">
|
336
344
|
<div class="item">
|
337
|
-
<span class='object_link'><a href="Chess/
|
338
|
-
<small>Chess::
|
345
|
+
<span class='object_link'><a href="Chess/Pgn.html#moves-instance_method" title="Chess::Pgn#moves (method)">#moves</a></span>
|
346
|
+
<small>Chess::Pgn</small>
|
339
347
|
</div>
|
340
348
|
</li>
|
341
349
|
|
342
350
|
|
343
|
-
<li class="
|
351
|
+
<li class="odd ">
|
344
352
|
<div class="item">
|
345
353
|
<span class='object_link'><a href="Chess/Game.html#moves=-instance_method" title="Chess::Game#moves= (method)">#moves=</a></span>
|
346
354
|
<small>Chess::Game</small>
|
@@ -348,7 +356,7 @@
|
|
348
356
|
</li>
|
349
357
|
|
350
358
|
|
351
|
-
<li class="
|
359
|
+
<li class="even ">
|
352
360
|
<div class="item">
|
353
361
|
<span class='object_link'><a href="Chess/Board.html#only_kings%3F-instance_method" title="Chess::Board#only_kings? (method)">#only_kings?</a></span>
|
354
362
|
<small>Chess::Board</small>
|
@@ -356,7 +364,7 @@
|
|
356
364
|
</li>
|
357
365
|
|
358
366
|
|
359
|
-
<li class="
|
367
|
+
<li class="odd ">
|
360
368
|
<div class="item">
|
361
369
|
<span class='object_link'><a href="Chess/Game.html#over%3F-instance_method" title="Chess::Game#over? (method)">#over?</a></span>
|
362
370
|
<small>Chess::Game</small>
|
@@ -364,7 +372,7 @@
|
|
364
372
|
</li>
|
365
373
|
|
366
374
|
|
367
|
-
<li class="
|
375
|
+
<li class="even ">
|
368
376
|
<div class="item">
|
369
377
|
<span class='object_link'><a href="Chess/Game.html#pgn-instance_method" title="Chess::Game#pgn (method)">#pgn</a></span>
|
370
378
|
<small>Chess::Game</small>
|
@@ -372,7 +380,7 @@
|
|
372
380
|
</li>
|
373
381
|
|
374
382
|
|
375
|
-
<li class="
|
383
|
+
<li class="odd ">
|
376
384
|
<div class="item">
|
377
385
|
<span class='object_link'><a href="Chess/Board.html#placement-instance_method" title="Chess::Board#placement (method)">#placement</a></span>
|
378
386
|
<small>Chess::Board</small>
|
@@ -380,7 +388,7 @@
|
|
380
388
|
</li>
|
381
389
|
|
382
390
|
|
383
|
-
<li class="
|
391
|
+
<li class="even ">
|
384
392
|
<div class="item">
|
385
393
|
<span class='object_link'><a href="Chess/CGame.html#resign-instance_method" title="Chess::CGame#resign (method)">#resign</a></span>
|
386
394
|
<small>Chess::CGame</small>
|
@@ -388,7 +396,7 @@
|
|
388
396
|
</li>
|
389
397
|
|
390
398
|
|
391
|
-
<li class="
|
399
|
+
<li class="odd ">
|
392
400
|
<div class="item">
|
393
401
|
<span class='object_link'><a href="Chess/Pgn.html#result-instance_method" title="Chess::Pgn#result (method)">#result</a></span>
|
394
402
|
<small>Chess::Pgn</small>
|
@@ -396,7 +404,7 @@
|
|
396
404
|
</li>
|
397
405
|
|
398
406
|
|
399
|
-
<li class="
|
407
|
+
<li class="even ">
|
400
408
|
<div class="item">
|
401
409
|
<span class='object_link'><a href="Chess/CGame.html#result-instance_method" title="Chess::CGame#result (method)">#result</a></span>
|
402
410
|
<small>Chess::CGame</small>
|
@@ -404,7 +412,7 @@
|
|
404
412
|
</li>
|
405
413
|
|
406
414
|
|
407
|
-
<li class="
|
415
|
+
<li class="odd ">
|
408
416
|
<div class="item">
|
409
417
|
<span class='object_link'><a href="Chess/CGame.html#rollback!-instance_method" title="Chess::CGame#rollback! (method)">#rollback!</a></span>
|
410
418
|
<small>Chess::CGame</small>
|
@@ -412,7 +420,7 @@
|
|
412
420
|
</li>
|
413
421
|
|
414
422
|
|
415
|
-
<li class="
|
423
|
+
<li class="even ">
|
416
424
|
<div class="item">
|
417
425
|
<span class='object_link'><a href="Chess/Pgn.html#round-instance_method" title="Chess::Pgn#round (method)">#round</a></span>
|
418
426
|
<small>Chess::Pgn</small>
|
@@ -420,7 +428,7 @@
|
|
420
428
|
</li>
|
421
429
|
|
422
430
|
|
423
|
-
<li class="
|
431
|
+
<li class="odd ">
|
424
432
|
<div class="item">
|
425
433
|
<span class='object_link'><a href="Chess/CGame.html#set_fen!-instance_method" title="Chess::CGame#set_fen! (method)">#set_fen!</a></span>
|
426
434
|
<small>Chess::CGame</small>
|
@@ -428,7 +436,7 @@
|
|
428
436
|
</li>
|
429
437
|
|
430
438
|
|
431
|
-
<li class="
|
439
|
+
<li class="even ">
|
432
440
|
<div class="item">
|
433
441
|
<span class='object_link'><a href="Chess/Pgn.html#site-instance_method" title="Chess::Pgn#site (method)">#site</a></span>
|
434
442
|
<small>Chess::Pgn</small>
|
@@ -436,7 +444,7 @@
|
|
436
444
|
</li>
|
437
445
|
|
438
446
|
|
439
|
-
<li class="
|
447
|
+
<li class="odd ">
|
440
448
|
<div class="item">
|
441
449
|
<span class='object_link'><a href="Chess/CGame.html#size-instance_method" title="Chess::CGame#size (method)">#size</a></span>
|
442
450
|
<small>Chess::CGame</small>
|
@@ -444,7 +452,7 @@
|
|
444
452
|
</li>
|
445
453
|
|
446
454
|
|
447
|
-
<li class="
|
455
|
+
<li class="even ">
|
448
456
|
<div class="item">
|
449
457
|
<span class='object_link'><a href="Chess/Board.html#stalemate%3F-instance_method" title="Chess::Board#stalemate? (method)">#stalemate?</a></span>
|
450
458
|
<small>Chess::Board</small>
|
@@ -452,7 +460,7 @@
|
|
452
460
|
</li>
|
453
461
|
|
454
462
|
|
455
|
-
<li class="
|
463
|
+
<li class="odd ">
|
456
464
|
<div class="item">
|
457
465
|
<span class='object_link'><a href="Chess/Game.html#status-instance_method" title="Chess::Game#status (method)">#status</a></span>
|
458
466
|
<small>Chess::Game</small>
|
@@ -460,7 +468,7 @@
|
|
460
468
|
</li>
|
461
469
|
|
462
470
|
|
463
|
-
<li class="
|
471
|
+
<li class="even ">
|
464
472
|
<div class="item">
|
465
473
|
<span class='object_link'><a href="Chess/CGame.html#threefold_repetition%3F-instance_method" title="Chess::CGame#threefold_repetition? (method)">#threefold_repetition?</a></span>
|
466
474
|
<small>Chess::CGame</small>
|
@@ -468,7 +476,7 @@
|
|
468
476
|
</li>
|
469
477
|
|
470
478
|
|
471
|
-
<li class="
|
479
|
+
<li class="odd ">
|
472
480
|
<div class="item">
|
473
481
|
<span class='object_link'><a href="Chess/Board.html#to_fen-instance_method" title="Chess::Board#to_fen (method)">#to_fen</a></span>
|
474
482
|
<small>Chess::Board</small>
|
@@ -476,7 +484,7 @@
|
|
476
484
|
</li>
|
477
485
|
|
478
486
|
|
479
|
-
<li class="
|
487
|
+
<li class="even ">
|
480
488
|
<div class="item">
|
481
489
|
<span class='object_link'><a href="Chess/Board.html#to_s-instance_method" title="Chess::Board#to_s (method)">#to_s</a></span>
|
482
490
|
<small>Chess::Board</small>
|
@@ -484,7 +492,7 @@
|
|
484
492
|
</li>
|
485
493
|
|
486
494
|
|
487
|
-
<li class="
|
495
|
+
<li class="odd ">
|
488
496
|
<div class="item">
|
489
497
|
<span class='object_link'><a href="Chess/CGame.html#to_s-instance_method" title="Chess::CGame#to_s (method)">#to_s</a></span>
|
490
498
|
<small>Chess::CGame</small>
|
@@ -492,7 +500,7 @@
|
|
492
500
|
</li>
|
493
501
|
|
494
502
|
|
495
|
-
<li class="
|
503
|
+
<li class="even ">
|
496
504
|
<div class="item">
|
497
505
|
<span class='object_link'><a href="Chess/Pgn.html#to_s-instance_method" title="Chess::Pgn#to_s (method)">#to_s</a></span>
|
498
506
|
<small>Chess::Pgn</small>
|
@@ -500,7 +508,7 @@
|
|
500
508
|
</li>
|
501
509
|
|
502
510
|
|
503
|
-
<li class="
|
511
|
+
<li class="odd ">
|
504
512
|
<div class="item">
|
505
513
|
<span class='object_link'><a href="Chess/UTF8Notation.html#to_utf8-instance_method" title="Chess::UTF8Notation#to_utf8 (method)">#to_utf8</a></span>
|
506
514
|
<small>Chess::UTF8Notation</small>
|
@@ -508,7 +516,7 @@
|
|
508
516
|
</li>
|
509
517
|
|
510
518
|
|
511
|
-
<li class="
|
519
|
+
<li class="even ">
|
512
520
|
<div class="item">
|
513
521
|
<span class='object_link'><a href="Chess/Pgn.html#white-instance_method" title="Chess::Pgn#white (method)">#white</a></span>
|
514
522
|
<small>Chess::Pgn</small>
|
@@ -516,7 +524,7 @@
|
|
516
524
|
</li>
|
517
525
|
|
518
526
|
|
519
|
-
<li class="
|
527
|
+
<li class="odd ">
|
520
528
|
<div class="item">
|
521
529
|
<span class='object_link'><a href="Chess/Pgn.html#write-instance_method" title="Chess::Pgn#write (method)">#write</a></span>
|
522
530
|
<small>Chess::Pgn</small>
|
@@ -100,9 +100,9 @@
|
|
100
100
|
</div>
|
101
101
|
|
102
102
|
<div id="footer">
|
103
|
-
Generated on
|
104
|
-
<a href="
|
105
|
-
0.9.
|
103
|
+
Generated on Fri Aug 30 11:09:50 2024 by
|
104
|
+
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
105
|
+
0.9.36 (ruby-3.3.2).
|
106
106
|
</div>
|
107
107
|
|
108
108
|
</div>
|
data/ext/chess/chess.c
CHANGED
@@ -640,6 +640,38 @@ board_generate_moves (VALUE self, VALUE square)
|
|
640
640
|
return moves;
|
641
641
|
}
|
642
642
|
|
643
|
+
/*
|
644
|
+
* @overload generate_all_moves
|
645
|
+
* Generate all legal moves for the current board position.
|
646
|
+
* @return [Array<String>] Returns all legal moves that can be performed
|
647
|
+
* in the current board position. The moves are in short algebraic chess
|
648
|
+
* notation format.
|
649
|
+
* @example
|
650
|
+
* :001 > g = Chess::Game.new
|
651
|
+
* => #<Chess::Game:0x007f88a529fa88>
|
652
|
+
* :002 > g.board.generate_all_moves
|
653
|
+
* => ["Na3", "Nc3", "Nf3", "Nh3", "a3", "a4", "b3", "b4", "c3", "c4", "d3", "d4", "e3", "e4", "f3", "f4", "g3", "g4", "h3", "h4"]
|
654
|
+
*/
|
655
|
+
VALUE
|
656
|
+
board_generate_all_moves (VALUE self)
|
657
|
+
{
|
658
|
+
Board *board;
|
659
|
+
Data_Get_Struct (self, Board, board);
|
660
|
+
VALUE moves = rb_ary_new ();
|
661
|
+
Board new_board;
|
662
|
+
char *move_done;
|
663
|
+
char capture;
|
664
|
+
for (int i = 0; i < 64; i++)
|
665
|
+
for (int j = 0; j < 64; j++)
|
666
|
+
if (pseudo_legal_move (board, i, j))
|
667
|
+
{
|
668
|
+
move_done = castling (board, castling_type (board, i, j), &new_board);
|
669
|
+
if (move_done || try_move (board, i, j, 'Q', &new_board, &move_done, &capture))
|
670
|
+
rb_ary_push (moves, rb_str_new2 (move_done));
|
671
|
+
}
|
672
|
+
return moves;
|
673
|
+
}
|
674
|
+
|
643
675
|
/*
|
644
676
|
* @overload to_fen
|
645
677
|
* Returns the FEN string of the board.
|
@@ -729,6 +761,7 @@ Init_chess ()
|
|
729
761
|
rb_define_method (board_klass, "halfmove_clock", board_halfmove_clock, 0);
|
730
762
|
rb_define_method (board_klass, "fullmove_number", board_fullmove_number, 0);
|
731
763
|
rb_define_method (board_klass, "generate_moves", board_generate_moves, 1);
|
764
|
+
rb_define_method (board_klass, "generate_all_moves", board_generate_all_moves, 0);
|
732
765
|
rb_define_method (board_klass, "to_fen", board_to_fen, 0);
|
733
766
|
rb_define_method (board_klass, "to_s", board_to_s, 0);
|
734
767
|
|
data/ext/chess/chess.h
CHANGED
@@ -42,6 +42,7 @@ VALUE board_active_color (VALUE self);
|
|
42
42
|
VALUE board_halfmove_clock (VALUE self);
|
43
43
|
VALUE board_fullmove_number (VALUE self);
|
44
44
|
VALUE board_generate_moves (VALUE self, VALUE square);
|
45
|
+
VALUE board_generate_all_moves (VALUE self);
|
45
46
|
VALUE board_to_fen (VALUE self);
|
46
47
|
VALUE board_to_s (VALUE self);
|
47
48
|
|
data/ext/chess/extconf.rb
CHANGED
@@ -1,33 +1,8 @@
|
|
1
1
|
# Creating a gem that includes an extension that is built at install time
|
2
2
|
# https://guides.rubygems.org/gems-with-extensions/
|
3
3
|
|
4
|
-
ENV['RC_ARCHS'] = '' if RUBY_PLATFORM.include?('darwin')
|
5
|
-
|
6
4
|
require 'mkmf'
|
7
5
|
|
8
|
-
|
9
|
-
# Check the ruby install locations
|
10
|
-
RbConfig::CONFIG['includedir'],
|
11
|
-
# First earch /opt/local for macports
|
12
|
-
'/opt/local/include',
|
13
|
-
# Then search /usr/local for people that installed from source
|
14
|
-
'/usr/local/include',
|
15
|
-
# Finally fall back to /usr
|
16
|
-
'/usr/include'
|
17
|
-
].freeze
|
18
|
-
|
19
|
-
LIB_DIRS = [
|
20
|
-
# Check the ruby install locations
|
21
|
-
RbConfig::CONFIG['libdir'],
|
22
|
-
# First search /opt/local for macports
|
23
|
-
'/opt/local/lib',
|
24
|
-
# Then search /usr/local for people that installed from source
|
25
|
-
'/usr/local/lib',
|
26
|
-
# Finally fall back to /usr
|
27
|
-
'/usr/lib'
|
28
|
-
].freeze
|
29
|
-
|
30
|
-
# dir_config('chess', INCLUDE_DIRS, LIB_DIRS)
|
31
|
-
$CFLAGS << ' -std=c99'
|
6
|
+
$CFLAGS += ' -std=c99'
|
32
7
|
|
33
8
|
create_makefile('chess/chess')
|
data/lib/chess/version.rb
CHANGED
data/test/test_move_generator.rb
CHANGED
@@ -27,6 +27,13 @@ class ChessTest < Minitest::Test
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
+
def test_generate_all_moves
|
31
|
+
game = Chess::Game.new
|
32
|
+
result = game.board.generate_all_moves
|
33
|
+
|
34
|
+
assert_equal %w[Na3 Nc3 Nf3 Nh3 a3 a4 b3 b4 c3 c4 d3 d4 e3 e4 f3 f4 g3 g4 h3 h4], result
|
35
|
+
end
|
36
|
+
|
30
37
|
def test_github_issue32
|
31
38
|
game = Chess::Game.new
|
32
39
|
game.moves = %w[f2f4 d7d6 d2d3 h7h5 b1d2 e7e5 f4f5 a7a5 c2c3 d8f6 d2c4 b7b6 c4d2 a8a6 d2f3 a6a7 f3e5 b6b5 h2h4]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chess
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Enrico Pilotto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08-
|
11
|
+
date: 2024-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A fast chess library that use bitboards to play chess with Ruby.
|
14
14
|
email:
|