I wish to write a chess AI which simulates the way I think over the board, using C++.
My focus is on writing the algorithms for choosing moves (decision making), not defining the board and pieces.
To my knowledge, most chess programs written to date are focused on taking advantage of the computer's calculating powers
Well yes, though some are also focused on cutesy animations.
(aka brute force method).
Erm no, brute force would mean the computer would force you to sit down and play ever possible game with it until the sun consumed the earth.
My program will be different in that the focus is going to be on emulating human thinking (in this case my own way of thinking which is actually highly organized).
Every piece of software written by humans ends up emulating human thinking. It's the hardware that can't keep up.
I am relatively new to programming. Any advice you could give me on what topics to read, what programming paradigm(s) to use, any potential pitfalls I need to be aware of beforehand, or anything else you think I should know would be useful to me.
Read everything. Learn everything. Most of the pitfalls come from your own blind spots. I'm relatively old to programming (read as decades) and I'm still buying books to read.
My gut feeling is that the coding will, for the most part, not benefit from OOP paradigm. Concepts such as positional evaluation, pattern recognition, weighing out pros and cons of various moves, knowing when to stop the search(pruning), defining goals and finding means to reach them, don't naturally resemble objects...or do they?
Objects model more than real world things. They are ideas. Some objects are collections of strings. What real world thing does a
hashset model? I know some still teach this way but an object can model more than things you can see and touch.
My guess is that procedural programming (simply providing the computer with a set of instructions, an algorithm for picking moves), or perhaps functional programming (FP) would be more relevant in this case? Let me know what you think, thank you.
Procedural programming is straightforward. Start at the beginning, proceed through the middle, when you get to the end, stop. A nice simple pattern. Unfortunately it's far easier to write than to read and even harder to change. But if you're writing something small it's a big bang for the buck.
Functional programming is about many things but mostly it's about being formal about assignments. It's not big on side effects either but mostly it hates it when you use
I won a chess tournament using functional OOP (yes both together) against an entire class. We were free to use any paradigm we liked. Some of the smarter students went for ultra optimized using bit boards and opening books. I didn't use any of that.
My program won but not mostly because of my paradigm. I won because I tested the hell out of it. Most of my opponents lost making illegal moves. Others couldn't help going over time. The one other program that even stood a chance against mine had made the same fateful choice I made. I was conservative with my depth.
We had 4 agonizingly long seconds to make a move. Most couldn't fully explore beyond 4 moves. Those that could couldn't do it reliably and would make silly moves because they just stopped looking when time was up.
I pruned my depth search back to where there was no possible board position that would make me stop mid search. People laughed when they saw how fast my AI made moves. They stopped laughing when I started winning.
Why was this so important? Well it wasn't because the 3.5 seconds I didn't use couldn't have been useful. It could have. But it would have gotten in the way of the best thing I did. I tested. A LOT.
Despite the fact that we only submitted dll's, I wrote my own GUI that looped through showing me every possible move for any piece in any position. Even positions off the board. I learned to allow for that in testing the hard way. My one loss was when a pawn I was about to promote to queen got confused on the 7th rank and thought it could move two steps. I lost when it moved right off the board. Didn't see that in testing. Needed a better GUI.
So when you say you want to focus on the human mind I'm with you. I just want to advise you this: Test. Because the computer doesn't care what you think. It just does what you tell it to.
I could tell you more but I'll just link you to my previous chess rantings:
Clean OOP chess solution
Immutability & chess