Evaluate { static int material(Position pos) { return pos.wMtrl - pos.bMtrl; } Evaluate(); final int evalPos(Position pos);  }
@Test public void testMaterial() throws ChessParseError { System.out.println("material"); Position pos = TextIO.readFEN(TextIO.startPosFEN); assertEquals(0, Evaluate.material(pos)); final int pV = Evaluate.pV; final int qV = Evaluate.qV; assertTrue(pV != 0); assertTrue(qV != 0); assertTrue(qV > pV); UndoInfo ui = new UndoInfo(); pos.makeMove(TextIO.stringToMove(pos, "e4"), ui); assertEquals(0, Evaluate.material(pos)); pos.makeMove(TextIO.stringToMove(pos, "d5"), ui); assertEquals(0, Evaluate.material(pos)); pos.makeMove(TextIO.stringToMove(pos, "exd5"), ui); assertEquals(pV, Evaluate.material(pos)); pos.makeMove(TextIO.stringToMove(pos, "Qxd5"), ui); assertEquals(0, Evaluate.material(pos)); pos.makeMove(TextIO.stringToMove(pos, "Nc3"), ui); assertEquals(0, Evaluate.material(pos)); pos.makeMove(TextIO.stringToMove(pos, "Qxd2"), ui); assertEquals(-pV, Evaluate.material(pos)); pos.makeMove(TextIO.stringToMove(pos, "Qxd2"), ui); assertEquals(-pV+qV, Evaluate.material(pos)); }