Policy based design in chess

Code, algorithms, languages, construction...
Post Reply
rtr
Posts: 8
Joined: Thu Apr 03, 2014 2:39 am

Policy based design in chess

Post by rtr » Thu Aug 07, 2014 3:51 am

What do you think of policy based design for a chess engine or library? The techniques put forth in Modern C++ Design and after seem very powerful. But is a chess engine too small or specific to benefit significantly from PBD?

One benefit I see as desirable is easily modifiable code that is also very concise, your own meta-library that is very expressive and provides a lot of bang for the buck per line of code. I like to write the first version that can initially use a simple-and-correct algorithm, which has the option to be changed to a more efficient implementation later on. For instance, generating an attack bitboard would first be a basic for loop. Later on it can be upgraded to magic bitboards or whatever. A move list can just be a vector, and it gets changed to something more efficient later. However, this can easily be achieved by wrapping code in functions and classes. So is policy based design worth the effort for chess?

I suspect it might not be universally useful in a chess engine, but may only be useful in some areas of a chess engine. If so, which areas would be the best candidates?

Octopus

Re: Policy based design in chess

Post by Octopus » Thu Aug 07, 2014 7:27 am

Personally I do not want to be a part of a copy cat club.

lucasart
Posts: 201
Joined: Mon Dec 17, 2012 1:09 pm
Contact:

Re: Policy based design in chess

Post by lucasart » Thu Aug 07, 2014 3:01 pm

rtr wrote:What do you think of policy based design for a chess engine or library?
Utterly useless OOP masturbation!
"Talk is cheap. Show me the code." -- Linus Torvalds.

Post Reply