Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Passed testHowManyChessPiecesThisTablebaseHas

  • Loading branch information...
commit 3e68e2a365338994ec24b677fe56b99d368022ff 1 parent f8e6d95
Kestutis-Z authored
View
23 endgame-oracle/src/main/java/tablebases/Tablebase.java
@@ -0,0 +1,23 @@
+package tablebases;
+
+/**
+ * Computerized database containing all possible legal chess positions
+ * and their evaluations, given the set of specific chess pieces.
+ * @author Kestutis
+ *
+ */
+public enum Tablebase {
+
+ KK,
+
+ KRK;
+
+ /**
+ * @return number of pieces (White and Black) that
+ * a chess position from this tablebase contains.
+ */
+ public int chessPiecesCount() {
+ return this.name().length();
+ }
+
+}
View
18 endgame-oracle/src/test/java/tablebases/TablebaseTest.java
@@ -0,0 +1,18 @@
+package tablebases;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+
+public class TablebaseTest {
+
+ @Test
+ public void testHowManyChessPiecesThisTablebaseHas() {
+ Tablebase tablebase1 = Tablebase.KK;
+ assertEquals(2, tablebase1.chessPiecesCount());
+
+ Tablebase tablebase2 = Tablebase.KRK;
+ assertEquals(3, tablebase2.chessPiecesCount());
+ }
+
+}
View
BIN  endgame-oracle/target/classes/tablebases/Tablebase.class
Binary file not shown
View
BIN  endgame-oracle/target/test-classes/tablebases/TablebaseTest.class
Binary file not shown
Please sign in to comment.
Something went wrong with that request. Please try again.