Examples of Square


Examples of labyrinth.grid.Square

 
  /**
   * Add the current room to the triggered trapped room if it is trapped.
   */
  public void updateTraps() {
    Square c = (Square) bob.getLocation();
    if ((!visitedTrappedRooms.contains(c)) &&
        ((VertexRoom) c).getDamage()>0)
    {
      // Add the room.
      visitedTrappedRooms.add(c);
View Full Code Here

Examples of nl.nuggit.words.board.Square

  }

  public void play() {
    int tilePosition = startPosition;
    for (Tile tile : tiles) {
      Square square = line.getSquares()[tilePosition];
      Tile boardTile = square.getTile();
      if (boardTile == null) {
        square.setTile(tile);
      } else if (boardTile != tile) {
        throw new IllegalStateException(String.format(
            "Tile mismatch board:%s, word:%s", boardTile, tile));
      }
      tilePosition++;
View Full Code Here

Examples of nl.nuggit.words.board.Square

    Word word = new Word(line, position);
    int score = 0;
    int wordFactor = 1;
    for (int wordIndex = 0; wordIndex < candidate.length(); wordIndex++) {
      Character symbol = candidate.charAt(wordIndex);
      Square square = line.getSquares()[position + wordIndex];
      Tile tile = square.getTile();
      int letterValue;
      if (tile != null) {
        if (tile.getLetter().getSymbol().equals(symbol)) {
          // matching tile on the board
          boardTileUsed = true;
          word.getTiles().add(tile);
          letterValue = tile.getLetter().getValue();
        } else {
          // tile mismatch on board
          fullMatch = false;
          break;
        }
      } else {
        Letter letter = language.getLetter(symbol);
        if (trayCopy.remove(symbol)) {
          // we place a matching tile
          tilesTakenFromTray++;
          word.getTiles().add(new Tile(letter));
          Booster booster = square.getBooster();
          letterValue = letter.getValue();
          if (booster != null) {
            letterValue = letterValue * booster.letterFactor();
            wordFactor = wordFactor * booster.wordFactor();
          }
 
View Full Code Here

Examples of org.foo.shape.square.Square

          public void windowClosing(WindowEvent evt) {
            System.exit(0);
          }
        });
        frame.addShape(new Circle());
        frame.addShape(new Square());
        frame.addShape(new Triangle());
        frame.setVisible(true);
      }
    });
  }
View Full Code Here

Examples of org.jquantlib.math.functions.Square

    }

    private void testSeveral(final Integrator I) {
        testSingle(I, "f(x) = 1",      new Constant(1.0),               0.0, 1.0, 1.0);
        testSingle(I, "f(x) = x",      new Identity(),                  0.0, 1.0, 0.5);
        testSingle(I, "f(x) = x^2",    new Square(),                    0.0, 1.0, 1.0/3.0);
        testSingle(I, "f(x) = sin(x)", new Sin(),                       0.0, Constants.M_PI, 2.0);
        testSingle(I, "f(x) = cos(x)", new Cos(),                       0.0, Constants.M_PI, 0.0);
        testSingle(I, "f(x) = Gaussian(x)", new NormalDistribution(), -10.0, 10.0, 1.0);

//TODO: http://bugs.jquantlib.org/view.php?id=452
View Full Code Here

Examples of org.jquantlib.math.functions.Square

    public double variance() {
        final int n = getSampleSize();
        QL.require(n >= 1 , unsufficient_sample_size);

        final List<Ops.DoubleOp> functions = new ArrayList<Ops.DoubleOp>();
        functions.add(new Square());
        functions.add(new Bind2nd(new Minus(), mean()));
        final Expression comp = new Expression(functions);

        // Evaluate the composed function in the specified range (ie. everyWhere).
        final double s2 = expectationValue(comp, new TruePredicate()).getFirst();
View Full Code Here

Examples of org.jquantlib.math.functions.Square

     */
    public double regret(final double target){
        // average over the range below the target

        final List<Ops.DoubleOp> functions = new ArrayList<Ops.DoubleOp>();
        functions.add(new Square());
        functions.add(new Bind2nd(new Minus(), target));
        final Expression comp = new Expression(functions);
        final Ops.DoublePredicate less = new Bind2ndPredicate(new LessThanPredicate(), target);

        final Pair<Double, Integer> result = statistics.expectationValue(comp, less);
View Full Code Here

Examples of org.jquantlib.math.functions.Square

        QL.require(N > 1, "sample number <=1, unsufficient");
        // Subtract the mean and square. Repeat on the whole range.
        // Hopefully, the whole thing will be inlined in a single loop.
        /*@Real*/ final double s2 = expectationValue(
            new ComposedFunction(
                new Square(), new Bind2nd(
                    new Minus(), mean())),
                                   new Everywhere()).first();
        return s2*N/(N-1.0);
    }
View Full Code Here

Examples of org.jquantlib.math.functions.Square

   */
  public /*@Real*/ double regret(final /*@Real*/ double target) /*@ReadOnly*/ {
    // average over the range below the target

    final List<Ops.DoubleOp> functions = new ArrayList<Ops.DoubleOp>();
    functions.add(new Square());
    functions.add(new Bind2nd(new Minus(), target));
    final Expression comp = new Expression(functions);
    final Ops.DoublePredicate less = new Bind2ndPredicate(new LessThanPredicate(), target);

    final Pair<Double, Integer> result = expectationValue(comp, less);
View Full Code Here

Examples of org.jquantlib.math.functions.Square

    }

    private void testSeveral(final Integrator I) {
        testSingle(I, "f(x) = 1",      new Constant(1.0),               0.0, 1.0, 1.0);
        testSingle(I, "f(x) = x",      new Identity(),                  0.0, 1.0, 0.5);
        testSingle(I, "f(x) = x^2",    new Square(),                    0.0, 1.0, 1.0/3.0);
        testSingle(I, "f(x) = sin(x)", new Sin(),                       0.0, Constants.M_PI, 2.0);
        testSingle(I, "f(x) = cos(x)", new Cos(),                       0.0, Constants.M_PI, 0.0);
        testSingle(I, "f(x) = Gaussian(x)", new NormalDistribution(), -10.0, 10.0, 1.0);

//TODO: http://bugs.jquantlib.org/view.php?id=452
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.