chess 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.rdoc +6 -2
- data/Rakefile +1 -1
- data/ext/board.c +1 -4
- data/ext/chess.c +98 -15
- data/ext/chess.h +5 -3
- data/ext/common.c +3 -3
- data/ext/common.h +4 -4
- data/ext/game.c +22 -7
- data/lib/chess/game.rb +48 -19
- data/lib/chess/gnuchess.rb +39 -12
- data/lib/chess/pgn.rb +2 -1
- data/lib/chess/version.rb +1 -1
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0001.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0002.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0003.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0004.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0005.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0006.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0007.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0008.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0009.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0010.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0011.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0012.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0013.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0014.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0015.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0016.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0017.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0018.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0019.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0020.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0021.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0022.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0023.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0024.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0025.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0026.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0027.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0028.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0029.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0030.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0031.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0032.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0033.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0034.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0035.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0036.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0037.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0038.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0039.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0040.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0041.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0042.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0043.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0044.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0045.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0046.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0047.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0048.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0049.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0050.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0051.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0052.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0053.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0054.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0055.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0056.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0057.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0058.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0059.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0060.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0061.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0062.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0063.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0064.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0065.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0066.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0067.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0068.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0069.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0070.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0071.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0072.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0073.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0074.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0075.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0076.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0077.pgn +0 -0
- data/test/pgn_collection/checkmate/{black_wins → black_won}/0078.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0001.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0002.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0003.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0004.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0005.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0006.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0007.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0008.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0009.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0010.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0011.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0012.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0013.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0014.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0015.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0016.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0017.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0018.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0019.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0020.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0021.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0022.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0023.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0024.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0025.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0026.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0027.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0028.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0029.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0030.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0031.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0032.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0033.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0034.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0035.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0036.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0037.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0038.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0039.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0040.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0041.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0042.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0043.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0044.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0045.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0046.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0047.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0048.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0049.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0050.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0051.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0052.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0053.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0054.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0055.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0056.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0057.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0058.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0059.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0060.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0061.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0062.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0063.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0064.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0065.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0066.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0067.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0068.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0069.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0070.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0071.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0072.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0073.pgn +0 -0
- data/test/pgn_collection/checkmate/{white_wins → white_won}/0074.pgn +0 -0
- data/test/pgn_collection/{valid/checkmate/ciccio.pgn → checkmate/white_won/0075.pgn} +0 -1
- data/test/pgn_collection/valid/0003.pgn +13 -19
- data/test/pgn_collection/valid/0004.pgn +15 -18
- data/test/pgn_collection/valid/0006.pgn +12 -13
- data/test/pgn_collection/valid/0007.pgn +16 -18
- data/test/pgn_collection/valid/0008.pgn +12 -14
- data/test/pgn_collection/valid/0017.pgn +13 -20
- data/test/pgn_collection/valid/0019.pgn +16 -18
- data/test/pgn_collection/valid/0022.pgn +14 -19
- data/test/pgn_collection/valid/0029.pgn +12 -20
- data/test/pgn_collection/valid/0031.pgn +13 -18
- data/test/pgn_collection/valid/0035.pgn +12 -16
- data/test/pgn_collection/valid/0040.pgn +12 -17
- data/test/pgn_collection/valid/0042.pgn +13 -17
- data/test/pgn_collection/valid/0043.pgn +11 -20
- data/test/pgn_collection/valid/0044.pgn +15 -22
- data/test/pgn_collection/valid/0048.pgn +12 -15
- data/test/pgn_collection/valid/0052.pgn +18 -26
- data/test/pgn_collection/valid/0058.pgn +10 -12
- data/test/pgn_collection/valid/0059.pgn +13 -15
- data/test/pgn_collection/valid/0064.pgn +13 -17
- data/test/pgn_collection/valid/0066.pgn +12 -14
- data/test/pgn_collection/valid/0067.pgn +14 -15
- data/test/pgn_collection/valid/0068.pgn +15 -18
- data/test/pgn_collection/valid/0071.pgn +11 -15
- data/test/pgn_collection/valid/0075.pgn +13 -14
- data/test/pgn_collection/valid/0076.pgn +14 -20
- data/test/pgn_collection/valid/0077.pgn +11 -14
- data/test/pgn_collection/valid/0078.pgn +14 -22
- data/test/pgn_collection/valid/0080.pgn +13 -17
- data/test/pgn_collection/valid/0083.pgn +17 -23
- data/test/pgn_collection/valid/0085.pgn +18 -21
- data/test/pgn_collection/valid/0088.pgn +14 -19
- data/test/pgn_collection/valid/0089.pgn +16 -18
- data/test/pgn_collection/valid/0090.pgn +11 -14
- data/test/pgn_collection/valid/0093.pgn +14 -19
- data/test/pgn_collection/valid/0099.pgn +14 -17
- data/test/pgn_collection/valid/0100.pgn +16 -21
- data/test/pgn_collection/valid/0102.pgn +17 -19
- data/test/pgn_collection/valid/0110.pgn +13 -18
- data/test/pgn_collection/valid/0113.pgn +15 -20
- data/test/pgn_collection/valid/0116.pgn +15 -17
- data/test/pgn_collection/valid/0118.pgn +14 -20
- data/test/pgn_collection/valid/0124.pgn +12 -20
- data/test/pgn_collection/valid/0132.pgn +12 -17
- data/test/pgn_collection/valid/0134.pgn +15 -17
- data/test/pgn_collection/valid/0135.pgn +17 -19
- data/test/pgn_collection/valid/0139.pgn +19 -21
- data/test/pgn_collection/valid/0144.pgn +16 -23
- data/test/pgn_collection/valid/0146.pgn +12 -14
- data/test/pgn_collection/valid/0148.pgn +15 -20
- data/test/pgn_collection/valid/0149.pgn +12 -16
- data/test/pgn_collection/valid/0152.pgn +7 -14
- data/test/pgn_collection/valid/0153.pgn +16 -22
- data/test/pgn_collection/valid/0154.pgn +13 -15
- data/test/pgn_collection/valid/0161.pgn +16 -22
- data/test/pgn_collection/valid/0163.pgn +11 -15
- data/test/pgn_collection/valid/0164.pgn +15 -17
- data/test/pgn_collection/valid/0169.pgn +15 -21
- data/test/pgn_collection/valid/0171.pgn +11 -15
- data/test/pgn_collection/valid/0173.pgn +11 -13
- data/test/pgn_collection/valid/0174.pgn +16 -24
- data/test/pgn_collection/valid/0177.pgn +15 -19
- data/test/pgn_collection/valid/0178.pgn +16 -21
- data/test/pgn_collection/valid/0185.pgn +11 -14
- data/test/pgn_collection/valid/0186.pgn +13 -15
- data/test/pgn_collection/valid/0187.pgn +17 -19
- data/test/pgn_collection/valid/0189.pgn +16 -20
- data/test/pgn_collection/valid/0191.pgn +18 -26
- data/test/pgn_collection/valid/0193.pgn +16 -18
- data/test/pgn_collection/valid/0196.pgn +16 -21
- data/test/pgn_collection/valid/0197.pgn +15 -21
- data/test/pgn_collection/valid/0198.pgn +15 -20
- data/test/pgn_collection/valid/0199.pgn +11 -13
- data/test/pgn_collection/valid/0202.pgn +10 -12
- data/test/pgn_collection/valid/0203.pgn +11 -13
- data/test/pgn_collection/valid/0204.pgn +12 -14
- data/test/pgn_collection/valid/0205.pgn +10 -13
- data/test/pgn_collection/valid/0209.pgn +14 -20
- data/test/pgn_collection/valid/0210.pgn +13 -15
- data/test/pgn_collection/valid/0216.pgn +13 -17
- data/test/pgn_collection/valid/0217.pgn +15 -21
- data/test/pgn_collection/valid/0221.pgn +18 -26
- data/test/pgn_collection/valid/0222.pgn +12 -21
- data/test/pgn_collection/valid/0225.pgn +16 -19
- data/test/pgn_collection/valid/0226.pgn +14 -19
- data/test/pgn_collection/valid/0228.pgn +12 -21
- data/test/pgn_collection/valid/0229.pgn +13 -16
- data/test/pgn_collection/valid/0231.pgn +14 -22
- data/test/pgn_collection/valid/0235.pgn +16 -23
- data/test/pgn_collection/valid/0238.pgn +12 -16
- data/test/pgn_collection/valid/0239.pgn +18 -21
- data/test/pgn_collection/valid/0240.pgn +13 -15
- data/test/pgn_collection/valid/0241.pgn +12 -21
- data/test/pgn_collection/valid/0242.pgn +18 -26
- data/test/pgn_collection/valid/0243.pgn +10 -13
- data/test/pgn_collection/valid/0246.pgn +11 -15
- data/test/pgn_collection/valid/0256.pgn +15 -18
- data/test/pgn_collection/valid/0257.pgn +16 -22
- data/test/pgn_collection/valid/0261.pgn +14 -16
- data/test/pgn_collection/valid/0263.pgn +10 -12
- data/test/pgn_collection/valid/0266.pgn +10 -13
- data/test/pgn_collection/valid/0267.pgn +12 -14
- data/test/pgn_collection/valid/0271.pgn +20 -22
- data/test/pgn_collection/valid/0276.pgn +16 -24
- data/test/pgn_collection/valid/0278.pgn +13 -17
- data/test/pgn_collection/valid/0284.pgn +9 -11
- data/test/pgn_collection/valid/0289.pgn +15 -23
- data/test/pgn_collection/valid/0290.pgn +22 -24
- data/test/pgn_collection/valid/0291.pgn +14 -20
- data/test/pgn_collection/valid/0292.pgn +11 -15
- data/test/pgn_collection/valid/0298.pgn +18 -25
- data/test/pgn_collection/valid/0300.pgn +13 -15
- data/test/pgn_collection/valid/0304.pgn +12 -18
- data/test/pgn_collection/valid/0309.pgn +17 -19
- data/test/pgn_collection/valid/0310.pgn +17 -24
- data/test/pgn_collection/valid/0313.pgn +13 -15
- data/test/pgn_collection/valid/0314.pgn +18 -21
- data/test/pgn_collection/valid/0318.pgn +10 -12
- data/test/pgn_collection/valid/0320.pgn +13 -18
- data/test/pgn_collection/valid/0325.pgn +15 -21
- data/test/pgn_collection/valid/0328.pgn +11 -15
- data/test/pgn_collection/valid/0333.pgn +14 -16
- data/test/pgn_collection/valid/0338.pgn +20 -24
- data/test/pgn_collection/valid/0339.pgn +18 -22
- data/test/pgn_collection/valid/0343.pgn +11 -14
- data/test/pgn_collection/valid/0349.pgn +21 -30
- data/test/pgn_collection/valid/0350.pgn +14 -20
- data/test/pgn_collection/valid/0356.pgn +14 -17
- data/test/pgn_collection/valid/0359.pgn +15 -17
- data/test/pgn_collection/valid/0369.pgn +17 -25
- data/test/pgn_collection/valid/0373.pgn +15 -19
- data/test/pgn_collection/valid/0374.pgn +13 -16
- data/test/pgn_collection/valid/0381.pgn +11 -17
- data/test/pgn_collection/valid/0386.pgn +14 -21
- data/test/pgn_collection/valid/0387.pgn +12 -17
- data/test/pgn_collection/valid/0388.pgn +16 -20
- data/test/pgn_collection/valid/0393.pgn +15 -18
- data/test/pgn_collection/valid/0395.pgn +10 -13
- data/test/pgn_collection/valid/0399.pgn +20 -24
- data/test/pgn_collection/valid/0402.pgn +14 -22
- data/test/pgn_collection/valid/0409.pgn +15 -23
- data/test/pgn_collection/valid/0417.pgn +15 -21
- data/test/pgn_collection/valid/0421.pgn +21 -24
- data/test/pgn_collection/valid/0422.pgn +15 -22
- data/test/pgn_collection/valid/0423.pgn +17 -23
- data/test/pgn_collection/valid/0427.pgn +11 -14
- data/test/pgn_collection/valid/0429.pgn +12 -16
- data/test/pgn_collection/valid/0433.pgn +15 -17
- data/test/pgn_collection/valid/0434.pgn +11 -20
- data/test/pgn_collection/valid/0438.pgn +12 -16
- data/test/pgn_collection/valid/0439.pgn +22 -26
- data/test/pgn_collection/valid/0440.pgn +21 -24
- data/test/pgn_collection/valid/0447.pgn +21 -25
- data/test/pgn_collection/valid/0450.pgn +15 -16
- data/test/pgn_collection/valid/0451.pgn +11 -14
- data/test/pgn_collection/valid/0453.pgn +13 -15
- data/test/pgn_collection/valid/0462.pgn +17 -25
- data/test/pgn_collection/valid/0463.pgn +12 -14
- data/test/pgn_collection/valid/0469.pgn +16 -18
- data/test/pgn_collection/valid/0471.pgn +11 -15
- data/test/pgn_collection/valid/0472.pgn +20 -29
- data/test/pgn_collection/valid/0473.pgn +12 -19
- data/test/pgn_collection/valid/0474.pgn +15 -20
- data/test/pgn_collection/valid/0476.pgn +11 -18
- data/test/pgn_collection/valid/0477.pgn +21 -30
- data/test/pgn_collection/valid/0480.pgn +13 -18
- data/test/pgn_collection/valid/0488.pgn +12 -18
- data/test/pgn_collection/valid/0490.pgn +15 -21
- data/test/pgn_collection/valid/0491.pgn +10 -15
- data/test/pgn_collection/valid/0503.pgn +15 -23
- data/test/pgn_collection/valid/0508.pgn +10 -13
- data/test/pgn_collection/valid/0509.pgn +20 -22
- data/test/pgn_collection/valid/0515.pgn +10 -12
- data/test/pgn_collection/valid/0518.pgn +17 -23
- data/test/pgn_collection/valid/0530.pgn +16 -19
- data/test/pgn_collection/valid/0531.pgn +13 -18
- data/test/pgn_collection/valid/0533.pgn +17 -19
- data/test/pgn_collection/valid/0534.pgn +17 -25
- data/test/pgn_collection/valid/0535.pgn +13 -17
- data/test/pgn_collection/valid/0536.pgn +13 -21
- data/test/pgn_collection/valid/0537.pgn +12 -17
- data/test/pgn_collection/valid/0540.pgn +14 -19
- data/test/pgn_collection/valid/0541.pgn +12 -17
- data/test/pgn_collection/valid/0542.pgn +15 -17
- data/test/pgn_collection/valid/0545.pgn +15 -19
- data/test/pgn_collection/valid/0546.pgn +12 -21
- data/test/pgn_collection/valid/0547.pgn +15 -17
- data/test/pgn_collection/valid/0548.pgn +14 -17
- data/test/pgn_collection/valid/0552.pgn +16 -22
- data/test/pgn_collection/valid/0557.pgn +12 -14
- data/test/pgn_collection/valid/0558.pgn +15 -21
- data/test/pgn_collection/valid/0561.pgn +13 -15
- data/test/pgn_collection/valid/0568.pgn +12 -20
- data/test/pgn_collection/valid/0569.pgn +15 -20
- data/test/pgn_collection/valid/0572.pgn +13 -17
- data/test/pgn_collection/valid/0573.pgn +13 -17
- data/test/pgn_collection/valid/0579.pgn +18 -25
- data/test/pgn_collection/valid/0580.pgn +14 -19
- data/test/pgn_collection/valid/0581.pgn +10 -13
- data/test/pgn_collection/valid/0586.pgn +15 -20
- data/test/pgn_collection/valid/0587.pgn +12 -16
- data/test/pgn_collection/valid/0589.pgn +12 -15
- data/test/pgn_collection/valid/0590.pgn +17 -23
- data/test/pgn_collection/valid/0592.pgn +15 -21
- data/test/pgn_collection/valid/0595.pgn +14 -16
- data/test/pgn_collection/valid/0597.pgn +14 -20
- data/test/pgn_collection/valid/0598.pgn +13 -18
- data/test/pgn_collection/valid/0603.pgn +12 -21
- data/test/pgn_collection/valid/0605.pgn +14 -20
- data/test/pgn_collection/valid/0607.pgn +12 -16
- data/test/pgn_collection/valid/0609.pgn +11 -15
- data/test/pgn_collection/valid/0611.pgn +13 -21
- data/test/pgn_collection/valid/0612.pgn +17 -18
- data/test/pgn_collection/valid/0613.pgn +9 -12
- data/test/pgn_collection/valid/0614.pgn +11 -15
- data/test/pgn_collection/valid/0615.pgn +16 -18
- data/test/pgn_collection/valid/0617.pgn +18 -26
- data/test/pgn_collection/valid/0618.pgn +13 -19
- data/test/pgn_collection/valid/0620.pgn +13 -22
- data/test/pgn_collection/valid/0630.pgn +13 -15
- data/test/pgn_collection/valid/0631.pgn +15 -21
- data/test/pgn_collection/valid/0634.pgn +12 -16
- data/test/pgn_collection/valid/0639.pgn +14 -19
- data/test/pgn_collection/valid/0640.pgn +19 -22
- data/test/pgn_collection/valid/0641.pgn +11 -14
- data/test/pgn_collection/valid/0646.pgn +15 -18
- data/test/pgn_collection/valid/0648.pgn +23 -28
- data/test/pgn_collection/valid/0650.pgn +13 -16
- data/test/pgn_collection/valid/0655.pgn +15 -20
- data/test/pgn_collection/valid/0656.pgn +14 -22
- data/test/pgn_collection/valid/0658.pgn +18 -26
- data/test/pgn_collection/valid/0659.pgn +13 -22
- data/test/pgn_collection/valid/0660.pgn +19 -27
- data/test/pgn_collection/valid/0665.pgn +10 -13
- data/test/pgn_collection/valid/0667.pgn +12 -20
- data/test/pgn_collection/valid/0669.pgn +15 -22
- data/test/pgn_collection/valid/0671.pgn +16 -19
- data/test/pgn_collection/valid/0673.pgn +13 -19
- data/test/pgn_collection/valid/0674.pgn +13 -15
- data/test/pgn_collection/valid/0679.pgn +14 -16
- data/test/pgn_collection/valid/0680.pgn +15 -21
- data/test/pgn_collection/valid/0689.pgn +16 -24
- data/test/pgn_collection/valid/0692.pgn +18 -26
- data/test/pgn_collection/valid/0702.pgn +12 -18
- data/test/pgn_collection/valid/0712.pgn +11 -12
- data/test/pgn_collection/valid/0714.pgn +15 -21
- data/test/pgn_collection/valid/0715.pgn +13 -17
- data/test/pgn_collection/valid/0717.pgn +15 -23
- data/test/pgn_collection/valid/0720.pgn +16 -21
- data/test/pgn_collection/valid/0721.pgn +14 -19
- data/test/pgn_collection/valid/0722.pgn +22 -32
- data/test/pgn_collection/valid/0728.pgn +14 -16
- data/test/pgn_collection/valid/0732.pgn +19 -21
- data/test/pgn_collection/valid/0734.pgn +14 -20
- data/test/pgn_collection/valid/0739.pgn +12 -20
- data/test/pgn_collection/valid/0740.pgn +12 -15
- data/test/pgn_collection/valid/0743.pgn +12 -18
- data/test/pgn_collection/valid/0752.pgn +14 -18
- data/test/pgn_collection/valid/0754.pgn +16 -24
- data/test/pgn_collection/valid/0758.pgn +12 -14
- data/test/pgn_collection/valid/0759.pgn +15 -19
- data/test/pgn_collection/valid/0762.pgn +12 -16
- data/test/pgn_collection/valid/0764.pgn +17 -21
- data/test/pgn_collection/valid/0765.pgn +15 -21
- data/test/pgn_collection/valid/0767.pgn +17 -25
- data/test/pgn_collection/valid/0768.pgn +13 -15
- data/test/pgn_collection/valid/0770.pgn +19 -21
- data/test/pgn_collection/valid/0773.pgn +18 -24
- data/test/pgn_collection/valid/0775.pgn +12 -14
- data/test/pgn_collection/valid/0783.pgn +15 -21
- data/test/pgn_collection/valid/0789.pgn +15 -21
- data/test/pgn_collection/valid/0794.pgn +12 -14
- data/test/pgn_collection/valid/0795.pgn +17 -23
- data/test/pgn_collection/valid/0797.pgn +17 -24
- data/test/pgn_collection/valid/0800.pgn +9 -12
- data/test/pgn_collection/valid/0812.pgn +14 -16
- data/test/pgn_collection/valid/0814.pgn +18 -21
- data/test/pgn_collection/valid/0815.pgn +11 -20
- data/test/pgn_collection/valid/0817.pgn +14 -19
- data/test/pgn_collection/valid/0818.pgn +10 -12
- data/test/pgn_collection/valid/0822.pgn +18 -25
- data/test/pgn_collection/valid/0828.pgn +11 -12
- data/test/pgn_collection/valid/0830.pgn +12 -16
- data/test/pgn_collection/valid/0837.pgn +11 -15
- data/test/pgn_collection/valid/0842.pgn +20 -29
- data/test/pgn_collection/valid/0843.pgn +15 -18
- data/test/pgn_collection/valid/0856.pgn +17 -23
- data/test/pgn_collection/valid/0861.pgn +12 -14
- data/test/pgn_collection/valid/0866.pgn +17 -24
- data/test/pgn_collection/valid/0867.pgn +13 -17
- data/test/pgn_collection/valid/0875.pgn +11 -13
- data/test/pgn_collection/valid/0882.pgn +14 -17
- data/test/pgn_collection/valid/0883.pgn +12 -14
- data/test/pgn_collection/valid/0888.pgn +19 -27
- data/test/pgn_collection/valid/0889.pgn +27 -39
- data/test/pgn_collection/valid/0891.pgn +12 -17
- data/test/pgn_collection/valid/0892.pgn +15 -18
- data/test/pgn_collection/valid/0903.pgn +14 -22
- data/test/pgn_collection/valid/0905.pgn +13 -18
- data/test/pgn_collection/valid/0906.pgn +10 -12
- data/test/pgn_collection/valid/0917.pgn +18 -21
- data/test/pgn_collection/valid/0918.pgn +11 -14
- data/test/pgn_collection/valid/0920.pgn +17 -23
- data/test/pgn_collection/valid/0921.pgn +13 -15
- data/test/pgn_collection/valid/0922.pgn +17 -25
- data/test/pgn_collection/valid/0926.pgn +14 -17
- data/test/pgn_collection/valid/0928.pgn +12 -14
- data/test/pgn_collection/valid/0929.pgn +16 -20
- data/test/pgn_collection/valid/0935.pgn +19 -27
- data/test/pgn_collection/valid/0936.pgn +11 -15
- data/test/pgn_collection/valid/0938.pgn +11 -14
- data/test/pgn_collection/valid/0940.pgn +13 -15
- data/test/pgn_collection/valid/0946.pgn +15 -18
- data/test/pgn_collection/valid/0952.pgn +19 -27
- data/test/pgn_collection/valid/0957.pgn +15 -19
- data/test/pgn_collection/valid/0959.pgn +15 -23
- data/test/pgn_collection/valid/0966.pgn +14 -16
- data/test/pgn_collection/valid/0972.pgn +14 -17
- data/test/pgn_collection/valid/0974.pgn +17 -24
- data/test/pgn_collection/valid/0975.pgn +12 -14
- data/test/pgn_collection/valid/0977.pgn +10 -14
- data/test/pgn_collection/valid/0979.pgn +17 -19
- data/test/pgn_collection/valid/0981.pgn +12 -21
- data/test/pgn_collection/valid/0982.pgn +13 -18
- data/test/pgn_collection/valid/0984.pgn +19 -27
- data/test/pgn_collection/valid/0987.pgn +13 -15
- data/test/pgn_collection/valid/0993.pgn +11 -15
- data/test/pgn_collection/valid/0997.pgn +16 -24
- data/test/test_checkmate.rb +4 -2
- data/test/test_insufficient_material.rb +3 -2
- data/test/test_pgn_collection.rb +5 -1
- data/test/test_stalemate.rb +1 -0
- metadata +313 -319
- data/test/pgn_collection/valid/checkmate/0925.pgn +0 -26
- data/test/pgn_collection/valid/checkmate/checkmate.pgn +0 -11
data/lib/chess/gnuchess.rb
CHANGED
@@ -1,35 +1,54 @@
|
|
1
1
|
module Chess
|
2
2
|
|
3
3
|
# Use Gnuchess to I.A. <em>(Only a draft)</em>
|
4
|
-
# To use this module, extend a game object with Chess::Gnuchess
|
4
|
+
# To use this module, extend a game object with Chess::Gnuchess.
|
5
|
+
# Gnuchess binary have to be installed.
|
5
6
|
#
|
6
7
|
# g = Chess::Game.new
|
7
8
|
# g.extend Chess::Gnuchess
|
8
|
-
# g.gnuchess_move
|
9
|
+
# g.gnuchess_move!
|
9
10
|
# puts g
|
10
11
|
module Gnuchess
|
11
12
|
|
12
|
-
# Make a move using Gnuchess engine. This add a new Board in the Game.
|
13
13
|
# Return the next move calculated by Gnuchess.
|
14
14
|
# Gnuchess must be installed!
|
15
15
|
def gnuchess_move
|
16
16
|
pipe = IO.popen('gnuchess -x', 'r+')
|
17
17
|
begin
|
18
|
-
pipe.
|
19
|
-
pipe.
|
18
|
+
pipe.puts('depth 1')
|
19
|
+
pipe.puts('manual')
|
20
20
|
self.full_moves.each do |m|
|
21
|
-
pipe.
|
21
|
+
pipe.puts(m)
|
22
22
|
end
|
23
|
-
pipe.
|
23
|
+
pipe.puts('go')
|
24
24
|
while line = pipe.gets
|
25
25
|
raise IllegalMoveError if line.include?('Invalid move')
|
26
|
-
match = line.match(/My move is : ([a-h][1-8][a-h][1-8])/)
|
27
|
-
return
|
26
|
+
match = line.match(/My move is : ([a-h][1-8][a-h][1-8][rkbq]?)/)
|
27
|
+
return match[1] if match
|
28
28
|
end
|
29
29
|
ensure
|
30
|
-
pipe.
|
30
|
+
pipe.puts('quit')
|
31
31
|
pipe.close
|
32
32
|
end
|
33
|
+
return moves
|
34
|
+
end
|
35
|
+
|
36
|
+
# Make a move using Gnuchess engine. This add a new Board in the Game.
|
37
|
+
# Return the next move calculated by Gnuchess.
|
38
|
+
# Gnuchess must be installed!
|
39
|
+
def gnuchess_move!
|
40
|
+
next_move = self.gnuchess_move
|
41
|
+
self.move(next_move) if next_move
|
42
|
+
end
|
43
|
+
|
44
|
+
# :nodoc:
|
45
|
+
def self.included(mod)
|
46
|
+
raise_if_gnuchess_is_not_installed
|
47
|
+
end
|
48
|
+
|
49
|
+
# :nodoc:
|
50
|
+
def self.extended(mod)
|
51
|
+
raise_if_gnuchess_is_not_installed
|
33
52
|
end
|
34
53
|
|
35
54
|
# :nodoc:
|
@@ -51,10 +70,10 @@ module Chess
|
|
51
70
|
elsif line =~ / : resign/
|
52
71
|
break
|
53
72
|
elsif line =~ / : 1-0 {White mates}/
|
54
|
-
done = :
|
73
|
+
done = :white_won
|
55
74
|
break
|
56
75
|
elsif line =~ / : 0-1 {Black mates}/
|
57
|
-
done = :
|
76
|
+
done = :black_won
|
58
77
|
break
|
59
78
|
elsif m = line.match(/1\/2-1\/2 {(.*?)}/)
|
60
79
|
case m[1]
|
@@ -87,6 +106,14 @@ module Chess
|
|
87
106
|
system('which gnuchess >& /dev/null')
|
88
107
|
$?.exitstatus == 0
|
89
108
|
end
|
109
|
+
|
110
|
+
# Raise an exception if Gnuchess is not installed
|
111
|
+
def self.raise_if_gnuchess_is_not_installed
|
112
|
+
unless gnuchess_installed?
|
113
|
+
raise 'You need to install Gnuchess to use the module Chess::Gnuchess.'
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
90
117
|
end
|
91
118
|
|
92
119
|
end
|
data/lib/chess/pgn.rb
CHANGED
@@ -22,11 +22,12 @@ module Chess
|
|
22
22
|
TAGS.each do |t|
|
23
23
|
instance_variable_set("@#{t}", data.match(/^\[#{t.capitalize} ".*"\]\s?$/).to_s.strip[t.size+3..-3])
|
24
24
|
end
|
25
|
+
@result = '1/2-1/2' if @result == '1/2'
|
25
26
|
game_index = data.index(/^1\./)
|
26
27
|
raise Chess::InvalidPgnFormatError.new(filename) if game_index.nil?
|
27
28
|
game = data[game_index..-1].strip
|
28
29
|
@moves = game.gsub("\n", ' ').split(/\d+\./).collect{|t| t.strip}[1..-1].collect{|t| t.split(' ')}.flatten
|
29
|
-
@moves.delete_at(@moves.size-1) if @moves.last =~ /(0
|
30
|
+
@moves.delete_at(@moves.size-1) if @moves.last =~ /(0-1)|(1-0)|(1\/2)|(1\/2-1\/2)|(\*)/
|
30
31
|
return self
|
31
32
|
end
|
32
33
|
|
data/lib/chess/version.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|