| 
     
      
      
      From: j. v. <jva...@gh...> - 2003-10-28 10:18:08
      
     
   | 
On Mon, 27 Oct 2003, Ed Seid wrote: > I'm going through ICTK, trying to figure out what's what and doing a little coding in VB.NET. I'm just starting to dig into it, so please forgive if these are easy questions. > > I'm now looking at Class Square at > http://ictk.sourceforge.net/docs/current/ictk/boardgame/chess/Square.html > and am wondering about X and Y. > > 1- Shouldn't those be included in the fields, along with piece? Perhaps this is one of those places where ICTK is a bit OOP over-wrought. Certianly the X and Y coordinates could just be kept as int values in the Pieces. But having a container object (the square) allows for easy passing of coordinate pairs around (and storage in lists that only take objects). The ChessPiece has a reference to the Square it is on. The ChessPiece also has a reference to an array of legal destinations for this ChessPiece given the current board position. All of this could be replaces by using int[2] instead. Matter of OOP style, I guess. > 2- To understand X and Y a little better... Let's assume I'm using a > 10x12 board representation (119 element array) with a1 = 21, b1 = 22, a2 > = 31, ... h8 = 98. Would it be correct to have valid ranges X = 1 to 8 > and Y = 2 to 9? Hmm, I don't understand what you mean. Is a1 the 21st location on the board or the 2,1 coordinate on the board? Ah, I think you're maping the first letter with the second number. And the second number with the first number. So a=1 & 1=2, b=2, 2=3. It's rather confusing. But assuming a-h are your X coordinates 1-8 would be a valid numeric representation of your X corrdinate range. And yes, Y could equals 2-9 if you so wished. > 3- There are 2 additional constructors, that take arguments f and r. > If f and r are Byte, does their valid values range 1-8? There are two notations handled by Square. 1 is in character form where valid values are 'a'-'h' and '1'-'8'. The other is numeric form, where 1-8 and 1-8 are valid. > 4- One constructor has f and r as Char arguments. Am I correct in > thinking r = 1 to 8 and f = 'a' to 'h'? yes. > 5- If f = 'a' to 'h', then should there be a method to convert a Char f > to an Integer f? yes. You can get the value of the X coordinate as a character by invoking getFileAsChar(). Square does not have any static methods to do this conversion as that would have more to do with Locales and representations and thus is contained in ictk.boardgame.chess.io.ChessMoveNotation. But it doesn't used statics methods either since the whole point was to support Locales. > 6- On the webpage, there are 2 set methods... probably a typo. They take different arguments. One takes byte f, byte r the other takes char f, char r. A char is 2x the size of a byte. > > I'm new to OOP. Sorry if I misuse any of the terminology. I'm new to > OOP. Since I plan to write a gui, not an engine, the inefficiency of a > highly OO model isn't so critical. no problem. Hope this helped. -j  |