Package com.barrybecker4.ca.dj.jigo.sgf

Examples of com.barrybecker4.ca.dj.jigo.sgf.Point


  {
        if( st.nextToken() != (int)'[' )
            return false;
        int token = st.nextToken();

        wallPoint1 = new Point();
        wallPoint1.x =  ( coordFromChar( st.sval.charAt( 0 ) ) );
        wallPoint1.y = ( coordFromChar( st.sval.charAt( 1 ) ) );

        boolean parsed =  (st.nextToken() == (int)']' && st.nextToken() == (int)'[');

        token = st.nextToken();

        wallPoint2 = new Point();
        wallPoint2.x =  ( coordFromChar( st.sval.charAt( 0 ) ) );
        wallPoint2.y = ( coordFromChar( st.sval.charAt( 1 ) ) );

        parsed = parsed && (st.nextToken() == (int)']');
        return parsed;
View Full Code Here


        Iterator<Point> points = token.getPoints();
        // System.out.println("num points ="+token.getPoints2().size());
        boolean player1 = token instanceof AddBlackToken;

        while (points.hasNext()) {
            Point point = points.next();
            //System.out.println("adding move at row=" + point.y+" col="+ point.x);
            moveList.add( new GoMove( new ByteLocation(point.y, point.x), 0, new GoStone(player1)));
        }
    }
View Full Code Here

      // Read a point in the list of points (of which there must be at least one),
      // then add it to our internal list of points.
      // need to make a copy. otherwise we end up adding the same point to the list each time.
      if( parsePoint( st ) ) {

          addPoint( new Point(getPoint()) );
      }
    }
    while( st.nextToken() == (int)'[' );

    st.pushBack();
View Full Code Here

     */
    protected void parseSGFGameInfo( SGFGame game) {
        Enumeration e = game.getInfoTokens();
        int size = 13; // default unless specified
        while (e.hasMoreElements()) {
            InfoToken token = (InfoToken) e.nextElement();
            if (token instanceof SizeToken) {
                SizeToken sizeToken = (SizeToken)token;
                GameContext.log(2, "info token size ="+sizeToken.getSize());
                size = sizeToken.getSize();
            }
View Full Code Here

    {
        Enumeration trees = tree.getTrees();
        Enumeration leaves = tree.getLeaves();
        Enumeration tokens;
        while ( leaves != null && leaves.hasMoreElements() ) {
            SGFToken token;
            tokens = ((SGFLeaf) leaves.nextElement()).getTokens();

            boolean found = false;

            // While a move token hasn't been found, and there are more tokens to
View Full Code Here

        Enumeration e = game.getInfoTokens();
        int size = 13; // default unless specified
        while (e.hasMoreElements()) {
            InfoToken token = (InfoToken) e.nextElement();
            if (token instanceof SizeToken) {
                SizeToken sizeToken = (SizeToken)token;
                GameContext.log(2, "info token size ="+sizeToken.getSize());
                size = sizeToken.getSize();
            }
        }
        ((IRectangularBoard)controller_.getBoard()).setSize(size, size);
    }
View Full Code Here

    /**
     * create and show the server.
     */
    public static void main(String[] args) {

        CommandLineOptions options = new CommandLineOptions(args);

        if (verifyCmdLineOptions(options))  {
            String gameName = options.getValueForOption(GAME_OPTION);
            new OnlineGameServer(gameName, null);
        }
    }
View Full Code Here

    /**
     * create and show the server.
     */
    public static void main(String[] args) {

        CommandLineOptions options = new CommandLineOptions(args);

        if (OnlineGameServer.verifyCmdLineOptions(options)) {
            String gameName = options.getValueForOption(OnlineGameServer.GAME_OPTION);
            OnlineGameServerFrame frame = new OnlineGameServerFrame(gameName);
            frame.setVisible(true);
        }
    }
View Full Code Here

                token += ch;
            }
            else if (opDef.isOperator(ch)) {
                pushNodesForToken(token, nodes);
                token = "";
                nodes.add(new TreeNode(ch, opDef));
            }
            else {
                throw new Error("Unexpected character " + ch +" in expression: " + exp);
            }
            pos++;
View Full Code Here

    protected String processSubExpression(
        String exp, int pos, String token, int closingParenPos, List<TreeNode> nodes) {

        // recursive call for sub expression
        String subExp = exp.substring(pos, closingParenPos);
        TreeNode subTree = parse(subExp);
        subTree.hasParens = true;

        if (token != null && token.length() > 0) {
            // there was some leading token before the parenthesized expression.
            pushNodesForToken(token, nodes);
            token = "";
            nodes.add(new TreeNode(MathOperator.TIMES.getSymbol(), opDef));
        }
        else if (!nodes.isEmpty() && nodes.get(nodes.size() - 1).hasParens) {
            nodes.add(new TreeNode(MathOperator.TIMES.getSymbol(), opDef));
        }
        nodes.add(subTree);
        return token;
    }
View Full Code Here

TOP

Related Classes of com.barrybecker4.ca.dj.jigo.sgf.Point

Copyright © 2018 www.massapicom. 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.