It is currently Tue Apr 16, 2024 4:07 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 12 posts ] 
Author Message
Offline
 Post subject: A diagram combination extension
Post #1 Posted: Fri Feb 17, 2012 2:28 pm 
Tengen

Posts: 4380
Location: North Carolina
Liked others: 499
Was liked: 733
Rank: AGA 3k
GD Posts: 65
OGS: Hyperpape 4k
I have written some javascript that takes a bunch of ASCII diagrams and stiches them together into a single SGF. It tries to the do the "right thing" with variations and positions that may be reached from each other*, so that you can get a single game tree from all the diagrams for a Malkovitch game.

I've also written functions that suck up all the diagrams from an entire L19 thread, and one that sticks the resulting sgf into a new window as an eidogo player.

This is all wrapped up as a Chrome extension, is about ready to be released for use.

My question for the admins is about the load on the server. Every time it's invoked, the extension requests every page that's in the thread. Seems like that could be obnoxious.

So I could:
a) publicly release the extension in single page mode without the ability to suck up a whole thread.
b) release it, but tell people to behave by saving and posting the SGF when they use it.
c) just give it to admins/moderators or whatever,
d) investigate storing the data so that every time you visit a L19 thread, the extension passively stores the data it wants, and only requests pages when it needs to do so. This is probably the best long-term solution, but I don't know the relevant APIs. I'd like to learn them, but sometimes I'm a bit slow. It also requires somehow handling cases when you need to update data thanks to an edit to a pre-existing page.

* Right now, this works whether or not move numbers are used or are accurate, but doesn't work if there's a gap where multiple moves are added. That shouldn't be too hard to fix.

I forget exactly how it handles transpositions, but I know the answer is "not intelligently".

Those caveats make it a good time to mention that I'm a total amateur, I've been programming for less than two years, and this is my first project in javascript. Please, be gentle when you see this code. I know it's not very good.

_________________
Occupy Babel!


This post by hyperpape was liked by 2 people: daniel_the_smith, jts
Top
 Profile  
 
Offline
 Post subject: Re: A diagram combination extension
Post #2 Posted: Wed Feb 22, 2012 10:08 am 
Judan
User avatar

Posts: 5539
Location: Banbeck Vale
Liked others: 1103
Was liked: 1456
Rank: 1D AGA
GD Posts: 1512
Kaya handle: Test
Thanks for asking. It doesn't seem to be much of a problem.

My suggestion would be to have it automatically append the SGF to the end of the thread when it is done. ( And maybe send an automatic PM to your local admin so that he can transfer the SGF to the first post to make it easy to find. )

If the output is saved and clearly available at the beginning of a thread, then it would only have to be run once per game. Even if someone wants to generate an SGF for every Malkovich game, it would only have to be run less than two hundred times.
At worst, it it is a hog, you could write delays in between successive calls to make it play nice.

_________________
Help make L19 more organized. Make an index: https://lifein19x19.com/viewtopic.php?f=14&t=5207

Top
 Profile  
 
Offline
 Post subject: Re: A diagram combination extension
Post #3 Posted: Wed Feb 22, 2012 2:16 pm 
Gosei
User avatar

Posts: 1585
Location: Barcelona, Spain (GMT+1)
Liked others: 577
Was liked: 298
Rank: KGS 5k
KGS: RBerenguel
Tygem: rberenguel
Wbaduk: JohnKeats
Kaya handle: RBerenguel
Online playing schedule: KGS on Saturday I use to be online, but I can be if needed from 20-23 GMT+1
Does it also suck the comments? Getting the text from Malkovich games and generating commented SGF files would be terrific for study purposes.

_________________
Geek of all trades, master of none: the motto for my blog mostlymaths.net

Top
 Profile  
 
Offline
 Post subject: Re: A diagram combination extension
Post #4 Posted: Wed Feb 22, 2012 2:32 pm 
Judan
User avatar

Posts: 5539
Location: Banbeck Vale
Liked others: 1103
Was liked: 1456
Rank: 1D AGA
GD Posts: 1512
Kaya handle: Test
RBerenguel wrote:
Does it also suck the comments? Getting the text from Malkovich games and generating commented SGF files would be terrific for study purposes.


Unfortunately, many comments have diagrams in them. That would be some really tricky proramming to build the full SGF tree.

_________________
Help make L19 more organized. Make an index: https://lifein19x19.com/viewtopic.php?f=14&t=5207

Top
 Profile  
 
Offline
 Post subject: Re: A diagram combination extension
Post #5 Posted: Wed Feb 22, 2012 2:34 pm 
Gosei
User avatar

Posts: 1585
Location: Barcelona, Spain (GMT+1)
Liked others: 577
Was liked: 298
Rank: KGS 5k
KGS: RBerenguel
Tygem: rberenguel
Wbaduk: JohnKeats
Kaya handle: RBerenguel
Online playing schedule: KGS on Saturday I use to be online, but I can be if needed from 20-23 GMT+1
I guessed Joaz, but dreaming is possible ;)

