Package engine

Examples of engine.Scheme$Move


  {
          IRTree2.Exp e = n.e.accept(this).unEx();
      ExpList params = new ExpList(e, null);
      Temp t = new Temp();
     
      return new Ex(new ESEQ(new MOVE(new TEMP(t), currFrame.externalCall("newArray", params)),
              new TEMP(t)));
  }
View Full Code Here


                        return new ExpList(src, null);
        }

        public Stm build(ExpList kids) {
                if (dst instanceof MEM)
                        return new MOVE(new MEM(kids.head), kids.tail.head);
                else
                        return new MOVE(dst, kids.head);
        }
View Full Code Here

   *
   * @param destinationBoard
   * @return the scheme with generated blocks
   */
  public static Scheme generateBlocks(Board destinationBoard) {
    Scheme s = new Scheme(new Board(destinationBoard));
    int mix = rand.nextInt(NUM_COMBINATIONS);
    mix = COMBINATION_2H;
    generateBlock(mix, s);
    return s;
  }
View Full Code Here

   * @param pbb - probability of moving a block
   * @param originalScheme - the scheme, which contains the board
   * @return scheme with the new board and the moves
   */
  public static Scheme generateEquivalent(double pbb, Scheme originalScheme) {
    Scheme s = new Scheme(new Board(originalScheme.start));
   
    int width = s.start.width, height = s.start.height;
    int[] rows = MixGenerator.randomPermutation(height);
    for (int y : rows) {
      int[] columns = MixGenerator.randomPermutation(width);
      boolean[] row = new boolean[width];
      for(int x : columns)
        if (!row[x] && rand.nextDouble() < pbb)
          row[moveBlock(x, y, false, s)] = true;
    }
    s.optimizeMoves();
    return s;
  }
View Full Code Here

   * @param pbb - probability of moving a block
   * @param originalScheme - the given scheme
   * @return scheme with the new board and the moves
   */
  public static Scheme generatePrevious(double pbb, Scheme originalScheme) {
    Scheme s = new Scheme(new Board(originalScheme.start));
    int width = s.start.width, height = s.start.height;
   
    for (int y = 0; y < height; y++) {
      int[] columns = MixGenerator.randomPermutation(width);
      boolean[] row = new boolean[width];
      for(int x : columns)
        if (!row[x] && rand.nextDouble() < pbb)
          row[moveBlock(x, y, true, s)] = true;
    }
    s.optimizeMoves();   
    return s;
  }
View Full Code Here

    taDesc.setText(originalScheme.getDesc());
  }
 
  public void actionPerformed(ActionEvent ev) {
    if (ev.getSource() == btOK) {
      Scheme newScheme = new Scheme(originalScheme);
      newScheme.setDesc(taDesc.getText());
      dialogResult(newScheme);
      dialogDone();
    } else
    if (ev.getSource() == btCancel) {
      dialogCanceled();
View Full Code Here

    Board newBoard = BoardManager.getResized(originalScheme.start,
        (Integer)spWidth.getValue(),(Integer)spHeight.getValue(),
        shiftx,shifty);
    newBoard.doFramesToStability();
    // Construct new scheme
    Scheme newScheme = new Scheme(originalScheme);
    ListIterator<Move> iterator = newScheme.moves.listIterator();
    while (iterator.hasNext()) {
      Move move = iterator.next();
      move.x += shiftx;
      move.y += shifty;
    }
    newScheme.setStart(newBoard);
    // Set as a new result
    this.dialogResult(newScheme);
  }
View Full Code Here

  }
 
  @Override
  public void setScheme(Scheme originalScheme) {
    super.setScheme(originalScheme);
    currentScheme = new Scheme(originalScheme);
  }
View Full Code Here

  @Override
  public void actionPerformed(ActionEvent ev) {
   
    if (ev.getSource() == btGenerateBlocks) {
      for (int i = 0; i < (Integer)spIterationNumber.getValue(); i++) {
        Scheme newScheme = BlocksGenerator.generateBlocks(currentScheme.start);
        newScheme.appendMoves(currentScheme);currentScheme = newScheme;
       
        newScheme = MixGenerator.generatePrevious(
            (Double)spPreviouPbb.getValue(), currentScheme);
        newScheme.appendMoves(currentScheme); currentScheme = newScheme;
       
        newScheme = MixGenerator.generateEquivalent(
            (Double)spEquivalentPbb.getValue(), currentScheme);
        newScheme.appendMoves(currentScheme); currentScheme = newScheme;
      }
      currentScheme.optimizeMoves();
      dialogResult(currentScheme);
     
    } else     
    if (ev.getSource() == btGenerateEquivalent) {
      Scheme mixedScheme = MixGenerator.generateEquivalent(
          (Double)spEquivalentPbb.getValue(), currentScheme);
      mixedScheme.appendMoves(currentScheme);
      currentScheme = mixedScheme;
      dialogResult(currentScheme);
    } else
    if (ev.getSource() == btGeneratePrevious) {
      Scheme mixedScheme = MixGenerator.generatePrevious(
          (Double)spPreviouPbb.getValue(), currentScheme);
      mixedScheme.appendMoves(currentScheme);
      currentScheme = mixedScheme;
      dialogResult(currentScheme);
    } else
    if (ev.getSource() == btOriginalScheme) {
      currentScheme = originalScheme;
View Full Code Here

        (Double)spLava.getValue(), (Double)spElevator.getValue(),
        (Double)spPainter.getValue(), (Double) spSolidConcrete.getValue());
    if (chRemoveSurroundedSolids.isSelected()) BoardManager.removeSurroundedSolids(newBoard);
    if (chCohesion.isSelected()) BoardManager.makeConnected(newBoard);
    generated = true;
    dialogResult(new Scheme(newBoard));
  }
View Full Code Here

TOP

Related Classes of engine.Scheme$Move

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.