Examples of SGFNode


Examples of com.sgfj.SGFNode

                                //#endif

                                if (game != null) {
                                    if (mode == probMode) {
                                        // skip first "Pass" moves, since we don't have "Pass" in problem mode
                                        SGFNode lastSetupNode = game.kifuFirstMove(true).iterator().prev(false);
                                        if (lastSetupNode != null) {
                                            try {
                                                while (game.kifuLastMove() != lastSetupNode && game.next())
                                                    // DO NOTHING
                                                    ;
View Full Code Here

Examples of com.sgfj.SGFNode

         */
        is.skip(offset);
        InputStreamReader isr = new InputStreamReader(is/*, "UTF8"*/);
        //isr.skip(offset); // FIXME: Why this doesn't work?
        SGFParser parser = new SGFParser(isr);
        SGFNode newTree = parser.parse();
        is.close();

/*    SGFCup parser = new SGFCup(new SGFLex(isr));
        parser.tree = new SGFTree(2048);
        try {
View Full Code Here

Examples of com.sgfj.SGFNode

        try {
            String sgf = din.readUTF();

            if (sgf.length() > 0) {
                SGFParser parser = new SGFParser(sgf);
                SGFNode newTree = parser.parse();
                newGame = new DocumentedGame(newTree);

                int depth = din.readShort();
                while (depth-- > 0) {
                    int varNumber = din.readShort();
View Full Code Here

Examples of com.sgfj.SGFNode

        };
        int wCaptures = 44;
        int bCaptures = 39;

        SGFParser reader = new SGFParser(sgfData);
        SGFNode tree = null;
        try {
            tree = reader.parse();
        } catch (Exception e) {
            e.printStackTrace();
            fail("Unexpected!");
        }
        assertNotNull("Emty tree received.", tree);

        try {
            SGFNodeIterator ni = tree.iterator();
            while (ni.next(true) != null)
                // DO NOTHING
                ;

            DocumentedGame game = new DocumentedGame(ni.current());
View Full Code Here

Examples of com.sgfj.SGFNode

        Board board = game.board;
        try {
            assertFalse(game.prev());
            assertFalse(game.next());

            SGFNode n2w, n3b_1, n3b_2;
            // test forward/backward navigation
            game.play(3, 3, Board.BLACK);
            game.play(0, 1, Board.WHITE);
            n2w = game.kifuLastMove();
            game.play(0, 2, Board.BLACK);
View Full Code Here

Examples of com.sgfj.SGFNode

    public void testCgobanSGF() {
        try {
            String data = "(;GM[1]FF[3]SZ[4]HA[0](;AW[bb]PL[2](;W[cc])(;W[aa])))";
            SGFParser parser = new SGFParser(data);
            SGFNode tree = parser.parse();
            DocumentedGame game = new DocumentedGame(tree);
            game.next();
            assertEquals(game.board.get(1, 1), Board.WHITE);
            assertEquals(Board.WHITE, game.colorToPlay);
            game.next();
View Full Code Here

Examples of com.sgfj.SGFNode

    public void testUndoAdd() {
        try {
            String data = "(;GM[1]FF[3]SZ[4]HA[0];AW[bb]AB[aa]PL[2];W[cc]))";
            SGFParser parser = new SGFParser(data);
            SGFNode tree = parser.parse();
            DocumentedGame game = new DocumentedGame(tree);
            game.next();
            assertEquals(Board.BLACK, game.board.get(0, 0));
            assertEquals(Board.WHITE, game.board.get(1, 1));
            assertEquals(Board.NONE, game.board.get(2, 2));
View Full Code Here

Examples of com.sgfj.SGFNode

    public void testUndoAddEmpty() {
        try {
            String data = "(;GM[1]FF[3]SZ[4]HA[0];AW[bb]AB[aa]PL[2];W[cc]AE[aa]))";
            SGFParser parser = new SGFParser(data);
            SGFNode tree = parser.parse();
            DocumentedGame game = new DocumentedGame(tree);
            game.next();
            assertEquals(Board.BLACK, game.board.get(0, 0));
            assertEquals(Board.WHITE, game.board.get(1, 1));
            assertEquals(Board.NONE, game.board.get(2, 2));
View Full Code Here

Examples of com.sgfj.SGFNode

    public void testWhiteToPlay() {
        try {
            String data = "(;GM[1]FF[3]SZ[4]HA[0];W[cc])";
            SGFParser parser = new SGFParser(data);
            SGFNode tree = parser.parse();
            DocumentedGame game = new DocumentedGame(tree);
            assertEquals(Board.WHITE, game.colorToPlay);
            game.next();
            assertEquals(game.board.get(2, 2), Board.WHITE);
View Full Code Here

Examples of com.sgfj.SGFNode

    public void testKifuFirstMove() {
        try {
            String data = "(;PW[White]PB[Me]AW[cb]AW[db]AW[eb]AW[bc]AW[cc]AW[cd]AW[dd]AW[ed]AW[fd]AW[gd]AW[de]AW[fe]AW[df]AW[ef]AB[bb]AB[fb]AB[hb]AB[ac]AB[dc]AB[ec]AB[fc]AB[gc]AB[bd]AB[hd]AB[be]AB[ce]AB[ge]AB[he]AB[cf]AB[ff]AB[hf]AB[cg]AB[dg]AB[eg]AB[fg];B[](;W[ca]CR[ca](;B[ea]CR[ea];W[ab]CR[ab](;B[aa]CR[aa];W[ba]CR[ba]C[RIGHT])(;B[ad]CR[ad];W[ba]CR[ba]C[RIGHT]))(;B[ad]CR[ad];W[ea]CR[ea]C[RIGHT])(;B[ab]CR[ab];W[ea]CR[ea]C[RIGHT]))(;W[ea]CR[ea];B[ca]CR[ca](;W[ab]CR[ab];B[aa]CR[aa])(;W[da]CR[da];B[ab]CR[ab])(;W[ba]CR[ba];B[ab]CR[ab]))(;W[ab]CR[ab];B[aa]CR[aa](;W[ca]CR[ca](;B[ea]CR[ea];W[ba]CR[ba]C[RIGHT])(;B[ad]CR[ad];W[ea]CR[ea]C[RIGHT]))(;W[ea]CR[ea];B[ca]CR[ca]))(;W[ba]CR[ba];B[ab]CR[ab](;W[ca]CR[ca];B[ea]CR[ea])(;W[ea]CR[ea];B[ca]CR[ca]))(;W[da]CR[da];B[ab]CR[ab]))";
            SGFParser parser = new SGFParser(data);
            SGFNode tree = parser.parse();
            DocumentedGame game = new DocumentedGame(tree);
            SGFNode node = game.kifuFirstMove(true);
            SGFMove move = node.getMoveProperty();
            assertEquals(SGFMove.WHITE, move.color);
            assertEquals(2, move.x);
            assertEquals(0, move.y);
        } catch (Exception e) {
            e.printStackTrace();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.