Author: Vincent Diepeveen
Date: 06:16:09 09/22/03
Go up one level in this thread
On September 21, 2003 at 23:25:15, Edward Seid wrote: >On September 21, 2003 at 21:15:06, Robert Hyatt wrote: > >> A chess board is a good example of an object. There is >>no need to create a bunch of them, one is enough. I've personally seen more >>than one _really_ elegant OO (C++) chess program that was just as fast as >>mine (it was a bitboard program also). > >OK, so a chessboard is a good object for an OOP-oriented chess program. What >other things would be good to represent as objects? >For the chessboard and other objects, what would be the attributes and methods >of each object? all bullshit of course, global arrays is more interesting to use. even in gnuchess 4.0 (before the crappy rewrite to bitboards) int board[64]; // sq_a1 = 0, sq_a2 = 8, sq_h7 = 63, values 1..6 for material int piecelist[2][16]; // having the squares for the pieces of each side int piececnt[2]; // number of pieces minus 1 int color[64]; // 0 = white, 1 = black, 2 = neutral int quickboard[64]; // 12 different pieces for color specific code int pindex[64]; // the index into piecelist etc. This is of course way easier and FASTER too than the bitboards stuff. >(Sorry that I ask so many questions, but I promise the next one won't be "Write >me code to do the above")
This page took 0 seconds to execute
Last modified: Thu, 15 Apr 21 08:11:13 -0700
Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.