Package Board

Examples of Board.Board


    panJ1.setBorder(BorderFactory.createLineBorder(Color.BLACK));
    panJ2.setBorder(BorderFactory.createLineBorder(Color.BLACK));

    // creation du plateau et de son affichage
    damier = new JPanel(new GridLayout(Board.LINES, Board.COLUMNS));
    Board initBoard = new Board();
    for (int i = 0; i < Board.LINES; i++) {
      for (int j = 0; j < Board.COLUMNS; j++) {
        damier.add(initBoard.getCase(i, j));
        initBoard.getCase(i, j).setPan(damier);
        initBoard.getCase(i, j).setFrame(this);
      }
    }
    damier.setBackground(Color.BLACK);
    damier.setBorder(BorderFactory.createLineBorder(Color.BLACK, 3));
    // creation du panel des affichages de informations du d�roulement du
View Full Code Here


  public void initEngine(Race race1, Race race2) {
    remove(damier);
    engine = new Engine(race1, race2, this);
    damier.removeAll();
    Board initBoard = engine.getBoard();
    for (int i = 0; i < Board.LINES; i++) {
      for (int j = 0; j < Board.COLUMNS; j++) {
        damier.add(initBoard.getCase(i, j));
        initBoard.getCase(i, j).setPan(damier);
        initBoard.getCase(i, j).setFrame(this);
        initBoard.getCase(i, j).setEngine(engine);
      }
    }
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.BOTH;
    c.gridx = 0;
View Full Code Here

  Random luck;
  MainFrame display;

  public Engine(Race j1, Race j2, MainFrame mainFrame) {
    display = mainFrame;
    board = new Board();
    J1 = new Player(j1);
    J2 = new Player(j2);
    initCharacters(board, j1, j2);
    J1turn = true;
    J1.stackToken();
View Full Code Here

     * Constructor for objects of class MakeSomePieces
     */
    public MakeSomePieces()
    {
        // initialise instance variables
        board = new Board(20, 10);
    }
View Full Code Here

      System.err.println("Usage: tetanus [nmRows nmCols]");
      System.exit(1);
    }
   
    // Create the board
    board = new Board(dimensions[0], dimensions[1]);
   
    // Start the game itself
    play();
  }
View Full Code Here

    MockupPlayer u1 = new MockupPlayer();
    MockupPlayer u2 = new MockupPlayer();
    u1.setName("mockup 1");
    u2.setName("mockup 2");

    Board b = new Board();
    b.addPlayer(u1);
    b.addPlayer(u2);
   
    try{
      b.makeMove(u1, 1);
      b.makeMove(u1, 1);
    } catch(PlayerCantMoveTwice e){
      throw e;
    } catch(Exception j){
      throw j;
    }
View Full Code Here

    MockupPlayer u1 = new MockupPlayer();
    MockupPlayer u2 = new MockupPlayer();
    u1.setName("mockup 1");
    u2.setName("mockup 2");

    Board b = new Board();
    b.addPlayer(u1);
    b.addPlayer(u2);
   
    try{
      b.makeMove(u1, 1);
      b.makeMove(u2, 1);
    } catch(PositionIsAlreadyTaken e){
      throw e;
    } catch(Exception j){
      throw j;
    }
View Full Code Here

  public void cellNumberOutOfRange() throws NumberOutOfRange, Exception
  {
    MockupPlayer u1 = new MockupPlayer();
    u1.setName("mockup 1");

    Board b = new Board();
    b.addPlayer(u1);
   
    try{
      b.makeMove(u1, 11);
    } catch(NumberOutOfRange e){
      throw e;
    } catch(Exception j){
      throw j;
    }
View Full Code Here

   
  }
 
  public void render()
  {
    Board b = getBoard();
    LineSeparator l = new LineSeparator();
    Row r = new Row();
   
    l.render();
    r.render(cell(b.occupiedBy(1)), cell(b.occupiedBy(2)), cell(b.occupiedBy(3)));
    l.render();
    r.render(cell(b.occupiedBy(4)), cell(b.occupiedBy(5)), cell(b.occupiedBy(6)));
    l.render();
    r.render(cell(b.occupiedBy(7)), cell(b.occupiedBy(8)), cell(b.occupiedBy(9)));
    l.render();
  }
View Full Code Here

//    HumanPlayer ai2 = new HumanPlayer("Eugeni");
//    AIPlayer ai2 = new AIPlayer(new Dumb(), "AI - 2");
//    AIPlayer ai2 = new AIPlayer(new Dumb(), "AI - 2");

    // Will create board and add those users here.
    Board b = new Board();
    b.addPlayer(ai1);
    b.addPlayer(ai2);
   
    // Here will create renderer - how the user will see the game.
    // For now the console version is implemented.
    ConsoleRenderer c = new ConsoleRenderer();
   
    // will set marks for users - first user will get X
    // the second one will get O
    // We can set what ever you want - only one char allowed
    c.setPlayerRenderingString(ai1, "o");
    c.setPlayerRenderingString(ai2, "-");
    b.setRenderer(c);
   
//    for(int i=1; i<10; i++) {
//      b.output(i + " : " + Long.toString(b.cellToByte(i).toLongArray()[0], 2));
//    }

    // Starts the game...
    // Now workflow is given to the board and it will manage the game.
    b.startTheGame();
  }
View Full Code Here

TOP

Related Classes of 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.