Since I don't really know how this game is called in English, I called it "Pins". After a quick google search, it seems to be called either "Squares" or "Dots", so either of the three might be the right one. The source is almost uncommented, but it's just ~400 lines, and is very simple.