开发者

Using search to solve the 15-puzzle

I'm trying to write a 4 x 4 grid using verti开发者_如何转开发cal bars and underscore. I have a class for the puzzle, but i want to know what fields and methods i can use to represent and manipulate a configuration for the puzzle.

Reference: Fifteen puzzle


I agree, you could give more information... however, consider an approach like this:

In your puzzle class, you may have a Value[][] member for storing the values. You could do something like this

public Value get(int x, int y) {
    return values[x][y];
}

public void set(int x, int y, Value v) {
    values[x][y] = v;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