Please, please, please, please do not top-post.
Do not use TAB indentation in Usenet posts. Use (roughly) two spaces per
indent level.
Do not use TAB indentation in Usenet posts.
> The hole function:
>
> The game of go:
> http://www.nihonkiin.or.jp/howto/htm-e/howto1.htm
>
> Board (one times static, one times local) is an array which represents a
What does "one times static, one times local" mean?
> goboard (states could be: ".", "w", "b").
> hasLiberties returns the number of liberties one element of Board has.
Is this homework?
> CODE:
> ==========================================================================================================
>
> @SuppressWarnings("static-access")
Why are you suppressing instead of fixing this warning?
Nearly always, use of @SuppressWarnings is a dodge to avoid fixing something
that needs to be fixed. Suppressing the warning means leaving a bug in the
code on purpose.
Do you really want to leave a bug in your code on purpose?
> static public void updateBoard() {
Why are you doing this as a static method? It would be much better as an
instance method.
> Coor c;
> int f = 0;
Throw 'f' away. Don't use it.
> Game g = new Game();
You start a new Game every time you update the Board?
'g' is a lousy variable name here. It communicates absolutely nothing about
the nature of the variable.
> for (int k = 0; k < 361; k++) {
> visited[k] = false;
What is 'visited'?
You need very badly to read <http://pscode.org/sscce.html> and study its lesson.
> }
>
[quoted text clipped - 7 lines]
> f = 0; // should
> catch the condition; bp is set here
Throw away this entire 'if' clause.
> }
> if (Game.hasLiberties(c, Game.getColor(c.x, c.y)) <
> 1) { // ...this; step-in mode on debugger go into the
Since you just created an instance of Game, why are you now ignoring that
instance and using static methods?
> //function
> g.Board[coorToInt(c)] = ".";
Now, hey, presto! you are using 'g', the instance. How in blazes will 'Board'
(which should be spelled with a lower-case first letter!) ever contain a
meaningful value?
The method 'coorToInt()'
<http://pscode.org/sscce.html>
is not shown, although if its name is accurate we know what it intends to do.
> } else {
> g.Board[coorToInt(c)] = Game.Board[coorToInt(c)];
There's a useful assignment! Not.
Another thing, that shouldn't be 'coorToInt(c)', that should be set up so you
call 'c.toInt()'.
> }
> }
> }
> Game.Board = g.Board;
This is wrong, wrong, wrong. You should never name a static variable and an
instance variable the same.
And spell your variables correctly.
<http://java.sun.com/docs/codeconv/index.html>
> }
> ===========================================================================================================
>
> :EDOC

Signature
Lew
This post contains nine questions. You will know that you answered all of
them by whether you gave nine answers.
Lew - 05 Jul 2008 15:28 GMT
Global667 wrote:
>> Coor c;
...
>> for (int i = 1; i < 20; i++) {
>> for (int j = 1; j < 20; j++) {
>> c = new Coor(i, j);
I recommend this idiom instead:
for (int i = 1; i < 20; i++)
{
for (int j = 1; j < 20; j++)
{
Coor c = new Coor(i, j);

Signature
Lew