Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Discussion: Go Board

Jonathan Shaftoe
... the titleless.
Join date: 11 Feb 2005
Posts: 44
12-24-2005 08:54
Some time ago I created a Go Board for Second Life. I haven't had time to do anything more with it, so now I'm releasing it for all to use, share, copy, shake their heads despairingly at the huge mess of code as appropriate.

There is too much code to post on here, and I know this breaks etiquette a bit, but I've put it on the LSL wiki, so please go there to find the code.

http://secondlife.com/badgeo/wakka.php?wakka=LibraryGoGame

Jonathan
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Original Thread
12-24-2005 12:06
/15/ed/79224/1.html
_____________________
i've got nothing. ;)
Lallander Parvenu
Registered User
Join date: 21 Apr 2005
Posts: 45
12-24-2005 15:38
Do you have a full perm version in game somewhere, that is a lot of code.
Jonathan Shaftoe
... the titleless.
Join date: 11 Feb 2005
Posts: 44
12-24-2005 17:16
it is, isn't it :) send me a message in-game and I'll send you a copy next time I'm on (can be infrequent, so be patient)
Bertha Horton
Fat w/ Ice Cream
Join date: 19 Sep 2005
Posts: 835
12-24-2005 19:02
Thanks! I love playing Go (regular patroness of the Dragon Go Server) and already have a Go board image utilized in my build (though heaven knows why; it has nothing to do with the game).
_____________________

Trapped in a world she never made!
Zarf Vantongerloo
Obscure Resident
Join date: 22 Jun 2005
Posts: 110
12-24-2005 21:08
Yay! Go players in SL! I'm quite an avid player too. I have a Go pavillion on my build - and have a half-started 400-prim go set there.... Perhaps I should put in Jonathan Shaftoe's instead!
Lallander Parvenu
Registered User
Join date: 21 Apr 2005
Posts: 45
12-24-2005 21:31
Anyone know if there is a working Shogi set out there anywhere?
Seifert Surface
Mathematician
Join date: 14 Jun 2005
Posts: 912
12-24-2005 22:39
Would there be enough interest (>= 3 people...) in a go/wei'qi/baduk group?
_____________________
-Seifert Surface
2G!tGLf 2nLt9cG
Zarf Vantongerloo
Obscure Resident
Join date: 22 Jun 2005
Posts: 110
12-24-2005 23:51
yes - I'd join a Go/Wei'Qi/Baduk group - and if I ever get my set done, I'd play in SL too!
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
12-25-2005 04:57
Unless you *really* want to build it yourself, give up and use Jon's. I've played it a few times and it's very nice, works well and pretty intuitively.

I don't have space for a spare group atm, but if there is a go group set up, please count me in for supporting it in spirit, and certainly as another player.
Aliasi Stonebender
Return of Catbread
Join date: 30 Jan 2005
Posts: 1,858
12-25-2005 09:49
From: Lallander Parvenu
Anyone know if there is a working Shogi set out there anywhere?


No, although it's one of those things I've given a passing thought. I enjoy Shogi.
_____________________
Red Mary says, softly, “How a man grows aggressive when his enemy displays propriety. He thinks: I will use this good behavior to enforce my advantage over her. Is it any wonder people hold good behavior in such disregard?”
Anything Surplus Home to the "Nuke the Crap Out of..." series of games and other stuff
Seifert Surface
Mathematician
Join date: 14 Jun 2005
Posts: 912
12-25-2005 22:23
I set up a group for go players, called "The Game of Go aka Wei'qi aka Baduk" (searching for "go" doesn't tend to work well, and sometimes people know the other names). It's open enrollment, maybe we can get some games going :)
_____________________
-Seifert Surface
2G!tGLf 2nLt9cG
Ceera Murakami
Texture Artist / Builder
Join date: 9 Sep 2005
Posts: 7,750
12-26-2005 11:04
Thank you, Jonathan! I play Go myself, and had been trying to find a playable Go game for in SL, so I can teach my Companion how to play the game!

I shall try assembling a game using the code you provided. If I get stuck, I'll contact you for a set.

