This repository has been archived by the owner on Nov 27, 2021. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Tim Speckhals
committed
Sep 2, 2018
0 parents
commit 42ddadd
Showing
6 changed files
with
3,647 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.idea/ | ||
out/ | ||
*.iml | ||
eco.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2018 Hellsh | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# CompactChessOpenings | ||
|
||
CompactChessOpenings is an open-source Java 7+ library which adds all ECO openings to CompactChess. | ||
|
||
- [More information](https://hell.sh/CompactChess/openings) | ||
- [Downloads](https://github.com/hell-sh/CompactChessOpenings/releases) (dependencies not included) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?php | ||
foreach(json_decode(file_get_contents("eco.json")) as $opening) | ||
{ | ||
$cfen = str_replace("/", "", $opening->f); | ||
echo "openings.add(new Opening(\"{$opening->c}\", \"{$opening->n}\", \"{$cfen}\"));\n"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import org.junit.Test; | ||
import sh.hell.compactchess.exceptions.ChessException; | ||
import sh.hell.compactchess.game.Game; | ||
import sh.hell.compactchess.game.Opening; | ||
|
||
import static junit.framework.TestCase.assertEquals; | ||
|
||
public class Tests | ||
{ | ||
@Test(timeout = 1000L) | ||
public void openings() throws ChessException | ||
{ | ||
System.out.println("Openings\n"); | ||
final Game game = Game.fromPGN("1.e4 e5 2.Nf3 Nc6 3.Bb5 a6 4.Ba4 Nf6 5.O-O Be7 6.Re1 b5 7.Bb3 O-O 8.c3 d5 9.exd5 Nxd5 10.Nxe5 Nxe5 11.Rxe5 c6 12.d4 Bd6 13.Re1 Qh4 14.g3 Qh3 15.Be3 Bg4 16.Qd3 Rae8 17.Nd2 Re6 18.a4 Qh5 19. axb5").get(0); | ||
Opening.insertInto(game, false, true); | ||
System.out.println(game.toPGN()); | ||
assertEquals("Ruy Lopez: Marshall, Main Line, Spassky Variation", game.tags.get("Opening")); | ||
assertEquals("C89", game.tags.get("ECO")); | ||
int i = 0; | ||
assertEquals("B00 King's Pawn", game.moves.get(i++).getAnnotation()); | ||
assertEquals("C20 King's Pawn Game", game.moves.get(i++).getAnnotation()); | ||
assertEquals("C40 King's Knight Opening", game.moves.get(i++).getAnnotation()); | ||
assertEquals("C44 King's Knight Opening: Normal Variation", game.moves.get(i++).getAnnotation()); | ||
assertEquals("C60 Ruy Lopez", game.moves.get(i++).getAnnotation()); | ||
assertEquals("C70 Ruy Lopez", game.moves.get(i++).getAnnotation()); | ||
assertEquals("C68 Ruy Lopez: Columbus Variation", game.moves.get(i++).getAnnotation()); | ||
assertEquals("", game.moves.get(i++).getAnnotation()); | ||
assertEquals("C78 Ruy Lopez: Morphy Defense", game.moves.get(i++).getAnnotation()); | ||
assertEquals("C84 Ruy Lopez: Closed Variations", game.moves.get(i++).getAnnotation()); | ||
assertEquals("", game.moves.get(i++).getAnnotation()); | ||
assertEquals("", game.moves.get(i++).getAnnotation()); | ||
assertEquals("C88 Ruy Lopez: Closed", game.moves.get(i++).getAnnotation()); | ||
assertEquals("C88 Ruy Lopez: Closed, 7... O-O", game.moves.get(i++).getAnnotation()); | ||
assertEquals("C88 Ruy Lopez: Closed, 8. c3", game.moves.get(i++).getAnnotation()); | ||
assertEquals("C89 Ruy Lopez: Marshall Attack", game.moves.get(i++).getAnnotation()); | ||
assertEquals("", game.moves.get(i++).getAnnotation()); | ||
assertEquals("", game.moves.get(i++).getAnnotation()); | ||
assertEquals("", game.moves.get(i++).getAnnotation()); | ||
assertEquals("", game.moves.get(i++).getAnnotation()); | ||
assertEquals("", game.moves.get(i++).getAnnotation()); | ||
assertEquals("C89 Ruy Lopez: Marshall Attack, Modern Variation", game.moves.get(i++).getAnnotation()); | ||
assertEquals("C89 Ruy Lopez: Marshall Attack, Main Line", game.moves.get(i++).getAnnotation()); | ||
assertEquals("", game.moves.get(i++).getAnnotation()); | ||
assertEquals("", game.moves.get(i++).getAnnotation()); | ||
assertEquals("", game.moves.get(i++).getAnnotation()); | ||
assertEquals("", game.moves.get(i++).getAnnotation()); | ||
assertEquals("C89 Ruy Lopez: Marshall Attack, Modern Main Line", game.moves.get(i++).getAnnotation()); | ||
assertEquals("", game.moves.get(i++).getAnnotation()); | ||
assertEquals("", game.moves.get(i++).getAnnotation()); | ||
assertEquals("", game.moves.get(i++).getAnnotation()); | ||
assertEquals("", game.moves.get(i++).getAnnotation()); | ||
assertEquals("", game.moves.get(i++).getAnnotation()); | ||
assertEquals("", game.moves.get(i++).getAnnotation()); | ||
assertEquals("", game.moves.get(i++).getAnnotation()); | ||
assertEquals("C89 Ruy Lopez: Marshall, Main Line, Spassky Variation", game.moves.get(i++).getAnnotation()); | ||
assertEquals("", game.moves.get(i).getAnnotation()); | ||
} | ||
} |
Oops, something went wrong.