Package kakuro.table

Examples of kakuro.table.Position


    GridLayout layout = new GridLayout(_y, _x, 1, 1);
    setLayout(layout);
    for (int j = 0; j < _y; j++) {
      for (int i = 0; i < _x; i++) {
        Gamefield g = null;
        Position pos = new Position(i, j);
        switch (table.getType(pos)) {
        case ITable.BLACK_NONE:
          g = new GamefieldNone(_gui, this, "", pos);
          break;
        case ITable.BLACK_VERTICAL:
View Full Code Here


   * @param p kiindulási pozíció
   * @return távolság jobbra
   * */
  public int getRunToRight(Position p) {
    for (int i = p.x + 1; i < _x; i++) {
      Position _p = new Position(i, p.y);
      if (_table.getType(_p) != ITable.WHITE)
        return i - p.x - 1;
    }
    return _x - p.x - 1;
  }
View Full Code Here

   * @param p kiindulási pozíció
   * @return távolság lefelé
   * */
  public int getRunToDown(Position p) {
    for (int i = p.y + 1; i < _y; i++) {
      Position _p = new Position(p.x, i);
      if (_table.getType(_p) != ITable.WHITE)
        return i - p.y - 1;
    }
    return _y - p.y - 1;
  }
View Full Code Here

   * @param p kiindulási pozíció
   * @return távolság balra
   * */
  public Position getFirstBlackToLeft(Position p) {
    for (int i = p.x - 1; i >= 0; i--) {
      if (_table.getType(new Position(i, p.y)) != ITable.WHITE)
        return new Position(i, p.y);
    }
    return new Position(0, p.y);
  }
View Full Code Here

   * @param p kiindulási pozíció
   * @return távolság felfelé
   * */
  public Position getFirstBlackToUp(Position p) {
    for (int i = p.y - 1; i >= 0; i--) {
      if (_table.getType(new Position(p.x, i)) != ITable.WHITE)
        return new Position(p.x, i);
    }
    return new Position(p.x, 0);
  }
View Full Code Here

   * @param p adott pozíció
   * @return vízszintes szó számjegyei
   * */
  public int[] getHorizontalBlock(Position p)throws TableException {
    int length;
    Position _p_sum;
   
    _p_sum = getFirstBlackToLeft(p);
    length = getRunToRight(_p_sum);
   
    int[] block = new int[length];
   
    for (int i=_p_sum.x+1; i<=_p_sum.x+length; i++) {
      Position _p = new Position(i, p.y);
      block[i-_p_sum.x-1] = _table.readCell(_p,1);
    }
   
    return block;
   
View Full Code Here

   * @param p adott pozíció
   * @return függőleges szó számjegyei
   * */
  public int[] getVerticalBlock(Position p)throws TableException {
    int length;
    Position _p_sum;

    _p_sum = getFirstBlackToUp(p);
    length = getRunToDown(_p_sum);
   
    int[] block = new int[length];
   
    for (int i=_p_sum.y+1; i<=_p_sum.y+length; i++) {
      Position _p = new Position(p.x,i);
      block[i-_p_sum.y-1] = _table.readCell(_p,1);
    }
   
    return block;
  }
View Full Code Here

   * @param positions pozíciók listája
   * */
  public void flashFields(List<Position> positions) {
    Iterator<Position> it = positions.iterator();
    while (it.hasNext()) {
      Position p = it.next();
      _fields[p.x][p.y].flash();
    }
  }
View Full Code Here

   * @param me egéresemény
   * */
  public void _mouseEntered(MouseEvent me) {
      setBackground(new Color(231, 214, 163));
    requestFocusInWindow();
    Position leftBlackPos = _table.getFirstBlackToLeft(_pos);
    Position upBlackPos = _table.getFirstBlackToUp(_pos);
    int hSum = _table.getSum(leftBlackPos, ITable.SUM_HORIZONTAL);
    int vSum = _table.getSum(upBlackPos, ITable.SUM_VERTICAL);
    int hRun = _table.getRunToRight(leftBlackPos);
    int vRun = _table.getRunToDown(upBlackPos);
    Iterator<String> h1 = _gui.getServer().getHint(hSum, hRun);
View Full Code Here

      int[] hbl = _table.getHorizontalBlock(_pos);
      int[] vbl = _table.getVerticalBlock(_pos);
      int hdig = _table.duplicatedDigitInBlock(hbl ,i);
      int vdig = _table.duplicatedDigitInBlock(vbl ,i);
      if (i > 0 && i <= 9) {
        Position h_p_sum =  _table.getFirstBlackToLeft(_pos);
        Position v_p_sum =  _table.getFirstBlackToUp(_pos);
        int h_length = _table.getRunToRight(h_p_sum);
        int v_length = _table.getRunToDown(v_p_sum);       
          _value = "" + c; 
          _table.getModel().writeCell(_pos, i,ITable.VALUE_NORMAL);
          if (hdig != -1){
View Full Code Here

TOP

Related Classes of kakuro.table.Position

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.