Using Strong Go Programs on Macintosh

SmartGo for Mac is not playing strongly, as computer play is using my own pre-AlphaGo engine. However, like SmartGo for Windows, you can use GTP (Go Text Protocol) to connect to strong engines to play against.

The most recent version of SmartGo for Macintosh (0.8.18) includes some improvements in how it handles GTP engines. It’s not perfect, there’s much more to be done, but hopefully it will tide you over while I keep my focus on the new SmartGo for iOS.

The first step is downloading and installing the computer go engines you want to connect to. Here are three I’ve tested with SmartGo for Mac, from easy to hard to install. All assume that you’re somewhat comfortable using the Terminal app; check out this iMore guide if you’re new to the command line.

Pachi

The easiest way to install Pachi on the Mac is using Homebrew (which you probably have to install first). Follow these instructions:

https://brewinstall.org/Install-pachi-on-Mac-with-Brew/

Leela Zero

Find Leela Zero on Github, scroll down to I just want to play with Leela Zero right now, and follow the Homebrew instructions. You’ll also have to download a file with network weights; the link is in that same section.

KataGo

Installing KataGo is more complicated, as you have to compile it yourself. Follow the instructions for Linux at https://github.com/lightvector/KataGo.

smartgo-mac-gtp-preferences

Setting Parameters

Once you’ve installed an engine, you need to add it to SmartGo. Choose SmartGo > Preferences in the menu and click on GTP. Then click on the + icon and navigate to the executable of the engine you want to add. SmartGo uses the engine name to guess reasonable parameters, then tries to run the engine to get its name and version. If you see a green checkmark with the name and version, you’re all set. Otherwise, edit the parameters sent to the GTP engine (the third column in the table). The following basic settings work for my setup:

Leela Zero: -g –playouts 1000 –noponder -w /usr/local/Cellar/leela-zero/0.17/best-network/40b_257a_64k_q

KataGo: gtp -model /Users/anders/work/katago/cpp/models/model.txt.gz -config /Users/anders/work/katago/cpp/configs/gtp_example.cfg

Leela Zero and KataGo take a while to initialize, so even just getting name and version initially can take a minute, and SmartGo may time out. If it does, just try starting a game against the engine anyway (File > New Game, specify the engine in the dropdown for Black or White), and see if it works.

I hope these instructions get you pointed in the right direction. I’m sorry none of this is as easy as it should be.

Highlights from Scotland and Ireland

This summer, I had to miss the US Go Congress in favor of a family reunion in Ireland, but was able to attend the European Go Congress in Brussels instead. Starting with a week in Scotland and ending with a week in Switzerland, this was my longest vacation in a while.

If you follow @smartgo on Twitter, you’ve already seen some of the highlights. I want to provide more context and better pictures of my favorite spots on this trip, for armchair travelers as well as those who are lucky enough to one day visit these places.

Scotland

Stirling Castle

Did you know the unicorn is the national animal of Scotland? Stirling Castle has all the features you’d expect of a castle, but unicorns on the roof? Unexpected.

The Kelpies

From unicorns to The Kelpies (shape-shifting water spirits): these 30 meter high sculptures celebrate the horse-powered heritage of Scotland.

Falkirk Wheel

To connect two canals at different elevations, you can build a series of locks. Or a rotating lift for boats. The Falkirk Wheel is ingenious, moving boats with very little energy.

Glencoe

The landscape around Glencoe is beautiful, and we’ll certainly come back there for more hiking.

Glenfinnan Viaduct

During the summer, you can take the Jacobite Steam Train from Fort William to Mallaig and back twice a day – a brilliant scheme for dumping a trainload of tourists in the picturesque port town of Mallaig at lunch and dinner. The viaduct made famous by the Harry Potter movies is now a major tourist attraction, and parking is limited, so get there very early if you want to time it such that you see the steam train pass over the viaduct. (Needless to say, we miscalculated.) Also, if you want to take the steam train, book far in advance. (A few weeks out, they had only a single one-way ticket left: our daughter got to take the train, and we were out of luck.)

Brochs

Brochs are 2000 year old double-walled buildings, found only in Scotland; not much is known about their origins and purpose. We were lucky to see two that are among the best preserved: Dun Telve and Dun Troddan near Glenelg. Really fascinating. The multi-level design with a stair between the inner and outer wall is impressive.

Glenelg-Skye Ferry

The little car ferry between Glenelg and Isle of Skye is quite an experience: it only takes six cars, and the car deck is angled to make it easy to drive on and off. For the crossing, the deck is rotated by hand to align with the boat. I have not seen the movie yet, but apparently, this ferry was featured in Made of Honor.

Edinburgh

We only had a day in Edinburgh, so while we got to explore the castle, see Greyfriars Bobby, and take a tour of the South Bridge Vaults, there’s so much more we have to come back to.

The highlight was a fun dinner with Matt Gemmell, author of the action-thrillers CHANGER and TOLL. (No, he didn’t reveal any secrets about his upcoming third novel.)

IMG_1148

Ireland

We stayed in Glengarriff in County Cork, a lovely area.

