Package ee.ttu.cs.iti0011.iabb104231.k1.Board

Examples of ee.ttu.cs.iti0011.iabb104231.k1.Board.Board


public class MockupPlayer extends AbstractPlayer
{
  public MockupPlayer()
  {
    super();
    setStorage(new IntegersMapStateStorage());
  }
View Full Code Here


      throw new PlayerCantMoveTwice(player);
    }
   
    // It's not your turn
    if (!player.equals(whoIsNext())) {
      throw new NotYourMove(player);
    }
   
    // It's already taken
    if (!getStorage().cellIsEmpty(cell)){
      throw new PositionIsAlreadyTaken();
View Full Code Here

    if (!getStorage().cellIsEmpty(cell)){
      throw new PositionIsAlreadyTaken();
    }
   
    if (cell < 1 || cell > 9){
      throw new NumberOutOfRange();
    }
   
      getStorage().registerPlayerMove(player, cell);
      for(Map.Entry<AbstractPlayer, AbstractStateStorage> entry: storages.entrySet())
      {
View Full Code Here

      return;
    }
   
    // player can't move twice
    if (lastMove != null && player.equals(lastMove)) {
      throw new PlayerCantMoveTwice(player);
    }
   
    // It's not your turn
    if (!player.equals(whoIsNext())) {
      throw new NotYourMove(player);
View Full Code Here

   * @throws PlayerNotSet
   */
  public void movesFirst(AbstractPlayer player) throws PlayerNotSet
  {
    if (!players.contains(player)) {
      throw new PlayerNotSet(player);
    }
  }
View Full Code Here

      throw new NotYourMove(player);
    }
   
    // It's already taken
    if (!getStorage().cellIsEmpty(cell)){
      throw new PositionIsAlreadyTaken();
    }
   
    if (cell < 1 || cell > 9){
      throw new NumberOutOfRange();
    }
View Full Code Here

 
    // Create AI players. Choose AIStrategy.
    // For now we test simple strategy - dumb - random cell picking
    // and CertainCellsFirst strategy - this is for 1 part.
//    AIPlayer ai1 = new AIPlayer(new Dumb(), "AI - Dumbas");
    AIPlayer ai2 = new AIPlayer(new CertainCellsFirstStrategy(), "AI - 2 lisaosa");
//    AIPlayer ai2 = new AIPlayer(new SimpleAi(), "AI - 2 lisaosa");
    AIPlayer ai1 = new AIPlayer(new SimpleAi(), "AI - 1");
//    HumanPlayer ai1 = new HumanPlayer("Priit");
//    HumanPlayer ai2 = new HumanPlayer("Eugeni");
//    AIPlayer ai2 = new AIPlayer(new Dumb(), "AI - 2");
//    AIPlayer ai2 = new AIPlayer(new Dumb(), "AI - 2");
View Full Code Here

 
    // Create AI players. Choose AIStrategy.
    // For now we test simple strategy - dumb - random cell picking
    // and CertainCellsFirst strategy - this is for 1 part.
//    AIPlayer ai1 = new AIPlayer(new Dumb(), "AI - Dumbas");
    AIPlayer ai2 = new AIPlayer(new CertainCellsFirstStrategy(), "AI - 2 lisaosa");
//    AIPlayer ai2 = new AIPlayer(new SimpleAi(), "AI - 2 lisaosa");
    AIPlayer ai1 = new AIPlayer(new SimpleAi(), "AI - 1");
//    HumanPlayer ai1 = new HumanPlayer("Priit");
//    HumanPlayer ai2 = new HumanPlayer("Eugeni");
//    AIPlayer ai2 = new AIPlayer(new Dumb(), "AI - 2");
View Full Code Here

    // For now we test simple strategy - dumb - random cell picking
    // and CertainCellsFirst strategy - this is for 1 part.
//    AIPlayer ai1 = new AIPlayer(new Dumb(), "AI - Dumbas");
    AIPlayer ai2 = new AIPlayer(new CertainCellsFirstStrategy(), "AI - 2 lisaosa");
//    AIPlayer ai2 = new AIPlayer(new SimpleAi(), "AI - 2 lisaosa");
    AIPlayer ai1 = new AIPlayer(new SimpleAi(), "AI - 1");
//    HumanPlayer ai1 = new HumanPlayer("Priit");
//    HumanPlayer ai2 = new HumanPlayer("Eugeni");
//    AIPlayer ai2 = new AIPlayer(new Dumb(), "AI - 2");
//    AIPlayer ai2 = new AIPlayer(new Dumb(), "AI - 2");
View Full Code Here

   
    Integer i = 0;
    while(!isFinished() && i < 10)
    {
      getRenderer().render();
      AbstractPlayer nextPlayer = whoIsNext();
      try{
        makeMove(nextPlayer, nextPlayer.yourNextMove());
      } catch(Exception e){
        output("ERROR !!!");
        output(e.getMessage());
        output(e.toString());
        e.printStackTrace();
View Full Code Here

TOP

Related Classes of ee.ttu.cs.iti0011.iabb104231.k1.Board.Board

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.