Exemplo n.º 1
0
 /**
  * Insert Token reference to Board.
  *
  * @param b Board Object.
  * @param t Input Token reference.
  * @param row Insert position in Board.
  * @param col Insert position in Board.
  */
 public void insertToken2Board(Board b, Token t, int row, int col) {
   if (t instanceof PlayerToken) {
     PlayerToken ct = (PlayerToken) t;
     ct.setRow(row);
     ct.setCol(col);
   }
   int index = row * this.N + col;
   b.BoardTokens[index] = t;
 }
Exemplo n.º 2
0
 public void takeToken(Board board, PlayerToken tkn) {
   int tmpc = tkn.getCol();
   int tmpr = tkn.getRow();
   // if a token loses in an attack, move it away from board:
   tkn.setCol(-1);
   tkn.setRow(-1);
   // place in its place plain, ol' vanilla grass:
   this.insertToken2Board(board, StrategoBoard.grassToken, tmpr, tmpc);
 }