IMG_1175

Skibbereen Heritage Center

Skibbereen was badly affected by the Great Famine; it was sobering to learn more about the devastating potato famine of the 1840s (and the ever-present risk of monoculture), as well as the mismanaged response from England. Hard to believe that Ireland’s population was higher in 1841 than it is today.

IMG_1162.jpeg

Kerry Cliffs

The Kerry Cliffs are less famous than the Cliffs of Moher, but no less impressive. In the distance you can see Skellig Michael, famous for its monastery, birds, and Star Wars. Again, book far far ahead if you’re interested in visiting the island. While you’re there, I’d recommend visiting the nearby Skelligs chocolate factory for free samples. Their Lime & Black Pepper Chocolate Bar is delicious.

Gap of Dunloe

The Gap of Dunloe is stunningly scenic. We drove the narrow road through the pass by car; I’d prefer to hike it next time.

We’ll certainly visit both Scotland and Ireland again – many places I’d love to return to, and so much more to see.

EGC 2019 in Brussels

A family reunion put me in Ireland right during the US Go Congress; luckily, the European Go Congress lined up perfectly. I arrived in Brussels without jet lag, and definitely did better than two years ago in Oberhof.

I entered as 2 dan instead of 3 dan, knowing that European ranks are tougher than US ranks. However, 1 dan might have been the right rank, as that’s where I ended up (see my EGF ranking). I won half my games in the main tournament, but I was 1-4 in the first week and 4-1 in the second week, a clear sign of being overrated.

The weekend tournament didn’t go as well: I lost all five games. Each game was winnable, but somehow I managed to mess up. I regrouped and analyzed the games, and paid more attention to taking care of my weak groups instead of going for big points, and won the next four games.

A few other observations:

  • I got to practice my Norwegian hanging out with a dozen players from Norway. And it was great to get to know players I’ve long known through Twitter, such as Marcel Gruenauer.
  • I really enjoyed the longer time limits: with two hours per player, games are often four hours long; definitely valuable to spend that much time thinking intensely about the game.
  • Many players stayed only for the first week and the weekend tournament, so that’s certainly an option if you can’t stay for two weeks. Looking at the registered participants, there were 571 players for the first week, 702 for the weekend tournament, and 397 for the second week.
  • Brussels was a great place to have the tournament, with lots of places to eat and explore (more on that below). They had go boards in nearby pubs; maybe playing rengo until 1 am was not conducive to optimal play the next day?
  • The playing space was okay, except for lack of air conditioning – temperatures in Brussels reached 40° C (100° F) during the first week.

Next year, I plan to be at the US Go Congress in Estes Park, Colorado – hope some of the European players will be able to make it.

Side trips

At the US Go Congress, there’s usually a group of us touring the nearest Frank Lloyd Wright buildings. Brussels has a lot of beautiful old buildings, but I found some nearby places that were more to my liking.

The Atomium

I had seen the Atomium before, so I just went to take pictures of this fun structure this time.

Reading Between the Lines

Reading Between the Lines (Doorkijkkerk) is an artwork out in the green, well worth the train, bus, and hike from Brussels.

Liège-Guillemins

I love the Stadelhofen station in Zürich designed by Santiago Calatrava, so when I found out his train station in Liège is only an hour from Brussels, I knew I had to check it out. I was blown away by the size and openness of that space, and the light coming in.

DSC00985.jpgIMG_1336.jpegIMG_1360.jpeg

Port House

The Port House in Antwerp was designed by Zaha Hadid: Not to everyone’s liking, I’m sure, but it just put a smile on my face as I walked around it.

DSC01177DSC01179DSC01182DSC01191

Maybe one of these will inspire you to visit beautiful Belgium. If not, there’s always chocolate.

WWDC 2019

I’ve been experiencing WWDC from home, watching videos, reading documentation, and experimenting with the new APIs. The changes introduced this year are very exciting – Apple is firing on all cylinders. Here are my main takeaways.

Mac Pro

My iMac is 4.5 years old, and I’m looking for a replacement I can keep for many years and expand as needed. The new Mac Pro is perfect. Except for price. Once available, I’ll have to evaluate whether a Mac Pro makes sense, or whether an iMac Pro (now looking much cheaper!) will work just as well for development.

The Pro Display XDR is gorgeous, but way overkill for what I need. I think chances are that the iMac is due for a design refresh soon, and at that point, I would expect Apple to release matching standalone monitors. While hoping and waiting for that, I can get a second Dell P2415Q 24” monitor (just $353 instead of $6000) to tide me over if I go with the Mac Pro.

UIKit on Mac

With Catalyst (a.k.a. Marzipan), Apple allows iPad apps to run on the Mac. I’ve already used it to run my new work-in-progress iOS SmartGo app on the Mac, and so far it looks like a good path forward. I hope to end up with a Mac version of SmartGo that is more capable and more complete than the current one, and that will be easy to keep up-to-date with the iOS version.

SwiftUI

