Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm currently working on creating a gui for a futoshiki game in java.

The default constructor for the game is as follows:

public Futoshiki() {
int row, col;
cells = new Cell[SETSIZE+1][SETSIZE+1];
for (row=1; row<=SETSIZE; row++)
  for (col=1; col<=SETSIZE; col++)
    cells[row][col] = new Cell(this, row, col);

// row constraints
rc = new Constraint[SETSIZE+1];
for (row=1; row<=SETSIZE; row++) {
  rc[row] = new Constraint();
  for (col=1; col<=SETSIZE; col++) {
    rc[row].add(cells[row][col]);
    cells[row][col].addConstraint(rc[row]);
  }
}

// column constraints
cc = new Constraint[SETSIZE+1];
for (col=1; col<=SETSIZE; col++) {
  cc[col] = new Constraint();
  for (row=1; row<=SETSIZE; row++) {
    cc[col].add(cells[row][col]);
    cells[row][col].addConstraint(cc[col]);
  }
}

// relations
rs = new Vector<Relation>();
}

This results in a 5x5 grid of cells for numbers, with additional cells for relations in between each similar to below. 5x5 futoshiki

so far I've been able to create a 5x5 with the number cells using 2 classes - one class for the entire grid and another for the number cells.

I believe the constraints are there simply to implement the rules of the game.

I'm wondering can I create the additional relation cells using 2 classes I have or should I create another class for the relation cells?

If I do create another class my concern is trying to implement all the relation class functionality


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
131 views
Welcome To Ask or Share your Answers For Others

1 Answer

等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...