Examples of TwoPlayerController


Examples of com.barrybecker4.game.twoplayer.common.TwoPlayerController

     * Initialize the board based on the SGF game.
     */
    @Override
    protected void parseSGFGameInfo( SGFGame game) {

        TwoPlayerController gc = (TwoPlayerController) controller_;
        PlayerList players = gc.getPlayers();

        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;
                size = sizeToken.getSize();
            }
            else if (token instanceof KomiToken) {
                KomiToken komiToken = (KomiToken) token;
                ((GoOptions)gc.getOptions()).setKomi(komiToken.getKomi());
            }
            // so we don't guess wrong on where the handicap positions are
            // we will rely on their being an AB (add black) command to specifically tell where the handicap stones are
            /*else if (token instanceof HandicapToken) {
                HandicapToken handicapToken = (HandicapToken) token;
                GameContext.log(2,"***handicap ="+handicapToken.getHandicap());
                this.setHandicap(handicapToken.getHandicap());
            }*/
            else if (token instanceof WhiteNameToken) {
                WhiteNameToken nameToken = (WhiteNameToken) token;
                players.getPlayer2().setName(nameToken.getName());
            }
            else if (token instanceof BlackNameToken) {
                BlackNameToken nameToken = (BlackNameToken) token;
                players.getPlayer1().setName(nameToken.getName());
            }
            else if (token instanceof RuleSetToken) {
                //RuleSetToken ruleToken = (RuleSetToken) token;
                //this.setRuleSet(ruleToken.getKomi());
            }
            else {
                GameContext.log(1, "Ignoring  token =" + token.getClass().getName() + " while parsing.");
            }
        }
        ((IRectangularBoard)gc.getBoard()).setSize(size, size);
    }
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.