Examples of SGFNode


Examples of com.sgfj.SGFNode

        }
        boolean doPass() {
            return false;
        }
        boolean doUndo() {
            SGFNode lastSetupNode = game.kifuFirstMove(true).iterator().prev(false);
            if (game.kifuLastMove() != lastSetupNode && game.prev()) {
                if (gobanCanvas.showMoveHints) {
                    setCursor(game.kifuLastMove().iterator().next(false));
                } else {
                    if (hasRespondMove && game.kifuLastMove() != lastSetupNode)
View Full Code Here

Examples of com.sgfj.SGFNode

            }
            return true;
        }
        boolean doRestart() {
            boolean notify = false;
            SGFNode lastSetupNode = game.kifuFirstMove(true).iterator().prev(false);
            while (game.kifuLastMove() != lastSetupNode && game.prev())
                notify = true;
            gobanCanvas.showMoveHints = false;
            //if (notify && gobanCanvas.showMoveHints)
            //    setCursorToNextGoodMove();
View Full Code Here

Examples of com.sgfj.SGFNode

        while (true) {
            int offset = parser.getCharsConsumed();

            // parse file to get tree
            SGFNode tree = null;
            try {
                tree = parser.parse();
            } catch (SGFEOFException e) {
                // DO NOTHING
                break;
            } catch (SGFParseError e) {
                System.out.println("Parse error " + filePath + ":" + e.getMessage());
                break;
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
                break;
            }

            Problem entry = new Problem();
            entry.subPath = subPath;

            String genre;
            try {
                genre = tree.getProperty(SGFPropertyName.GE).getText();
            } catch (SGFException e) {
                genre = "undefined";
            }
            int i = genres.indexOf(genre);
            if (i < 0) {
                i = genres.size();
                genres.addElement(genre);
            }
            entry.genre = i;

            try {
                entry.difficulty = rank2int(tree.getProperty(SGFPropertyName.DI).getText());
            } catch (SGFException e) {
                entry.difficulty = 0;
            }
            try {
                entry.difficultyP = tree.getProperty(SGFPropertyName.DP).getInt();
            } catch (SGFException e) {
                entry.difficultyP = -1;
            }
            try {
                entry.popularity = tree.getProperty(SGFPropertyName.CO).getInt();
            } catch (SGFException e) {
                entry.popularity = -1;
            }

            entry.offset = offset;
View Full Code Here

Examples of com.sgfj.SGFNode

    }

    private void checkMoveHintsProperties() {
        if (game == null)
            return;
        SGFNode head = game.kifuHead();
        if ((head.bits & (SGFNode.BAD_MOVE | SGFNode.GOOD_MOVE)) == 0)
            SGFParser.parseMoveHintsProperties(head);
    }
View Full Code Here

Examples of com.sgfj.SGFNode

    private boolean setCursorToNextGoodMove() {
        SGFNodeIterator i = game.kifuLastMove().iterator();
        if (i.next(true) != null) {
            i.firstVariant(true);
            do {
                SGFNode node = i.current();
                if ((node.bits & SGFNode.GOOD_MOVE) != 0) {
                    return setCursor(node);
                }
            } while (i.nextVariant(true) != null);
            // no good moves found, set cursor to any move
View Full Code Here

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

    }

    private void checkMoveHintsProperties() {
        if (game == null)
            return;
        SGFNode head = game.kifuHead();
        if ((head.bits & (SGFNode.BAD_MOVE | SGFNode.GOOD_MOVE)) == 0)
            SGFParser.parseMoveHintsProperties(head);
    }
View Full Code Here

Examples of com.sgfj.SGFNode

    private boolean setCursorToNextGoodMove() {
        SGFNodeIterator i = game.kifuLastMove().iterator();
        if (i.next(true) != null) {
            i.firstVariant(true);
            do {
                SGFNode node = i.current();
                if ((node.bits & SGFNode.GOOD_MOVE) != 0) {
                    return setCursor(node);
                }
            } while (i.nextVariant(true) != null);
            // no good moves found, set cursor to any move
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.