Free Go/ Discussion

Sub-page of FreeGo

Brent: .NET? I guess I am out of luck since my computer does not harbor any Micro$oft products. (I run Debian GNU/Linux.) Aren't there some sort of cross-platform libraries you could use instead? (Knowing full well that I will probably not convince you to change platforms at this point, but I just thought I would register my disappointment that I will not be able to run your cool program...)

Niklas: There are several open source implementations of the .NET standard. Maybe .GNU, Portable .NET or Mono can help you?

Bildstein: Duly noted. You're right that I won't change platform now, but I'll tell you what - when I finish version 0.2, I'll polish the code a little and then release it. Perhaps someone else will be generous enough to port it.

Bisqwit: The source file, FreeGo.zip, seems to be broken. I downloaded it with wget (the server says content-type is application/zip, size 134489 bytes), but when I try to decompress or test it (with InfoZIP UnZip 5.50), it complains of CRC errors, and hints that the file might have been broken in an ASCII FTP transfer.

Bildstein: Probably my fault. I'm using Windows XP command line FTP to transfer files, and it seems to default to ASCII mode. I've uploaded it again, and tested downloading and opening it. Thanks for taking an interest, by the way. I appreciate it.

Bisqwit: I'm not a Windows user and I don't have a C# compiler installed, but I looked at the source code because I was interested to read it.
Excluding the menuitem/dialog related code, it looks quite nice and readable. However, I'm not sure why your Stone class does distance checks as if they were square objects, whereas the game functions use Sqrt...

Darrell: Since there seems to be more people here interested in giving political rants than in helping you, I thought I would take a look at the code. You seem to have a good grasp of C#, though you don't use much more than ArrayList from the .Net framework. In the commercial world, no one thinks "C# vs Java", it is ".Net or J2EE" and the language is just a tool to exploit the framework. Other observations:

  • You don't have any properties. You use public members, GetXX methods, and even implicit operators that return data, but no properties. Try to use properties instead of all of these.
  • Don't use implicit operators. C# is an explicit language.
  • Maybe you were just practicing with delegates, but the BestPositionFunction stuff is usually done with a Strategy design pattern.
  • (ret.GetType() == typeof(Stone)) is better expressed (ret is Stone)

Bildstein: Thanks for having a look at my code. I really appreciate it.

Issue 1: Point taken.

Issue 2: Can you give an example? What's an implicit operator?

Issue 3: What's a "Strategy" design pattern? (Or where can I find out about it for myself?)

Issue 4: I'd have to double check the code to be sure for every instance, but the difference between (ret.GetType() == typeof(Stone)) and (ret is Stone) is that the latter returns true for every subclass of Stone. I think this was what I was trying to achieve. Of course, the fact that this wasn't obvious means that I haven't commented the code well enough ;)

Darrell: Issue 2, from FreeGoGame.cs:

 public static implicit operator long(Ordinate o)
 {
   return o.Value;
 }

Bildstein: I see. I guess this is the C++ programmer coming out in me. Hmm. I wonder why I even bothered with an Ordinate class. Oh yeah, so it could be null. There's got to be a better way to do this than how I'm doing it. Unfortunately I don't have time at the moment to delve back into the code. When I do have time, though, I'll make sure to come back to these issues.

Issue 3, Design Patterns are to object-oriented programming what joseki is to Go - how the experts handle a situation. A Google search on "Strategy Design Pattern" yields lots of results (though I don't know how many are helpful). There are several design patterns books as well. Basically in Strategy, the different algorithms are implemented as method overloads in subclasses. You pick an algorithm by picking a subclass. I'm not saying your way doesn't work - just that the experts do it differently.

Bildstein: Yeah, I know what design patterns are, but I've never consciously used one (although in practice I'm sure I have plenty of times). I did actually do a Google search as you suggested (but I figured I'd leave my post here anyway because I was interested in what you had to say), and the impression that I got was that the Strategy design pattern was about representing a particular solution to a problem (i.e. a strategy for solving the problem) as an object, and perhaps classes of solutions as classes (I'm not entirely sure). It seems like a good idea. Perhaps I should read a book about design patterns.

Issue 4, Hmm, if you purposefully want the master class to be treated differently than the subclass, I would say that you are negating one of the benefits of subclasses (and making your code harder to read). Perhaps you are better off making them separate classes that implement a common interface? Or making the master class virtual and have only subclasses?

Bildstein: It warrents attention, for sure. It's very inelegant. Again, when I get time, I'll look for a more OO way of doing it. In truth, I can't even remember the details of why I did it or where it was in the code.

It is very impressive that you are so open to review/criticism - maybe a habit learned from Go? I should add this to Sebastian/All I need to know I learned from Go.

Bildstein: Thanks ;) But I think it's almost impossible to distinguish between things that you learned from Go and things that you already knew, that gave you a predisposition towards learning Go. On this issue, I would say that there probably is a connection, but I have no idea which came first. My first thought, for what it's worth, was that it's only in the past two months that I've had stronger players around who could teach me anything. Before that, I was living in Tasmania, where the only people I played Go with were nameless, faceless people who didn't speak English, on IGS (and a few who did speak English on Dragon, most notably Wegobad).


This is a copy of the living page "Free Go/ Discussion" at Sensei's Library.
(OC) 2014 the Authors, published under the OpenContent License V1.0.
[Welcome to Sensei's Library!]
StartingPoints
ReferenceSection
About