Package org.gojul.fourinaline.model.GameModel

Examples of org.gojul.fourinaline.model.GameModel.PlayerMark


  /**
   * @see java.lang.Runnable#run()
   */
  public void run()
  {
    PlayerMark playerMark = getPlayer().getPlayerMark();
   
    // The thread stops if the server is no longer running,
    // or at the first exception encountered.
    while (isConnectedToServer())
    {
View Full Code Here


        return evalScore.evaluate(gameModel, playerMark);
      else
      {
        int bestScore = Integer.MIN_VALUE;
       
        PlayerMark tempMark = PlayerMark.getNextMark(playerMark);
       
        int alphaEval = alpha;
       
        Collection<Integer> possiblePlays = gameModel.getListOfPlayableColumns();
        List<Integer> iterationOrder = new ArrayList<Integer>(playOrder);
View Full Code Here

      gameModel.play(4, gameModel.getCurrentPlayer());
      System.out.println(gameModel);
     
      AlphaBeta alphaBeta = new AlphaBeta(new DefaultEvalScore(), 4);
     
      PlayerMark mark = gameModel.getCurrentPlayer();
     
      System.out.println(alphaBeta.getColumnIndex(gameModel, mark));
    }
View Full Code Here

     
      localGameModel = new GameModel(gameModel);
     
      gameModelDrawPanel.updateModel(localGameModel);
     
      PlayerMark mark = localGameModel.getCurrentPlayer();
     
      // We can display the current turn without any risk
      // as this has no impact on the user.
      // Thus it is important to have it up to date
      // even if the game has been updated immediately.
View Full Code Here

          int cellDestX = cellOrigX + cellWidthDraw;
          int cellDestY = cellOrigY + cellHeightDraw;
         
          Paint currentGradient = Color.WHITE;
         
          PlayerMark mark = playerMarks[i][j];
         
          if (mark != null)
            currentGradient = PlayerColorRepresentation.valueOf(mark).getPlayerPaint(cellOrigX, cellOrigY, cellDestX, cellDestY);
         
          g2d.setPaint(currentGradient);
          g2d.fillOval(cellOrigX, cellOrigY, cellWidthDraw, cellHeightDraw);
        }
      }
     
      // Marks the last inserted chip differently
      // in case the game is running.
      if (gameModel.getGameStatus().equals(GameStatus.CONTINUE_STATUS) && lastInsertedCell != null)
      {
        // The circle mark width.
        final int CIRCLE_WIDTH = 3;
        // The circle color : a kind of green.
        final Color CIRCLE_COLOR = new Color(0, 255, 100);
       
        int j = lastInsertedCell.getColIndex();
        int i = lastInsertedCell.getRowIndex();
        g2d.setColor(CIRCLE_COLOR);
       
        g2d.fillOval(cellWidth * j + CELL_BORDER_WIDTH, cellHeight * i + CELL_BORDER_WIDTH, cellWidthDraw, cellHeightDraw);
       
        PlayerMark mark = playerMarks[i][j];
        g2d.setPaint(PlayerColorRepresentation.valueOf(mark).getPlayerPaint(cellWidth * j + CELL_BORDER_WIDTH, cellHeight * i + CELL_BORDER_WIDTH,
            cellWidth * (j + 1) - CELL_BORDER_WIDTH, cellHeight * (i + 1) - CELL_BORDER_WIDTH));
       
        g2d.fillOval(cellWidth * j + CIRCLE_WIDTH + CELL_BORDER_WIDTH, cellHeight * i + CIRCLE_WIDTH + CELL_BORDER_WIDTH, cellWidthDraw - 2 * CIRCLE_WIDTH, cellHeightDraw - 2 * CIRCLE_WIDTH);
      }
 
View Full Code Here

      animationRunning = true;
     
      int cellHeight = getCellHeight();
      int cellWidth = getCellWidth();
     
      PlayerMark mark = model.getCell(last);
      int rowIndex = last.getRowIndex();
      int colIndex = last.getColIndex();
      playerMarks[rowIndex][colIndex] = null;
     
      int xLeft = colIndex * cellWidth;
 
View Full Code Here

   
    Iterator<PlayerMark> it = PlayerMark.getPlayerIterator();
   
    while (it.hasNext())
    {
      PlayerMark playerMark = it.next();     
      unusedTickets.add(new ServerTicket());
      playerMarkSemaphores.put(playerMark, new Semaphore(0));
    }
  }
View Full Code Here

    GamePlayer result = players.get(playerName);
   
    if (result == null)
    {
      // Looks for the next free mark and assigns it to the player.
      PlayerMark mark = null;
     
      Iterator<PlayerMark> it = PlayerMark.getPlayerIterator();
     
      while (it.hasNext() && mark == null)
      {
        PlayerMark markTest = it.next();
       
        if (!usedPlayerMarks.contains(markTest))
        {
          mark = markTest;
          usedPlayerMarks.add(markTest);
View Full Code Here

     */
    public void actionPerformed(final ActionEvent e)
    {
      boolean commandResult;
     
      PlayerMark currentPlayerMark = null;
     
      try
      {
        commandResult = mainFrame.gameClient.newGame();
        GameModel currentModel = mainFrame.gameClient.getGameModelImmediately();
View Full Code Here

   
    List<PlayerMark> lineValues = gameModel.getValuesOfLine(line);
   
    for (int i = 0, len = line.size(); i < len && result != 0; i++)
    {
      PlayerMark markTest = lineValues.get(i);
     
      if (markTest != null)
      {
        if (markTest.equals(playerMark))
          result = 2 * result;
        else
          result = 0;
      }
    }
View Full Code Here

TOP

Related Classes of org.gojul.fourinaline.model.GameModel.PlayerMark

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.