Object-oriented – Which paradigm to use for writing chess engine

chessfunctional programmingobject-orientedparadigms

If you were going to write a chess game engine, what programming paradigm would you use (OOP, procedural, etc) and why whould you choose it ? By chess engine, I mean the portion of a program that evaluates the current board and decides the computer's next move.

I'm asking because I thought it might be fun to write a chess engine. Then it occured to me that I could use it as a project for learning functional programming. Then it occured to me that some problems aren't well suited to the functional paradigm. Then it occured to me that this might be good discussion fodder.

Best Answer

Evaluation isn't a parallelizable problem as far as I know but evaluating different chains is , so I definitively would write it to make use of multiple cores and multithreading.

Whether you go functional or semi-functional is a matter of taste. Personally i'd go OOP and use the support for functional programming and parallelization that exists in for instance C#

On a sidenote, if I were to write a chess engine I'd try to make one that really can "think" about chess. Using board evaluation to brute force all possible combinations has been done to death and extremely well, but there hasn't been much progress afaik in doing a more thinking/fuzzy chess engine. That'd be a challenge! :)

Find some games with really tricky position play and strong moves (they're marked ! or !!) and use them to train and test your engine.

Related Topic