_________________
Geek of all trades, master of none: the motto for my blog mostlymaths.net

Top
 Profile  
 
Offline
 Post subject: Re: A diagram combination extension
Post #6 Posted: Fri Mar 16, 2012 8:06 pm 
Tengen

Posts: 4380
Location: North Carolina
Liked others: 499
Was liked: 733
Rank: AGA 3k
GD Posts: 65
OGS: Hyperpape 4k
The Sunday after I posted, my father in law/boss told me that work was about to get hectic. And he was right.

And then bugs bugs bugs bugs! I really didn't plan out what I was doing, just wrote bits of code, so I ended up with a horrible Frankenstein monster. Many bugs are fixed, but there are still some cases where the extension does the wrong thing, so no release. But it's doing the right thing with at least some Malkovitch games, so I can try and get you any particular game that you want I'll try.

P.S. (I miss strong typing. And I maybe even want static typing)

P.P.S (The postscript got me to reading, and introduced a faint bit of doubt about the terms. But forget terms. Whatever it is that you call it when Javascript gives you undefined when you lookup foo.attributeThatFooDoesntHave is one of the things that I dislike.)

_________________
Occupy Babel!

Top
 Profile  
 
Offline
 Post subject: Re: A diagram combination extension
Post #7 Posted: Fri Mar 16, 2012 10:43 pm 
Judan
User avatar

Posts: 5539
Location: Banbeck Vale
Liked others: 1103
Was liked: 1456
Rank: 1D AGA
GD Posts: 1512
Kaya handle: Test
hyperpape wrote:
...(I miss strong typing. And I maybe even want static typing)...


http://www.freepascal.org.

_________________
Help make L19 more organized. Make an index: https://lifein19x19.com/viewtopic.php?f=14&t=5207

Top
 Profile  
 
Offline
 Post subject: Re: A diagram combination extension
Post #8 Posted: Mon Mar 19, 2012 12:16 am 
Lives in gote
User avatar

Posts: 505
Location: Montana
Liked others: 80
Was liked: 62
Joaz Banbeck wrote:
hyperpape wrote:
...(I miss strong typing. And I maybe even want static typing)...


http://www.freepascal.org.

Pascal? Bah!

I'm a huge Python fan, but that does not have strong typing either. If you're enjoying javascript, I'd recommend checking out Jquery - adds some power to javascript.

_________________
KGS: schultz [?].

Top
 Profile  
 
Offline
 Post subject: Re: A diagram combination extension
Post #9 Posted: Mon Mar 19, 2012 4:30 am 
Tengen

Posts: 4380
Location: North Carolina
Liked others: 499
Was liked: 733
Rank: AGA 3k
GD Posts: 65
OGS: Hyperpape 4k
schultz wrote:
I'm a huge Python fan, but that does not have strong typing either. If you're enjoying javascript, I'd recommend checking out Jquery - adds some power to javascript.
I think Python actually features strong dynamic typing, if I understand the terms right (big if!). It doesn't do the thing I most dislike, giving undefined for "foo.missingAttribute" (which makes sense, since I learned Python first, I'm myopic and want other languages to be Python).

_________________
Occupy Babel!

Top
 Profile  
 
Offline
 Post subject: Re: A diagram combination extension
Post #10 Posted: Wed Mar 28, 2012 5:19 am 
Lives in sente
User avatar

Posts: 801
Location: Amsterdam (NL)
Liked others: 353
Was liked: 107
Rank: KGS 7 kyu forever
GD Posts: 460
hyperpape wrote:
"foo.missingAttribute"

I found out who "John Doe" is but I am still missing a clue about foo, even after 15 year C++ experience.
BTW I like hyper's idea a lot!

Top
 Profile  
 
Offline
 Post subject: Re: A diagram combination extension
Post #11 Posted: Wed Mar 28, 2012 7:12 am 
Gosei
User avatar

Posts: 1585
Location: Barcelona, Spain (GMT+1)
Liked others: 577
Was liked: 298
Rank: KGS 5k
KGS: RBerenguel
Tygem: rberenguel
Wbaduk: JohnKeats
Kaya handle: RBerenguel
Online playing schedule: KGS on Saturday I use to be online, but I can be if needed from 20-23 GMT+1
Cyclops: http://en.wikipedia.org/wiki/Foo (I've read the story many times in many sources, the wiki's is good enough to get an idea ;))

_________________
Geek of all trades, master of none: the motto for my blog mostlymaths.net

Top
 Profile  
 
Offline
 Post subject: Re: A diagram combination extension
Post #12 Posted: Sat Oct 20, 2012 2:10 pm 
Tengen

Posts: 4380
Location: North Carolina
Liked others: 499
Was liked: 733
Rank: AGA 3k
GD Posts: 65
OGS: Hyperpape 4k
So, I've started working on this again, and putting a few things on github (https://github.com/hyperpape/js-sgftools). The code that actually puts diagram fragments together into a tree of variations isn't there yet, but it could be soonish.

_________________
Occupy Babel!

Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group