SwiftUI was an amazing surprise, the culmination of years of work behind the scenes at Apple. It makes me very happy that I bet on Swift several years ago, first creating SmartOthello to learn Swift, and now rewriting SmartGo in Swift. I’ve been watching the SwiftUI videos and experimenting with it, and it’s a real game changer: with minimal code, it provides more of the features users expect, and a more native experience on the Mac, all while reducing errors, providing instant previews, and making development more fun. It’s win – win – win.

This WWDC really knocked it out of the park. I’m very excited – so much to learn. Thank you, Apple.

Spirit of the Game

The recent ruling in the Transatlantic Go Tournament seems wrong: it puts technology ahead of the game of go. It leaves a sour taste in my mouth. There may be circumstances I’m not aware of, but basically, the game between Mateusz Surma and Eric Lui was played online over KGS, Mateusz was ahead on the board in the late endgame, and the move he tried to play with 10 seconds to spare somehow did not make it to the server in time. The final ruling is that he lost on time. To me, this violates the spirit of the game.

In ultimate frisbee, the Spirit of the Game is a guiding principle of the rules. Players call and adjudicate their own fouls; if players disagree, play gets restored as best as possible to what would have happened without that incident.

“Spirit of the Game: Ultimate relies upon a spirit of sportsmanship that places the responsibility for fair play on the player. Highly competitive play is encouraged, but never at the expense of mutual respect among competitors, adherence to the agreed upon rules, or the basic joy of play.” [Official Rules of Ultimate, 11th Edition]

Even at the professional level, where there are referees, the integrity rule allows players to overrule the referee when it’s to their own disadvantage:

“Any player or head coach can overturn any call made by an official if the official’s call favored the player’s or coach’s own team. Officials shall respect the integrity call. This allows teams to display sportsmanship and remedy an incorrect call against their opponent.” [AUDL Rule Book]

To me, go and ultimate share the same kind of spirit: highly competitive yet friendly play.

Mateusz losing due to a technical glitch makes the game of go subservient to technology. Technology enables long-distance tournaments, but that should be an incidental part of the match: the game is most important. When technology goes wrong, you try to restore the game to what it would have been without the technical glitch. And when a ruling is unfair, the winner should be able to overturn it. Integrity and spirit of the game are important, both in ultimate and in go.

ePubs at gobooks.com

Go books are now available as ePub. I wrote about the plan in November; it took a while to get all the details sorted out.

You’ll see that gobooks.com sports an all-new design, courtesy of Scott Jensen. The previous site was focused on the app; the new design puts the books front and center. You can now also list the books by series and by author. Tap on a book to get details, to download an ePub sample, and to buy it.

Available books: Currently, 81 of the 134 books are available as ePub. Books from Hinoki Press and Good Move Press may not be available as ePub for a while. As for Kiseido and Board N’Stones, I have agreement in principle, but am waiting for their signatures. All the other publishers are on board, and their books are all available as ePub. The button for buying a book will be labeled either EPUB+GOBOOK or GOBOOK ONLY, depending on whether that book is available as ePub.

Issues with ePub: The iOS and Mac apps still offers the best reading experience; ePub readers have a ways to go. Please check out the page on issues and recommended ePub readers. For example, to solve problems, you’ll want to read in single-page (portrait) mode to hide the answer on the next page, as ePub doesn’t support page breaks well. On that page you’ll also find instructions on how to download ePubs of books you’ve already bought.

The Go Books app was released April 11, 2011, almost 8 years ago. It started out with 8 books by 4 publishers, and was limited to iOS. The Mac app was added in January 2015, along with the ability to buy books directly at gobooks.com. Time for the next chapter.

Multi-Cursor Editing in Xcode 10

Multiple selection support in Xcode 10 is amazing. In previous versions, you could hold down the Option key to select a column of text, but you couldn’t do much with it. In Xcode 10, typing in such a multi-selection finally does the right thing: your text goes into each selection, so you can update multiple places at once. This alone really speeds up editing. But until recently, I had missed that multi-selection support goes far deeper:

  • Shift-Control to add selection: Hold down Shift and Control while clicking or dragging to add a new selection. So if you need to make the same edit in multiple places, just select each one, then start typing and make all the edits at the same time.
  • Option-Command-E to add the next occurrence of the current selection: If you already have something selected that you were going to type over, use Option-Command-E as needed to add selections at other places where this occurs, and edit just once.
  • Move multiple selections: As you’re editing, use the arrow keys to move multiple selections in unison; use Option to move by words, use Control to move by subWordsLikeThis (you may need to turn off System Preferences > Keyboard > Shortcuts > Mission Control > Move left/right a space).
  • Copy/paste: Create multiple selections, Copy, set multiple insertion points, Paste. Works like magic.
  • Use Find to create selections: Look in the Find menu for more tools. For example, Select All Find Matches and Select Find Matches in Selection let you set up multiple selections based on your search text.

This can all be accomplished by other means, but multiple selections fit naturally with the way I work, and don’t require extra mental effort or a context shift. This feature has been invaluable in moving some code from C++ to Swift. Thanks to the Xcode team for getting this right.

Happy editing!