<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>A Random String of Bits &#187; go</title>
	<atom:link href="http://stringofbits.net/tag/go/feed/" rel="self" type="application/rss+xml" />
	<link>http://stringofbits.net</link>
	<description>Sequences of bytes about Technology, Programming, Gaming, Doctor Who, and more</description>
	<lastBuildDate>Thu, 26 Apr 2012 19:58:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='stringofbits.net' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>A Random String of Bits &#187; go</title>
		<link>http://stringofbits.net</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://stringofbits.net/osd.xml" title="A Random String of Bits" />
	<atom:link rel='hub' href='http://stringofbits.net/?pushpress=hub'/>
		<item>
		<title>Concerto for a Rainy Day &#8211; 2012 Carolina Spring Go Tournament report</title>
		<link>http://stringofbits.net/2012/04/23/concerto-for-a-rainy-day-2012-carolina-spring-go-tournament-report/</link>
		<comments>http://stringofbits.net/2012/04/23/concerto-for-a-rainy-day-2012-carolina-spring-go-tournament-report/#comments</comments>
		<pubDate>Mon, 23 Apr 2012 18:00:32 +0000</pubDate>
		<dc:creator>Anna Wiggins</dc:creator>
				<category><![CDATA[Gaming]]></category>
		<category><![CDATA[AGA]]></category>
		<category><![CDATA[碁]]></category>
		<category><![CDATA[go]]></category>
		<category><![CDATA[reflections]]></category>
		<category><![CDATA[tournament]]></category>

		<guid isPermaLink="false">http://stringofbits.net/?p=740</guid>
		<description><![CDATA[The day begins early &#8211; much earlier than most Sundays. I&#8217;m out the door at 8:15, for a tournament that starts at 9:00. I usually sleep in on the weekends; I didn&#8217;t even know Sundays had a 9 o&#8217;clock. The day is rainy and grey, but bright in that clean Spring way where the contrast [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stringofbits.net&#038;blog=23443234&#038;post=740&#038;subd=stringofbits&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The day begins early &#8211; much earlier than most Sundays. I&#8217;m out the door at 8:15, for a tournament that starts at 9:00. I usually sleep in on the weekends; I didn&#8217;t even know Sundays <strong>had</strong> a 9 o&#8217;clock.</p>
<p>The day is rainy and grey, but bright in that clean Spring way where the contrast between everything is sharpened and it feels like you can see forever. I drive in the rain to NC State campus, a twenty minute drive through the odd combination of semi-urban and rural landscape that makes up Raleigh. Once on campus, I&#8217;m a bit confused &#8211; GPS helps me get to the right general area, but I&#8217;ve lost my GPS signal now and end up parked in a deserted-feeling area in front of a row of buildings. There is no one else walking around here, and as I&#8217;m looking around and trying to get my bearings I hear a rumbling noise. On the far side of the road, a train goes rushing by on tracks I hadn&#8217;t noticed.</p>
<p>The lack of people and the light rain and the sudden noise &#8211; suddenly everything feels surreal, just to the left of normal. It&#8217;s a dizzying experience &#8211; this always happens when I am stepping into the unknown, especially when I don&#8217;t have anyone familiar nearby. It isn&#8217;t a negative sensation, though; it&#8217;s pleasant in an &#8220;I might be stepping into fairyland and I may never find my way back&#8221; sort of way. I check my phone, which has gotten its GPS lock back, and realize I need to drive a block further. I spot a sign for the building I&#8217;m looking for, and park.</p>
<p>The surreal feeling persists as I cross the street. I realize I&#8217;m at the back of the building, which explains why things feel so deserted. I find the front entrance, and enter to find&#8230; a deserted building. No one in the lobby, no signs posted, and no obvious Go-related activity occurring. I check my email (thank the gods for smartphones) and realize I missed a detail &#8211; room 404. Great. I&#8217;ll never find it.</p>
<p>I do find an elevator, though, and while I wait for it several other people arrive, obviously Go players (exactly how this is obvious is lost on me, but it is clear they are Go players). One of them, an older man, smiles at me in greeting, and with that, normalcy returns.</p>
<h3>Setup</h3>
<p>The tournament takes about an hour to get going. The organizers seem to be having trouble with their <a href="http://vannier.info/jeux/gotournaments/opengotha.htm">tournament software</a>. While we wait, I say hi to the players I know from the <a href="http://www.trianglegoclub.org/">Triangle Go Club</a>, and end up in a conversation with someone who is about my age. We start to play a warm-up game. He <a href="http://senseis.xmp.net/?HandicapGo">gives me 9 stones</a>, and I&#8217;m doing pretty well about 50 moves in, when we notice that the tournament organizers have set up a projector and are projecting the first round pairings. We clean up our game, and I grab a bottle of water and head over to my assigned table.</p>
<h3>Round 1</h3>
<p>My first game is against Andrew, rank 15 <a href="http://senseis.xmp.net/?Kyu">kyu</a>. Andrew is young &#8211; probably no older than 12. He is also very polite: He introduces himself and shakes my hand before he sits down.</p>
<p>As I entered at 19 kyu, I have black with 3 handicap stones. I had a chance during my warm-up game to figure out how the <a href="http://senseis.xmp.net/?IngBowls">Ing bowls</a> work, but it takes me a minute to work out how to program and use the game clock<sup>1</sup>. They&#8217;re pretty intuitive, though, and I am soon hearing an amazingly cheerful voice (it reminds me of <a href="http://en.wikipedia.org/wiki/List_of_Chobits_characters#Sumomo">Sumomo</a>) telling me my timer has started counting. Since I have handicap stones, my opponent actually goes first, so I immediately press my button to make it white&#8217;s turn, and hear the same message repeated again, with &#8216;White&#8217; in place of &#8216;Black&#8217;.</p>
<p>Andrew plays his first move in less than a second. This isn&#8217;t too surprising &#8211; in a 3 stone handicap game, playing the 4th <a href="http://senseis.xmp.net/?StarPoint">hoshi</a> is an obvious opening move. I respond aggressively, approaching his stone, and now the tournament really feels underway. I throw myself into the mental space of Go, of territory and influence, attack and counter-attack.</p>
<p>Andrew responds almost immediately to every move I make, while I feel lumbering by comparison, often thinking for several seconds before responding. This trend continues throughout the game, and his fast moves make me feel like I need to respond equally fast, which leads to several mistakes.</p>
<p>His play is surprising &#8211; he pretty much discards <a href="http://senseis.xmp.net/?Joseki">joseki</a> and instead favours <a href="http://senseis.xmp.net/?Attach">attaching</a> to any approach move I make. I&#8217;m admittedly weak against strange openings &#8211; even if they&#8217;re technically weaker, I haven&#8217;t seen them as much and so the best response isn&#8217;t obvious and automatic.</p>
<p>More importantly, Andrew is very good, especially at local fighting. I cede more and more territory, and lose several sizable groups of stones. My opponent is the tide and I fall back before his steady and relentless onslaught. I know enough about the game to build a seawall, though, and eventually the board starts to <a href="http://senseis.xmp.net/?Settled">settle</a>. Then I see it &#8211; a critical point in one of my opponent&#8217;s <a href="http://senseis.xmp.net/?Shape">shape</a> in the south-west side of the board that, if I can play there, will kill two large groups, giving me some 40 points. It&#8217;s monumental, and it could turn the tide of the game. And it&#8217;s my opponent&#8217;s turn. If he sees the weakness and plays the point, these stones will be <a href="http://senseis.xmp.net/?LifeAndDeath">alive</a>.</p>
<p>My hands start to shake, and I can feel my pulse in my neck, speeding up. My face flushes, and I&#8217;m afraid I might actually break into a sweat. Adrenaline. I&#8217;ve always had strong adrenaline reactions, but I&#8217;ve learned to usually keep up a calm front in the face of an adrenaline storm. Still, I feel light-headed and it&#8217;s hard to think.</p>
<p>I stare at a different part of the board, afraid of drawing his attention to the weakness.</p>
<p>He makes his move, attacking my stones in the northeast corner. A few points there doesn&#8217;t matter, though. This play is bigger. I put my stone on the board firmly, and it makes a satisfying <em>click</em>. I press the game clock, and it chirps, signaling to Andrew that it is his turn.</p>
<p>The game is over shortly after this. After some confusion about how to <a href="http://senseis.xmp.net/?Scoring">count</a>, we calculate the score. Even with my 40-point comeback, I lose by 20 points. Still, I feel like this is a good result. He was clearly better than me, and I had some really clever play near the end.</p>
<h3>Round 2</h3>
<p>I finish the first game pretty early, and have a chance to watch the other games and socialize with other players who have already finished. After everyone is done, it takes the organizers a while to enter the results and pair up the contestants for the next round. This is a repeated theme throughout the tournament, but I don&#8217;t mind &#8211; it&#8217;s a good chance to rest my mind and let my nerves calm down a little.</p>
<p>This time I&#8217;m up against Larry, another young player. He is ranked at 20 kyu, so we play an even game, with Larry taking black and me taking white. Larry is very intense; he doesn&#8217;t say hi, just sits down and we begin playing.</p>
<p>After the first round, I&#8217;m expecting to have to fight hard in this tournament, so I play very aggressively at first, overextending myself a bit. It quickly becomes apparent that I have a strong advantage in both tactical and strategic play. There are still several tricky points, and I manage to kill a large group with some pretty clever play.</p>
<p>The clock is running pretty low &#8211; I have less than two minutes of thinking time remaining. The smell of pizza intrudes &#8211; I&#8217;m starving. Most of the games have finished, and people are walking around while they eat. Several of the younger players are whispering nearby.. Needless to say, this is a distraction. I&#8217;m not blaming this for what happens next, but it was probably a factor. I make a huge mistake and let my opponent revive a large dead group. This probably costs me 30 points.</p>
<p>But I&#8217;ve taken all the corners and three of the sides, and pushed a wedge into the center. I win easily, by 76 points. I would suggest that Larry overestimated his strength, except he finished the tournament 3-1. I suppose my play style was just strong against his.</p>
<h3>Round 3</h3>
<p>Next comes some surprisingly delicious spinach pizza (in the sense that spinach pizza is not usually delicious) and Yet More Difficulty generating pairings. Now the problem is obvious &#8211; the children are competing as part of teams, so that their totaled wins and losses are considered. The pairing code doesn&#8217;t have a way to represent this, though, so the organizers are manually re-pairing the team members so that they don&#8217;t face each other.</p>
<p>I get paired with Dale, a stronger player than me &#8211; I take a 4 stone handicap. Dale is an older man, and the only adult I play against in the tournament. He is sociable and friendly, and this puts me at my ease, a relief after the previous two rounds.</p>
<p>Dale plays in a more relaxed style than Andrew (the only other game in which I had a handicap), and I&#8217;m able to make some pretty solid play against him. It is a very peaceful game until the end &#8211; only a small handful of captures. Still, the game is very intense and intricate as we test each other&#8217;s weak spots.</p>
<p>When the board feels settled, Dale keeps studying it, running his time down to less than a minute. Then he makes a desperate invasion into the widest part of my territory. I know he&#8217;s a stronger player, so I take a long time to respond. This stretches the game out for several more minutes as I carefully try to avoid mistakes. My fortifications hold, though, and his  invasion fails.</p>
<p>The total comes to 67 points for me, and 65 points for him. We count again &#8211; it turns out he missed a space in his territory. 67 to 66. I win by a single point. This is the closest game of Go I&#8217;ve ever played.</p>
<h3>Round 4</h3>
<p>Even though I&#8217;m in one of the last games to finish in round 3, I know it will take a while to get the next round set up, so I take a walk to stretch. The rest of the floor is quiet &#8211; a couple students in a computer lab, and two of the young girls from the tournament playing in one of the study lounges. It strikes me how cold it is in the hall &#8211; I didn&#8217;t notice how warm it was in the room where the tournament is being held. Too many bodies.</p>
<p>I return to the room just as things are getting set up. I look up at the projector that shows the matches, and find my name.</p>
<table width="80%">
<th>Table</th>
<th>White</th>
<th>Black</th>
<th>HD</th>
<tr>
<td colspan="4">&#8230;</td>
</tr>
<tr>
<td>14</td>
<td>Wiggins Anna</td>
<td>Evans Violet</td>
<td>7</td>
</tr>
</table>
<p>I&#8217;ve been paired with a 27 kyu player, and I&#8217;m giving her a 7-stone handicap. The tournament organizer actually walks over and apologizes. He explains that they try to avoid handicaps this large, but it was the best they could do with pairing.</p>
<p>But I&#8217;m intrigued. This should be a challenge. I&#8217;m not great at handicap games, and with 7 stones even a beginner will have a good chance.</p>
<p>Violet sits down across from me. I say hi as she places her handicap stones. She returns my greeting, but reluctantly &#8211; she seems a bit shy, or maybe she&#8217;s just distracted.</p>
<p>I scatter my opening moves around the board, approaching the corners. She repeatedly blocks by attaching high (I typically approach a 4-4 corner play via the <a href="http://senseis.xmp.net/?44PointLowApproach">low approach</a>). This leaves her open to a <a href="http://senseis.xmp.net/?33PointInvasion">3-3 invasion</a>, which I am able to exploit on all four corners. I am also able to capture a few sizable groups early on.</p>
<p>So, this may not be as hard as I was afraid it would be. But there&#8217;s another problem &#8211; as we play, she is building a very solid wall around my territory, claiming the entire center of the board. Normally this is not a sound strategy &#8211; there isn&#8217;t as much territory in the center as there appears to be, and it is harder to hold. Building that wall takes a lot of moves, and lets me firmly establish my own territory. But I&#8217;m backed against the edge pretty effectively here, and it looks like she may have enough points to win.</p>
<p>I manage to connect my corners, taking three sides. Violet is determined to hold the last side, though, and this is, ironically, my chance. I attack a section of her wall that isn&#8217;t fully connected. Then another. And another. Eventually I&#8217;ve formed a couple of cracks, and I move to drive a wedge into her territory. I don&#8217;t try to capture territory, just consume it. This is scorched earth &#8211; I just want to make sure nothing will ever grow here again.</p>
<p>I succeed, and we count the stones. I win by 25 points, which means the territory I succeeded in reducing gave me the win. Salting the earth made all the difference.</p>
<h3>Wrapping Up</h3>
<p>The projector is now displaying the tournament results. I can see that I did pretty well &#8211; my standing based on <a href="http://en.wikipedia.org/wiki/Strength_of_schedule">strength of schedule</a> is listed, and my score is double the person below me. That win in round 3 really helped.</p>
<p>In the lull after the last round, people have started talking pretty loudly, and we&#8217;ve achieved the sort of din that only 30+ people in a confined space can make. The organizer has to try a few times to start speaking. They have divided the players into 4 sections based on strength:</p>
<table cellspacing="5">
<tr>
<td>C</td>
<td>27kyu &#8211; 19kyu</td>
</tr>
<tr>
<td>B</td>
<td>15kyu &#8211; 6kyu</td>
</tr>
<tr>
<td>A</td>
<td>5kyu &#8211; 1<a href="http://senseis.xmp.net/?Dan">dan</a></td>
</tr>
<tr>
<td>dan</td>
<td>2dan+</td>
</tr>
</table>
<p>I&#8217;m excited by this, because sorted like this, I&#8217;m at the top of section C. When they actually announce winners, though, they announce a 3-way tie for first; they are *only* using wins and losses to determine who &#8216;wins&#8217; here.</p>
<p>This seems an odd choice; surely, in a ranked tournament, one unambiguous winner per group is preferable to 2 or 3? Especially given how likely it is that, in a given group of 5-10 players, several players will finish with 3 wins and nobody will finish with 4. This is basically why strength of schedule even exists.</p>
<p>I&#8217;m not concerned about it, though. Some pictures are taken, and I hang around with a few other players to help clean the place up. We turn out the lights and head downstairs.</p>
<p>At the front of the building, I say goodbye to the people still standing around and head back to my car. The rain has stopped now, and the late afternoon air is crisp and clean.</p>
<p><small><br />
<sup>1</sup>For anyone who is unfamiliar with Go game clocks, the clock has (in addition to some setup buttons hidden under a panel) 2 buttons for each side &#8211; one with your colour and a smaller one with your opponent&#8217;s colour. They also have an indicator that tells you how much time you have left and how many moves have been played. You press your colour after you move to indicate your move is done (it stops your game clock and starts theirs). You can press and hold the opponent&#8217;s colour to have your display show how much time their clock has left. In this tournament, we had 30 minutes main thinking time plus 5 30-second <a href="http://senseis.xmp.net/?ByoYomi">byo-yomi</a> periods. Tournament time in Go is very different than in Chess and many other games.<br />
</small></p>
<br />Filed under: <a href='http://stringofbits.net/category/gaming/'>Gaming</a> Tagged: <a href='http://stringofbits.net/tag/aga/'>AGA</a>, <a href='http://stringofbits.net/tag/%e7%a2%81/'>碁</a>, <a href='http://stringofbits.net/tag/go/'>go</a>, <a href='http://stringofbits.net/tag/reflections/'>reflections</a>, <a href='http://stringofbits.net/tag/tournament/'>tournament</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stringofbits.wordpress.com/740/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stringofbits.wordpress.com/740/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stringofbits.wordpress.com/740/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stringofbits.wordpress.com/740/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/stringofbits.wordpress.com/740/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/stringofbits.wordpress.com/740/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/stringofbits.wordpress.com/740/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/stringofbits.wordpress.com/740/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stringofbits.wordpress.com/740/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stringofbits.wordpress.com/740/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stringofbits.wordpress.com/740/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stringofbits.wordpress.com/740/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stringofbits.wordpress.com/740/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stringofbits.wordpress.com/740/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stringofbits.net&#038;blog=23443234&#038;post=740&#038;subd=stringofbits&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://stringofbits.net/2012/04/23/concerto-for-a-rainy-day-2012-carolina-spring-go-tournament-report/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7a6c6c99ccd3e2bbaec318a52fb3d43c?s=96&#38;d=identicon&#38;r=PG" medium="image">
			<media:title type="html">annabunches</media:title>
		</media:content>
	</item>
		<item>
		<title>pygo &#8211; a go game client</title>
		<link>http://stringofbits.net/2012/04/19/pygo-a-go-game-client/</link>
		<comments>http://stringofbits.net/2012/04/19/pygo-a-go-game-client/#comments</comments>
		<pubDate>Thu, 19 Apr 2012 10:30:29 +0000</pubDate>
		<dc:creator>Anna Wiggins</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[碁]]></category>
		<category><![CDATA[go]]></category>
		<category><![CDATA[GTK]]></category>
		<category><![CDATA[pygame]]></category>
		<category><![CDATA[pygo]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[SDL]]></category>

		<guid isPermaLink="false">http://stringofbits.net/?p=727</guid>
		<description><![CDATA[If I have anything like &#8216;regular readers&#8217; (I&#8217;m not certain from the traffic patterns on the blog whether or not that&#8217;s true), you&#8217;re probably wondering where I&#8217;ve been. The answer is, basically, the same as it ever is: writing code. I&#8217;ve also been playing a lot of Go, and doing some tabletop roleplaying. My latest [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stringofbits.net&#038;blog=23443234&#038;post=727&#038;subd=stringofbits&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If I have anything like &#8216;regular readers&#8217; (I&#8217;m not certain from the traffic patterns on the blog whether or not that&#8217;s true), you&#8217;re probably wondering where I&#8217;ve been. The answer is, basically, the same as it ever is: writing code.</p>
<p>I&#8217;ve also been playing a lot of <a href="http://en.wikipedia.org/wiki/Go_%28game%29">Go</a>, and doing some tabletop roleplaying. My latest programming projects are related to those hobbies. Today I want to talk about pygo, my new Go game client.</p>
<p>There are already a tremendous number of game clients out there. So, why would I want to create Yet Another One? There&#8217;s always the excuse of &#8216;it is a learning experience&#8217;, but I also try to make things that I hope will be useful to me personally. And the problem with all of the existing Go clients is that they come in one of two styles:</p>
<ol>
<li>Desktop clients that are timed, and expect you to play an entire game in one brief sitting. Of these, <a href="http://www.gokgs.com/download.jsp">cgoban3</a> is by far my favorite client (although it can only connect to its own <a href="http://www.gokgs.com/">kgs server</a>).</li>
<li>Web-based clients that expect your games to take a long time &#8211; usually you make a move, and come back later to see what your opponent has done.</li>
</ol>
<p>I wanted a client for <strong>medium-length</strong> games: a game that unfolds over the course of an afternoon, or maybe a couple days, while the players are simultaneously doing other things. So it needs these features:</p>
<ul>
<li>Untimed &#8211; infinite thinking time allowed</li>
<li>It is possible to put it down (close the program) and pick it back up later</li>
<li>Desktop-based. Being on a website makes me feel like I should play just one move and check back much later, and I want to avoid that mentality</li>
<li>Ability to play multiple simultaneous games</li>
</ul>
<p>I couldn&#8217;t find a client that met all of these requirements, so I decided to build this one.</p>
<h3>First steps &#8211; pygame</h3>
<p>My first implementation of the game used pygame. Pygame is a pythonic layer on top of SDL (which I&#8217;ve talked about <a href="http://stringofbits.net/tag/sdl/">before</a>, with some convenience libraries added for games. Unfortunately, this really means &#8216;games&#8217; in a much more &#8216;modern video game&#8217; sense, and this library felt less and less like a good fit the longer I worked with it. When I started implementing network play, it really fell apart; getting pygame to work with either threads or existing networking libraries (like Twisted) is painful. Adding widgets like buttons or menus requires adding third-party libraries, and theming them is an additional layer of work.</p>
<p>Here is what the pygames version looked like before I scrapped it. This represents a long weekend&#8217;s worth of very casual hacking (maybe 6-8 total hours of distraction- and interruption-filled programming):</p>
<div id="attachment_728" class="wp-caption alignnone" style="width: 490px"><a href="http://stringofbits.files.wordpress.com/2012/04/pygo-pygame.png"><img src="http://stringofbits.files.wordpress.com/2012/04/pygo-pygame.png?w=480&h=399" alt="Original pygame implementation" title="pygo-pygame" width="480" height="399" class="size-full wp-image-728" /></a><p class="wp-caption-text">This looks okay, but those buttons are an eyesore, and just feel like bad UI</p></div>
<p>Note the fairly ugly buttons along the side; several of those buttons (Quit, Join Game, Listen) would be better off in a menu. But menus (especially via a menu bar) are non-trivial with pygame.</p>
<h3>Now with more GTK</h3>
<p>With pygame scrapped, I decided to use a widgeting toolkit that wasn&#8217;t aimed for games, because I don&#8217;t really need anything graphically sophisticated. GTK is an obvious choice, because I&#8217;ve used it extensively before. It was the first widgeting toolkit that I used, and it is still, in my mind, how such toolkits &#8220;should work&#8221; (I realize there are toolkits out there that may be better, but this one feels like the natural way because it is what I learned first). Python&#8217;s GTK bindings, pyGTK, are really good. </p>
<p>So, in much less time than it took me to create the previous version of the game, I had re-implemented it in GTK. To be fair, I didn&#8217;t have to re-implement any of the actual Go logic, because that was encapsulated in a GUI-element-free class (good programming technique pays off). I also haven&#8217;t started working on the networking code again yet, but I&#8217;m pretty sure Twisted can integrate into GTK&#8217;s event loop seamlessly, giving me sensible threads-free networking.</p>
<p>Anyway, here is what we have now:</p>
<div id="attachment_729" class="wp-caption alignnone" style="width: 490px"><a href="http://stringofbits.files.wordpress.com/2012/04/pygo-gtk.png"><img src="http://stringofbits.files.wordpress.com/2012/04/pygo-gtk.png?w=480&h=413" alt="The new UI" title="pygo-gtk" width="480" height="413" class="size-full wp-image-729" /></a><p class="wp-caption-text">Notice the menu bar and the nicer-looking buttons.</p></div>
<p>Much prettier. We even have a menu bar, with all of the cruft unrelated to a specific game hidden away. Even better, with Glade laying out and drawing that menu is free &#8211; it doesn&#8217;t require me to write a single line of code. I just tell glade what function to call when each menu item is clicked, and it handles all of the boring GUI stuff.</p>
<p>The biggest problem I&#8217;ve run into with the GTK version was also a problem I had with pygame &#8211; the board graphics take a long time to update. With GTK it is especially problematic when I try to redraw the board.</p>
<p>So, I modified the Goban class (which has all of the Go game logic) to return a list of positions that should be re-checked for new information. Then, in GTK, I only redraw the parts of the board that may have changed. This makes the game perfectly responsive &#8211; no detectable delay. And using python&#8217;s list data type makes this beautifully easy and elegant.</p>
<h3>The Future</h3>
<p>There&#8217;s still a lot of work to do here. I plan on having direct peer-to-peer network connections, as well as having a server that players can connect to. Playing multiple games simultaneously isn&#8217;t implemented yet (although with GTK, this should be almost trivial). I may implement timed games as an *option*, and alternate board sizes, komi, etc. still need to be possible. The code can&#8217;t do scoring.</p>
<p>Now that the project is in pretty good starting shape, it&#8217;s also <a href="https://github.com/annabunches/pygo">available</a> on github.</p>
<br />Filed under: <a href='http://stringofbits.net/category/programming-2/'>Programming</a> Tagged: <a href='http://stringofbits.net/tag/%e7%a2%81/'>碁</a>, <a href='http://stringofbits.net/tag/go/'>go</a>, <a href='http://stringofbits.net/tag/gtk/'>GTK</a>, <a href='http://stringofbits.net/tag/pygame/'>pygame</a>, <a href='http://stringofbits.net/tag/pygo/'>pygo</a>, <a href='http://stringofbits.net/tag/python/'>python</a>, <a href='http://stringofbits.net/tag/sdl/'>SDL</a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stringofbits.wordpress.com/727/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stringofbits.wordpress.com/727/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stringofbits.wordpress.com/727/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stringofbits.wordpress.com/727/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/stringofbits.wordpress.com/727/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/stringofbits.wordpress.com/727/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/stringofbits.wordpress.com/727/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/stringofbits.wordpress.com/727/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stringofbits.wordpress.com/727/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stringofbits.wordpress.com/727/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stringofbits.wordpress.com/727/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stringofbits.wordpress.com/727/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stringofbits.wordpress.com/727/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stringofbits.wordpress.com/727/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stringofbits.net&#038;blog=23443234&#038;post=727&#038;subd=stringofbits&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://stringofbits.net/2012/04/19/pygo-a-go-game-client/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7a6c6c99ccd3e2bbaec318a52fb3d43c?s=96&#38;d=identicon&#38;r=PG" medium="image">
			<media:title type="html">annabunches</media:title>
		</media:content>

		<media:content url="http://stringofbits.files.wordpress.com/2012/04/pygo-pygame.png" medium="image">
			<media:title type="html">pygo-pygame</media:title>
		</media:content>

		<media:content url="http://stringofbits.files.wordpress.com/2012/04/pygo-gtk.png" medium="image">
			<media:title type="html">pygo-gtk</media:title>
		</media:content>
	</item>
		<item>
		<title>My new project &#8211; netjatafl</title>
		<link>http://stringofbits.net/2009/06/25/my-new-project-netjatafl/</link>
		<comments>http://stringofbits.net/2009/06/25/my-new-project-netjatafl/#comments</comments>
		<pubDate>Thu, 25 Jun 2009 19:06:03 +0000</pubDate>
		<dc:creator>Anna Wiggins</dc:creator>
				<category><![CDATA[Gaming]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[chess]]></category>
		<category><![CDATA[go]]></category>
		<category><![CDATA[mancala]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[tafl]]></category>

		<guid isPermaLink="false">http://stringofbits.net/?p=126</guid>
		<description><![CDATA[I&#8217;ve been pretty busy the last month working on netjatafl. Netjatafl will eventually be a networked client for playing various board and/or card games. It was originally created for hnefatafl and other tafl games. However, I have designed it to be extensible; I&#8217;m working on adding mancala games, and it looks like my design makes [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stringofbits.net&#038;blog=23443234&#038;post=126&#038;subd=stringofbits&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been pretty busy the last month working on <a href="http://netjatafl.sourceforge.net">netjatafl</a>.  Netjatafl will eventually be a networked client for playing various board and/or card games.  It was originally created for hnefatafl and other tafl games.  However, I have designed it to be extensible; I&#8217;m working on adding mancala games, and it looks like my design makes it pretty easy to add a new game. (I&#8217;ve added most of the logic for mancala to the client and server in just a couple hours of work).  I intend to add shogi, xiangqi, chess, and possibly even go at some point in the future.</p>
<p>The netjatafl server (taflserv) operates on a simple, completely open protocol; it will eventually support authenticated logins and statistics tracking.  Anyone could write a netjatafl client for any platform, if they wished.  My clients will all be in C++, because this let&#8217;s me reuse the &#8216;libboardgame&#8217; library, which contains the game logic used by the server.  I will also build in a &#8220;capabilities&#8221; system at some point, so the client and server can both advertise which games they support.</p>
<p>The whole thing is theoretically usable in its current state; the client is an ncurses-based text UI that is pretty cumbersome, but can be used.  As far as I know, it only works in Linux.  Anyone who wants to cross-compile it for Windows and send me a patch with everything you had to add, feel free!  I will eventually add a proper GUI, probably gtk+-based.</p>
<p>Like the sound of this project?  Feel free to check out the code, compile it, and let me know what you think!</p>
<p>Etymology notes:  netjatafl is Old Norse for &#8220;net-table&#8221;; i.e. a networked table you can gather around to play games.  &#8216;taflbordh&#8217; is ON for &#8216;tafl board&#8217; (tafl can also refer to tafl games in general), which sounds a little redundant, but it made a nice name for a client.  And &#8216;taflserv&#8217; is just &#8216;tafl server&#8217;&#8230; &#8216;serv&#8217; was meant to be short for &#8216;server&#8217;, but I later noticed that it&#8217;s also a French word meaning &#8216;it serves&#8221;.  I find this somewhat appropriate.</p>
<br />Posted in Gaming, Programming Tagged: chess, go, mancala, programming, tafl <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stringofbits.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stringofbits.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stringofbits.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stringofbits.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/stringofbits.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/stringofbits.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/stringofbits.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/stringofbits.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stringofbits.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stringofbits.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stringofbits.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stringofbits.wordpress.com/126/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stringofbits.wordpress.com/126/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stringofbits.wordpress.com/126/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stringofbits.net&#038;blog=23443234&#038;post=126&#038;subd=stringofbits&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://stringofbits.net/2009/06/25/my-new-project-netjatafl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7a6c6c99ccd3e2bbaec318a52fb3d43c?s=96&#38;d=identicon&#38;r=PG" medium="image">
			<media:title type="html">annabunches</media:title>
		</media:content>
	</item>
		<item>
		<title>Self-indulgent musings on total knowledge strategy games</title>
		<link>http://stringofbits.net/2008/12/23/self-indulgent-musings-on-total-knowledge-strategy-games/</link>
		<comments>http://stringofbits.net/2008/12/23/self-indulgent-musings-on-total-knowledge-strategy-games/#comments</comments>
		<pubDate>Tue, 23 Dec 2008 21:44:31 +0000</pubDate>
		<dc:creator>Anna Wiggins</dc:creator>
				<category><![CDATA[Gaming]]></category>
		<category><![CDATA[chess]]></category>
		<category><![CDATA[go]]></category>
		<category><![CDATA[hnefatafl]]></category>

		<guid isPermaLink="false">http://stringofbits.net/?p=72</guid>
		<description><![CDATA[Total knowledge games are games in which all players involved have equal knowledge of the current state of the game, and the only factor that influences the game&#8217;s future state is the actions of the players.  Chess, Go, and tafl are three such games that I play periodically. Recently, I pondered a fairly simple question: [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stringofbits.net&#038;blog=23443234&#038;post=72&#038;subd=stringofbits&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Total knowledge games are games in which all players involved have equal knowledge of the current state of the game, and the only factor that influences the game&#8217;s future state is the actions of the players.  <a href="http://en.wikipedia.org/wiki/Chess">Chess</a>, <a href="http://en.wikipedia.org/wiki/Go_(game)">Go</a>, and <a href="http://en.wikipedia.org/wiki/Hnefatafl">tafl</a> are three such games that I play periodically.</p>
<p>Recently, I pondered a fairly simple question: which of these games is the most complex?  All of them are complex enough that new players have room to become stronger over time.  Skill in these games has been traditionally praised as a virtue by each game&#8217;s culture of origin.  So, which game provides the greatest depth as a topic of study?</p>
<p><span id="more-72"></span>Before I consider the differences in the level of complexity of these games, let&#8217;s look at how a few basic elements of the games compare.  This will give us a fuller understanding of the factors that contribute to the games&#8217; complexity.</p>
<h3>Symmetry</h3>
<p>Chess and Go have in common that they are symmetric games &#8211; both players have the same resources at their disposal, and seek the same goal.  In chess, the pieces for each player are arranged similarly at the start of the board, and each player tries to capture the other player&#8217;s king.  In Go, the board begins empty of pieces, and capturing territory is the goal for both players.  In both of these games, neither player has a handicap evenly matched opponents will have an equal chance of winning.</p>
<p>Tafl, on the other hand, is asymmetric.  One player, the defender, controls a king and his bodyguards, and tries to flee to one of the corners of the board.  His pieces begin the game arranged in the board&#8217;s center.  The attacker, on the other hand, has his pieces along the four sides of the board.  He also outnumbers the defender 2-1.  Tafl also favors the defender; if two equally skilled players play each other, the defender is nearly guaranteed victory.</p>
<h3>Board Size</h3>
<p>Tafl and chess are played on fairly small boards &#8211; 8&#215;8 for chess, and anywhere from 7&#215;7 to 13&#215;13 for tafl.  The most common tafl board sizes appear to be 9&#215;9 (Tablut) and 11&#215;11 (Hnefatafl).  I will be contemplating a hnefatafl board here, because that is the size on which I most commonly play.</p>
<p>Go, on the other hand, is played on a 19&#215;19 board. This means that, in general, far more moves are possible at any given time in Go.</p>
<h4>Spaces vs Intersections</h4>
<p>While we&#8217;re talking about boards, I will pause briefly to discuss spaces and intersections.  In Go, your pieces are played on the intersections of the lines.  In tafl and chess, your pieces reside in the spaces, or squares, between the lines.  This fundamentally makes no difference at all.  You could make a grid of 8&#215;8 intersections instead of 8&#215;8 spaces, and play chess on it.  It would feel unnatural, perhaps, but only because you would be accustomed to the other convention.  Likewise, you could play Go on a board of 19&#215;19 spaces.  In fact, some variants of tafl were played on a grid of intersections, such as Alea Evangelii, a tafl game played on a 19&#215;19 board (you could, in other words, use a modern Go board to play Alea Evangelii).</p>
<h3>Capturing</h3>
<p>Go requires a player to surround an opponent&#8217;s stones and &#8216;cut him off&#8217; from all open spaces.  Capturing, however, is not the point of the game, only a strategic element.  This is also fundamentally true of tafl and chess; the ultimate goal is to surround the king; the capturing move is not strictly necessary.  Tafl&#8217;s capture rules are less straightforward than chess; you must &#8216;flank&#8217; an opponent&#8217;s piece (place your pieces on opposite, orthogonal sides of the opposing piece) to capture it.  The king must be surrounded on all four sides (in most variants).</p>
<h3>Construction vs Destruction</h3>
<p>In chess and tafl, players begin the game with all of their pieces in place; pieces can be captured, but new pieces will never be added to the board.  In a sense, they are destructive games; the forms which are in play at the beginning can change and be eliminated, but nothing new ever appears in play.</p>
<p>By contrast, Go is a constructive game.  The board begins completely barren; players add pieces until the board is full of pieces surrounding empty territories.  Pieces can be captured, but the overall trend during play is toward a fuller board.</p>
<h2>Complexity</h2>
<p>So, how do these games compare to each other in terms of strategic complexity?  Go has a lot going for it in terms of complexity.  First, it is played on a large board, meaning there will always be more moves to consider.  In addition, the constructive nature of the game means it is legal to play in nearly any open space at any time.  This means that the number of possible moves in Go will always be much greater than the other two games.</p>
<p>Additionally, the strategic elements within Go are extremely intricate.  Opening moves can impact the later game dramatically, and individual &#8216;battles&#8217; (sequences of moves on a small section of the board) have countless patterns and scenarios that players must be comfortable with.  Capturing an opponent&#8217;s stones isn&#8217;t always a good idea; often, nothing prevents your opponent from immediately capturing even more of your stones (and thus gaining territory) in return.</p>
<p>By stark contrast, chess and tafl have a fairly small number of legal moves.  For example, in chess, there are only 20 possible moves on the first play.  The average number of possible moves for a given chess game is something in the range of 32.  Tafl provides more possibilities than chess, even with fewer pieces; since all tafl pieces can move any number of spaces orthogonally, the attacker (who plays first) has 116 possible opening moves.  The defender&#8217;s first move has 120 possibilities.  Go, by comparison, has 361 possible opening moves.</p>
<p>In terms of capture rules, it is not clear to me whether tafl&#8217;s capture mechanics, which are more involved than those of chess, make the game simpler or more complex than chess&#8217; straightforward captures.  In chess, the capture rules require you to keep track of more information, since each piece has a more complex influence on holding territory.  Go, however, is the clear winner here as well, as capturing can be extremely intricate &#8211; often when trying to capture a group, you may limit your own liberties and end up being captured yourself.  A significant portion of the game&#8217;s strategy involves creating arrangements of stones that cannot be captured.</p>
<p>Ultimately, my observations and subjective experience suggest that Go is the most complex of these games.  It has an amazing number of possible permutations, and a very simple ruleset that nevertheless lends itself to an immense number of factors that must be considered.</p>
<p>Between chess and tafl, the numbers seem to favor tafl.  The asymmetry,  larger board, and larger number of possible moves seem to make it more sophisticated.  However, as long as the game is skewed in favor of the defender, the complexity may mean very little in the end.  Mostly from subjective experience, I would estimate that tafl is the more numerically complex game, but this experience may be skewed by the fact that so many of the possible moves in chess have been so well mapped.  The complexity of tafl also depends heavily on the specific tafl game and board size.  Even subjectively, I can&#8217;t come to any real conclusion here.</p>
<br />Posted in Gaming Tagged: chess, go, hnefatafl <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/stringofbits.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/stringofbits.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/stringofbits.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/stringofbits.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/stringofbits.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/stringofbits.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/stringofbits.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/stringofbits.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/stringofbits.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/stringofbits.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/stringofbits.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/stringofbits.wordpress.com/72/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/stringofbits.wordpress.com/72/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/stringofbits.wordpress.com/72/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=stringofbits.net&#038;blog=23443234&#038;post=72&#038;subd=stringofbits&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://stringofbits.net/2008/12/23/self-indulgent-musings-on-total-knowledge-strategy-games/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/7a6c6c99ccd3e2bbaec318a52fb3d43c?s=96&#38;d=identicon&#38;r=PG" medium="image">
			<media:title type="html">annabunches</media:title>
		</media:content>
	</item>
	</channel>
</rss>
