chess_validator 0.2.22 → 0.2.23
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/move_logic.rb +5 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d61b299ea0d6ec07579ccb0b6d34ec50a7d5835960ae866469f653c4f7d43d06
|
4
|
+
data.tar.gz: cbc0f79075fa4f497b2ac8128864acab023da94a74e68efcfe87ff0c4d4950b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 952a4c3df07b35e8ef83ee10e72b5488c6cb57a4c09f2e3b1d56de1a37a2024545d7d682812b7497fa6884994453616933437872ac4db47554afec12586c97e5
|
7
|
+
data.tar.gz: d86e7337b4e0616b7dc8bf67aef635e87ddec04fe96d4a395ccfc118c45255f1edade66acc98e42c9a6d6672c2e04247ef712e1a6e576e999156b08eca7dd627
|
data/lib/move_logic.rb
CHANGED
@@ -12,7 +12,7 @@ module ChessValidator
|
|
12
12
|
|
13
13
|
board = get_board(fen.to_s)
|
14
14
|
pieces = []
|
15
|
-
|
15
|
+
|
16
16
|
board.values.each do |piece|
|
17
17
|
if piece.color == fen.active
|
18
18
|
load_move_data(board, piece, fen)
|
@@ -348,18 +348,18 @@ module ChessValidator
|
|
348
348
|
end
|
349
349
|
|
350
350
|
def defended_pieces_by_square(fen_notation)
|
351
|
-
return defended_sets[
|
351
|
+
return defended_sets[fen_notation] if defended_sets[fen_notation]
|
352
352
|
|
353
353
|
board = get_board(fen_notation)
|
354
354
|
|
355
355
|
fen = PGN::FEN.new(fen_notation)
|
356
356
|
space_index = {}
|
357
|
-
|
357
|
+
|
358
358
|
pieces = board.values.map do |piece|
|
359
359
|
space_index[piece.position] = piece.piece_type + piece.color
|
360
360
|
piece
|
361
361
|
end
|
362
|
-
|
362
|
+
|
363
363
|
defended = Hash.new([])
|
364
364
|
|
365
365
|
pieces.each do |piece|
|
@@ -370,7 +370,7 @@ module ChessValidator
|
|
370
370
|
end
|
371
371
|
end
|
372
372
|
|
373
|
-
defended_sets[
|
373
|
+
defended_sets[fen_notation] = defended
|
374
374
|
defended
|
375
375
|
end
|
376
376
|
|