Package com.barrybecker4.game.common.player

Examples of com.barrybecker4.game.common.player.Player


    @Override
    public void startNewGame()  {
        reset();
        winnerDialogShown_ = false;
        sendGameChangedEvent(null)// get the info panel to refresh with 1st players name
        Player firstPlayer = controller_.getPlayers().getFirstPlayer();

        if (firstPlayer.isSurrogate()) {
            doSurrogateMove((SurrogateMultiPlayer) firstPlayer);
        }
        else if (!firstPlayer.isHuman()) {
            controller_.computerMovesFirst();
        }
    }
View Full Code Here


    /**
     * add another row to the end of the table.
     */
    public void addRow() {
        if (deletedRows_.isEmpty()) {
            Player player = createPlayer();
            addRow(player);
        }
        else
            getPlayerModel().addRow(deletedRows_.remove(0));
    }
View Full Code Here

     */
    @Override
    protected PlayerList createPlayers() {

         PlayerList players = new PlayerList();
         players.add(new Player(createPlayerOptions(GameContext.getLabel("BLACK"),
                 GoStoneRenderer.DEFAULT_PLAYER1_COLOR), true));
         players.add(new Player(createPlayerOptions(GameContext.getLabel("WHITE"),
                 GoStoneRenderer.DEFAULT_PLAYER1_COLOR), false));
         return players;
    }
View Full Code Here

     * @return true if the computer is to make the first move.
     */
    @Override
    public boolean doesComputerMoveFirst() {
        int handicap = ((GoBoard) getBoard()).getHandicap();
        Player player1 = getPlayers().getPlayer1();
        return ((!player1.isHuman() && (handicap == 0)) ||
                (player1.isHuman() && (handicap > 0)));
    }
View Full Code Here

     * add a row based on a player object
     * @param player to add
     */
    @Override
    protected void addRow(Object player) {
        Player p = (Player) player;
        Object d[] = new Object[getNumColumns()];
        d[NAME_INDEX] = p.getName();
        d[COLOR_INDEX] = p.getColor();
        d[CASH_INDEX] = DEFAULT_CASH_AMOUNT; //p.getCash();
        d[HUMAN_INDEX] = p.isHuman();
        getPlayerModel().addRow(d);
    }
View Full Code Here

     * @param responses at the least this will be the players action that we received, but it may contain robot
     *       actions for the robots on the server that play immediately after the player.
     */
    private void doPlayerAction(GameCommand cmd, List<GameCommand> responses) {

        PlayerAction action = (PlayerAction) cmd.getArgument();
        GameContext.log(0, "ServerCmdProc: doPlayerAction (" + action + "). Surrogates to handle");
        controller_.handlePlayerAction(action);

        responses.add(cmd);

View Full Code Here

    private void startGame(OnlineGameTable table) {

        GameContext.log(0, "Now starting game on Server! "+ table);

        // Create players from the table and start.
        PlayerList players = table.getPlayers();
        assert (players.size() == table.getNumPlayersNeeded());
        PlayerList newPlayers = new PlayerList();
        for (Player player : players) {
            if (player.isHuman()) {
                newPlayers.add(player.createSurrogate(controller_.getServerConnection()));
            } else {
                newPlayers.add(player);
            }
        }
        controller_.reset();
        controller_.setPlayers(newPlayers);
View Full Code Here

    private OnlineGameTable(String name, Player owner, Player[] initialPlayers, GameOptions options) {
        name_ = name;
        owner_ = owner;
        newestHumanPlayer_ = owner;
        players_ = new PlayerList();
        gameOptions_ = options;
        players_.addAll(Arrays.asList(initialPlayers));
    }
View Full Code Here

     * Factory method to create the game controller via reflection.
     * The server should not have a ui component.
     */
    private void createController(String gameName) {

        GamePlugin plugin = PluginManager.getInstance().getPlugin(gameName);
        GameContext.loadResources(gameName);

        // for now, also create a corresponding viewer. The server should really not have knowledge of a UI component.
        // fix this by doing plugin.getModelInstance, then getting the controller from that.
        GamePanel panel  = plugin.getPanelInstance();
        panel.init(null);
        GameBoardViewer viewer = panel.getViewer();

        controller_ = viewer.getController();
    }
View Full Code Here

        GamePlugin plugin = PluginManager.getInstance().getPlugin(gameName);
        GameContext.loadResources(gameName);

        // for now, also create a corresponding viewer. The server should really not have knowledge of a UI component.
        // fix this by doing plugin.getModelInstance, then getting the controller from that.
        GamePanel panel  = plugin.getPanelInstance();
        panel.init(null);
        GameBoardViewer viewer = panel.getViewer();

        controller_ = viewer.getController();
    }
View Full Code Here

TOP

Related Classes of com.barrybecker4.game.common.player.Player

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.