tag:blogger.com,1999:blog-14063458.post8330142273955134260..comments2024-03-28T05:56:10.343-07:00Comments on Shed Skin - A (restricted) Python-to-C++ Compiler: Disco: an elegant Python Go player (update)srepmubhttp://www.blogger.com/profile/15831320699731673389noreply@blogger.comBlogger27125tag:blogger.com,1999:blog-14063458.post-90971453571337561272012-10-11T07:38:21.633-07:002012-10-11T07:38:21.633-07:00This comment has been removed by the author.Anonymoushttps://www.blogger.com/profile/00900344806105285982noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-84797487816657189982012-10-11T07:37:47.316-07:002012-10-11T07:37:47.316-07:00I had to puzzle a bit, but the code is still reada...I had to puzzle a bit, but the code is still readable :-) It indeed looks a bit optimized for performance.Anonymoushttps://www.blogger.com/profile/00900344806105285982noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-17580589330439463742012-08-28T07:28:27.633-07:002012-08-28T07:28:27.633-07:00Hello Mark,
examples_go in combination with simpl...Hello Mark,<br /><br />examples_go in combination with simple beat,atari and winrate heuristics defeat manyfaces of go.version 11 and Aya 634e (both on strongest level ca 7-8k) on 9*9 with 50000 games. Beside the fact, that it don`t recognize a ladder, it play very stringent on 9*9 and i am impressed. The strength depends strong on the number of simulated games. With 40000 games it losses against MfG and Aya.<br />But one big problem occurs, if i simulate with 50000 games on 9*9 board. Sometimes i get the message, Fatal error in gc: too many heap sections and the program crashes.<br />I figured out, it has to do with the boehm garbage collector, but i am unable to find out, how to configure boehm garbage collector in windows xp. It would be nice to test the program with 100000 or even more simulations. <br />Thx StefanThomas Müntzerhttps://www.blogger.com/profile/16942546646672278876noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-49082306587790833692012-06-10T13:59:35.708-07:002012-06-10T13:59:35.708-07:00it did :-) I'm a bit behind on my mail, but wi...it did :-) I'm a bit behind on my mail, but will try to reply soon..srepmubhttps://www.blogger.com/profile/15831320699731673389noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-46987216343614544362012-06-09T08:47:02.810-07:002012-06-09T08:47:02.810-07:00I hope my email reached you.I hope my email reached you.Thomas Müntzerhttps://www.blogger.com/profile/16942546646672278876noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-73892322664688393242012-06-09T02:49:39.366-07:002012-06-09T02:49:39.366-07:00Because the correct one is stotti69@hotmail.de ;-)...Because the correct one is stotti69@hotmail.de ;-)Thomas Müntzerhttps://www.blogger.com/profile/16942546646672278876noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-30135571816034241782012-06-09T01:48:07.594-07:002012-06-09T01:48:07.594-07:00oh I see, sorry about that, duf should be dufour.....oh I see, sorry about that, duf should be dufour.. :P interestingly I was unable to send you a mail too..?srepmubhttps://www.blogger.com/profile/15831320699731673389noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-68306888715833077662012-06-09T01:14:50.749-07:002012-06-09T01:14:50.749-07:00I tried to send you an e-mail, but hotmail complai...I tried to send you an e-mail, but hotmail complain about the adress and said mark.duf...@gmail.com is not proper name for an adress. I sent it to mark.duf@gmail.com, hope it will be arrive.Thomas Müntzerhttps://www.blogger.com/profile/16942546646672278876noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-83404723187836221732012-06-07T09:35:03.409-07:002012-06-07T09:35:03.409-07:00thanks! yep :) note that there is also a shedskin ...thanks! yep :) note that there is also a shedskin discussion group hidden on the googlecode main page.. via a link in the lower left corner.srepmubhttps://www.blogger.com/profile/15831320699731673389noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-11513832702189846502012-06-07T04:32:34.895-07:002012-06-07T04:32:34.895-07:00I measured today with and without boundary checkin...I measured today with and without boundary checking.<br />This time with 300 simulations:<br />-b: needed 2.95s<br />+b: needed 3.19s<br />Thanks for your offering of helping, if i can not figure out somethings, i come back to it. My e-mail is:stotti69.@hotmail.net. Can i reach you under mark.duf...@gmail.com ?Thomas Müntzerhttps://www.blogger.com/profile/16942546646672278876noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-42703767814859392532012-06-06T12:18:43.843-07:002012-06-06T12:18:43.843-07:00thanks for measuring! that's a fine speedup.. ...thanks for measuring! that's a fine speedup.. was that with 'shedskin -b'? note that there some useful performance tips in the shedskin documentation, that may help squeeze out more performance later. you can always send me some code in private, and I'm happy to have a look.srepmubhttps://www.blogger.com/profile/15831320699731673389noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-67363067419129389722012-06-06T11:27:42.676-07:002012-06-06T11:27:42.676-07:00I have tried shedskin and the current speed up is ...I have tried shedskin and the current speed up is ~26 times faster than my python code. On a 5*5 board with two moves deep search, some modification of the position and 100 Monte carlo simulations;<br />Python needs: ~25s<br />Shedskin needs: ~0.9s<br /><br />There is a lot to improve, but the results are promising. I will report if my ideas works really, but i need to write the whole program in this disjoint set datastructure for checking on at least 9*9 board, rather on a 19*19 board.Thomas Müntzerhttps://www.blogger.com/profile/16942546646672278876noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-82738429532503087762012-06-06T08:19:50.967-07:002012-06-06T08:19:50.967-07:00have you tried shedskin on it yet..? I'm very ...have you tried shedskin on it yet..? I'm very interested in performance or other problems.. it would also be awesome to add another go player to shedskin/examples later on perhaps.. ;-)srepmubhttps://www.blogger.com/profile/15831320699731673389noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-26169668520415552572012-06-06T07:19:28.005-07:002012-06-06T07:19:28.005-07:00I will tell you, if the things do what they should...I will tell you, if the things do what they should and how the performance is. It will take some time to rewrite my program. It is written in pure python and currently ca. 700 lines of inefficent code;-).Thomas Müntzerhttps://www.blogger.com/profile/16942546646672278876noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-65874754524240659952012-06-06T04:16:25.178-07:002012-06-06T04:16:25.178-07:00in case you decide to keep your program in pure py...in case you decide to keep your program in pure python (for example, by extending disco), I'd be very very interested in hearing how it goes. I'd love to see a ~1000 line python player play really well. btw I can heartily recommend using gogui and cgos to test your program.srepmubhttps://www.blogger.com/profile/15831320699731673389noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-61354190358891555242012-06-06T03:06:58.190-07:002012-06-06T03:06:58.190-07:00I found a excellent Lecture on the topic of Disjoi...I found a excellent Lecture on the topic of Disjoint set Datastructure on youtube. <br />http://www.youtube.com/watch?v=wSPAjGfDl7QThomas Müntzerhttps://www.blogger.com/profile/16942546646672278876noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-40547825081005708632012-06-06T00:24:04.446-07:002012-06-06T00:24:04.446-07:00Thanks for the cleaned up version, makes things ea...Thanks for the cleaned up version, makes things easier to understand. You are totally right about strong go engines. It is considered, that pure Monte Carlo reach only 18k rank on 19*19 Board. And Zen, the strongest machine today, is 6D on KGS! So there is something between 18k and 6d ;-). With my old Datastructure, for example using rekursive flood fill algo for searching connected stones, i was only able to play on 5*5 board with good results. Iam using alpha-beta tree search, a special algo which transfer the present position to and endposition and then evaluate it with Monte Carlo. But my present Datastructure is not able to do the task in needed Time. So i am happy to found your version,which is the Datastructure i was looking for. Thanks a lot Mark ;-).Thomas Müntzerhttps://www.blogger.com/profile/16942546646672278876noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-59367199515278704022012-06-05T09:07:38.966-07:002012-06-05T09:07:38.966-07:00the really good go players do much better than ...the really good go players do much better than 'random' simulations, so perhaps it's actually better to slow down a bit in this sense.. :P<br /><br />I just cleaned up examples/go.py a bit in shedskin git, and added a few other comments.. just tried it again, and it beat me on 9x9 (using GAMES=500000, took 2.7 GB of RAM here).. that's always interesting.srepmubhttps://www.blogger.com/profile/15831320699731673389noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-81496333051513650202012-06-05T08:40:54.342-07:002012-06-05T08:40:54.342-07:00Thanks for the quick anwser and the link. It helpe...Thanks for the quick anwser and the link. It helped me a lot. To find the right datastructure for a go game with tons of simulation is a real challenge.:-)Thomas Müntzerhttps://www.blogger.com/profile/16942546646672278876noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-81756131921371713492012-06-05T01:46:53.133-07:002012-06-05T01:46:53.133-07:00@thomas: thanks! the board is 'reset' afte...@thomas: thanks! the board is 'reset' after each simulation. there's no undo. that does mean a few things are reallocated and some old things have to be garbage collected.<br /><br /> nboard = Board()<br /> GAMES = max(25000-(1000*len(board.history))/4, 4000)<br /> for game in range(GAMES):<br /> node = tree<br /> nboard.reset()<br /> nboard.replay(board.history)<br /> node.play(nboard)<br /><br />I should probably remove the 'amaf' crap from the code btw, and the 'check' function.. and probably document things a bit..<br /><br />for example, it may not be clear I'm using this to maintain groups:<br /><br />http://en.wikipedia.org/wiki/Disjoint-set_data_structuresrepmubhttps://www.blogger.com/profile/15831320699731673389noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-36059493184264985652012-06-05T01:15:15.455-07:002012-06-05T01:15:15.455-07:00Hello Mark,
Congrats to your go program and the d...Hello Mark,<br /><br />Congrats to your go program and the development of shedskin. I try to write an own go program and in dealing with the speed problem i came to shedskin and disco. What i understand so far is, that the board is a list of instances, which contains the data of every point on the board.What i dont undestand, how you avoid memory reallocation of the present board position for every uct simulation? Collecting the changes of the board and after one simulation undo it? I hope i was able to point out, what i mean.<br />Nice Greetings from Germany<br />StefanThomas Müntzerhttps://www.blogger.com/profile/16942546646672278876noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-56725188971557568362010-08-11T01:37:40.084-07:002010-08-11T01:37:40.084-07:00you can fill in two numbers (starting from 0), sep...you can fill in two numbers (starting from 0), separated by a space, which are then interpreted as x and y coordinates on the board.<br /><br />text = raw_input('?').strip()<br />x, y = [int(i) for i in text.split()]srepmubhttps://www.blogger.com/profile/15831320699731673389noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-24887364864490175542010-08-11T00:17:38.809-07:002010-08-11T00:17:38.809-07:00This is a really dumb question, but I am new to Py...This is a really dumb question, but I am new to Python and just installed PyScripter and Eric python IDEs (beyond just IDLE) to run your Disco GO program. I am going through your code, mostly "F7 step into" (im a novice), and was trying to re-write your version of the UCT cpu_player in C#. However, this is my dumb question: How do i actually play the game in the Python shell? It says "thinking.." then it spits out a move (2,6) WHITE: 7.5, BLACK: 1 ... I haven't stepped far enough into the code to know what method output the last two lines & exactly what they mean. I also don't know what to enter next, as a player, into the shell to make a move??? Can you tell me what to enter? (sorry, dumb question, but im under time-constraints to show your program to someone i work for--you get 110% credit/reference for your program of course, im just showing it to my boss & learning mobile Android SDK for gaming apps on the side as well)Anonymoushttps://www.blogger.com/profile/18081333915011501353noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-67544106650013495942010-08-11T00:16:59.886-07:002010-08-11T00:16:59.886-07:00This comment has been removed by the author.Anonymoushttps://www.blogger.com/profile/18081333915011501353noreply@blogger.comtag:blogger.com,1999:blog-14063458.post-78722472199577193092009-12-12T09:47:03.538-08:002009-12-12T09:47:03.538-08:00thanks for asking! go right ahead, the code is you...thanks for asking! go right ahead, the code is yours. please do let me know when you find any bugs in disco or shedskin. I'd appreciate it to hear what you come up with, especially if you manage to beat the original disco.. :)srepmubhttps://www.blogger.com/profile/15831320699731673389noreply@blogger.com