*bows*
Ceera Murakami
Texture Artist / Builder
Join date: 9 Sep 2005
Posts: 7,750
12-26-2005 13:00
Well, the game seems to have assembled just fine. The instructions in the WIKI and embedded in the scripts were very good.

Looks like it takes 62 prims to rez the basic game, which isn't half bad for what it should be able to do. Any idea of the max # of prims it takes to rez the game? I would imagine that the 19x19 board takes the most.

Probably too many prims to leave it set up in my home, but I may be able to arrange for somewhere in my home sim to serve as a home for one of these boards.

I joined the Go group. Maybe we can try a game some time?
Seifert Surface
Mathematician
Join date: 14 Jun 2005
Posts: 912
12-26-2005 13:28
I think it is always 62 prims no matter the bouad size. There's a lot of cleverness with texture and prim tricks.

I have a set up in The Future (225, 50, 170).
_____________________
-Seifert Surface
2G!tGLf 2nLt9cG
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
12-27-2005 08:09
The Go board is now for "sale" (at the princely sum of $0 hence the quotes at my shop in Dimidiata 233,174,75 in the gadgets vendor.

I know this isn't the place for advertising, but it seems that telling the people that read this thread where they can find a free board in world isn't entirely irrelevant.
Bertha Horton
Fat w/ Ice Cream
Join date: 19 Sep 2005
Posts: 835
12-27-2005 20:11
Edit (original post was about the vendor not taking L$0 for items):

I got the Go board, but it's clearly not displaying all of the pieces when placed. Notice on this image there are some rectangles that are not covered; i.e. the P-S and 9-10 area.
_____________________

Trapped in a world she never made!
Rafe Phoenix
AKA Rafe Zessinthal
Join date: 15 Nov 2004
Posts: 490
Skari 230,111 Free Go board....
12-27-2005 20:33
I have had Jon's GO board out for a few days now. After reading this thread I made it buy a full perm. board for $0. Just right click and choose buy.

secondlife://Skari/230/111/112
Eloise Pasteur
Curious Individual
Join date: 14 Jul 2004
Posts: 1,952
12-28-2005 14:09
Ok, if you use llSetPayPrice you can't give it a zero sum, and even if you leave the manual pay box visible you have to pay $1 and then hope (as it does) that the vendor gives you change.

I've changed that - there is a free board available at the location, but it's in a prim of it's own whilst I consider building a freebie vendor.

The llSetPayPrice() behaviour surprised me though, ah well.
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
12-28-2005 18:28
:D you have done an excelent job.

I can see very little i would change, and that is saying alot. Recursion sends up flairs in my mind as it uses lots of memory but its hard to avoid.

I notice that "neighbour" isn't used in "recurse_check" in "GoGameLogicScript" if you remove this it will free up some memory.

actualy...

CODE

recurse_check(integer x, integer y, integer dir) {
if (gGroupType == 1 && gGroupLiberties >= 2) {
return;
}
if (gGroupType == 0 && gGroupLiberties == 1) {
return;
}
if (llListFindList(gGroup, [x + (y * gGameSize)]) != -1) {
return;
}
gGroup = gGroup + [x + (y * gGameSize)];
integer neighbour;
if (dir != 0) {
recurse_check_util(x - 1, y, 1);
}
if (dir != 1) {
recurse_check_util(x + 1, y, 0);
}
if (dir != 2) {
recurse_check_util(x, y - 1, 3);
}
if (dir != 3) {
recurse_check_util(x, y + 1, 2);
}
}

can become
CODE
recurse_check(integer x, integer y, integer dir) {
if (gGroupType != 1 || gGroupLiberties < 2) {
if (gGroupType != 0 || gGroupLiberties != 1) {
if (llListFindList(gGroup, [x + (y * gGameSize)]) == -1) {
gGroup = gGroup + [x + (y * gGameSize)];
if (dir != 0) {
recurse_check_util(x - 1, y, 1);
}
if (dir != 1) {
recurse_check_util(x + 1, y, 0);
}
if (dir != 2) {
recurse_check_util(x, y - 1, 3);
}
if (dir != 3) {
recurse_check_util(x, y + 1, 2);
}
}
}
}
}

and will save you 23 bytes of bytecode and 4 bytes of stack.
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Ceera Murakami
Texture Artist / Builder
Join date: 9 Sep 2005
Posts: 7,750
12-28-2005 18:54
What would cause the Go stones not to appear?

I made the board, following the instructions in the WIKI article. I just tried playing against someone in-world, and the stones we played didn't rez. The game board stated our moves as we made them, but didn't mark them.

Any ideas?
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
12-28-2005 19:04
This will save 12 stack bytes, and might be a bit slower. The stack savings should help with complex structures overflowing the script. The second function will save a few stack bytes when the script is getting close.

CODE
recurse_check(integer x, integer y, integer dir) {
if (gGroupType != 1 || gGroupLiberties < 2) {
if (gGroupType != 0 || gGroupLiberties != 1) {
if (llListFindList(gGroup, [x + (y * gGameSize)]) == -1) {
gGroup = gGroup + [x + (y * gGameSize)];
integer i = 0;
do
{
if(i == 1)
x += 2;
else if(i == 3)
y += 2;
else
{
--x;
if(i&2)
--y;
}
if(dir != i)
{
integer neighbour = get_board_state(x,y);
if (neighbour == gSearchColour) {
recurse_check(x, y, (5 - i) % 4);
} else if (neighbour == 0 && gGroupType != 2) {
if (x != gLibertyX || y != gLibertyY) {
gLibertyX = x;
gLibertyY = y;
gGroupLiberties++;
}
} else if ((neighbour == 2 || neighbour == 1) && gGroupType == 3) {
if (gGroupLiberties != neighbour) {
gGroupLiberties += neighbour;
}
}
}
}while(4>++i);
}
}
}
}

integer get_board_state(integer x, integer y) {
return (integer)num = llGetSubString(gGameState, x += 1 + ((y + 1) * (gGameSize + 2)), x);
}
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Seifert Surface
Mathematician
Join date: 14 Jun 2005
Posts: 912
12-28-2005 22:37
I was talking with Zarf a day or two ago - he's 10% into doing a go board, with a prim per stone. Linking would be a problem with a full size board of course, but assuming that could be worked out nicely, the recursion problem could be neatly sidestepped: Each stone keeps a list of the other stones in its connected group, and the "blank" stones which are the liberties of that group. When your liberties list is empty, you die. As long as you can consistently update this information, everything builds up step by step and it should be fast.

Counting the score at the end might be slower, but you don't care so much then, and you can still do it in a distributed fashion.
_____________________
-Seifert Surface
2G!tGLf 2nLt9cG
Seifert Surface
Mathematician
Join date: 14 Jun 2005
Posts: 912
12-28-2005 22:38
From: Ceera Murakami
What would cause the Go stones not to appear?

I made the board, following the instructions in the WIKI article. I just tried playing against someone in-world, and the stones we played didn't rez. The game board stated our moves as we made them, but didn't mark them.

Any ideas?


Maybe the board is too small? The smallest I was able to make it is SIZE = 1.0. Any smaller than that and a prim gets too thin, and possibly stuff gets hidden that shouldn't.
_____________________
-Seifert Surface
2G!tGLf 2nLt9cG
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
12-29-2005 05:53
From: Seifert Surface
I was talking with Zarf a day or two ago - he's 10% into doing a go board, with a prim per stone. Linking would be a problem with a full size board of course, but assuming that could be worked out nicely, the recursion problem could be neatly sidestepped: Each stone keeps a list of the other stones in its connected group, and the "blank" stones which are the liberties of that group. When your liberties list is empty, you die. As long as you can consistently update this information, everything builds up step by step and it should be fast.

Counting the score at the end might be slower, but you don't care so much then, and you can still do it in a distributed fashion.


There is a disadvantage to doing it with group tracking, joining groups & limits related to lists (fill a board with all one color of stone will overflow any list (if memory serves me)). A better way would be to centralize the tracking and make a map of the grid, with markers for individual groups. Using single characters in a string to represent the grid structures. When a structure was joined to another one would have it's letters changed.
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
1 2