r/learnprogramming • u/iamngs • 15d ago
Topic advice for a long time dream/amibition of mine
I am employed as an RPGLE developer on the IBM-i. That's the only programming I know how to do. I use it to make accounting reports, table maintenance programs, building menus, etc. All solely IBM-i apps, nothing modern. I took intro python and intro java back in college and that's it.
I really really really really want to make a chess engine, I've been reading a bunch of stuff about chess computing, looking at other peoples' code, etc. I tried picking up some C# because that's what Unity uses, bought a textbook and tried making the engine ... modeling the board and piece positions and values was easy, but once I got to the actual logic I had a really really hard time.
So I want to get proficient with modern software, not just RPG. The problem is, I fucking suck at math, I got through college algebra but everything calculus and beyond is too much for me. Maybe my professors were bad because it was a community college. So I can't go to school for this. Because all the universities around me require calculus 1, 2, and beyond for compsci or software, so I have no idea how I would even get the proficiency I need in programming to build a chess engine.
I am seeking advice from people more experienced and knowledgeable than myself. I feel very green, I hope someone more adept can give me some guidance on this. What can I do to get sharper at programming and get the experience and knowledge I need to build a chess engine, WITHOUT going to university for it? Do I go to some online academy or something?
Thank you, I am sorry to bug this subreddit I hope it's not bothersome, I just really want to realize this dream.
2
u/Sachu_James 15d ago
chess engine is a great dream project honestly i'd start with just the board and legal moves, forget the ai part for a while what part are you most stuck on right now?
1
u/Matilozano96 15d ago edited 15d ago
Modern software development TENDS to gravitate towards Object Oriented Programming as a main philosophy. So I’d suggest reading some of that. SOLID Principles is a good mnemonic related to that.
Basically, you want to define individual pieces (objects) of your project that you can grasp, understand and review in isolation from the rest.
Some keywords:
Class, Object, Instance, Abstract class, Inheritance, Method, Abstract Method, Static Method, Constructor, Encapsulation.
——
For your example, I’d think.
Game Piece:
has a type
has some logic to determine what legal moves it has, relative to the board.
Has functions that does something with them. Move, promote (change type), destroy…
Since the type informs the behaviour logic, this suggests that the movement/capturing logic would be a part of the type class. So game piece refers to its type to resolve that behaviour.
So things get more complicated as you go.
——-
Board:
Probably has an 8x8 matrix
Matrix is populated with references to piece instances or nothing at all
———
On top of all of that you’ll probably need something to control the gameplay loop. That way you concede control of the board to each player at a time.
The main loop creates the board, places the pieces, then locks and unlocks the pieces for each player.
(Oh yeah, somewhere in all of this mess you’d have to define which player is associated with each piece)
———
Then, you’d have a rendering layer, which is the interface for all of this.
Maybe you want it on browser, so you throw a frontend framework (often JavaScript). If you want to stick with C# then you should research what options you have, etc.
(Edit: oh, duh. Unity)
Something that would alleviate some of the UI headaches.
You could decide that the visual aspect of the pieces and board should be a part of them, too. Idunno.
But yeah, the interface renders the board, the pieces, and uses user input to figure out how to modify the game state.
——
Chess engines have a standardized way to represent matches and pieces. It’s just a string.
So you’ll definitely want to refer to that for compatibility eventually.
With that you can think of recording each move in that format for export, or importing a game and show it in your engine.
——
Etc etc. there’s probably a lot of holes in my ideas (just came up with it on the fly). See it as an example of the thought process, not an actual good model to follow.
1
u/Head-Quote8798 15d ago
I used to avoid algorithmic projects because I struggled with college math too, until I realized chess programming is mostly just basic addition, subtraction, and logic trees. Since you already work as an RPGLE developer, you already have the problem-solving skills to pull this off.
1
u/ThenDetective0 14d ago
You don't need a computer science degree or advanced calculus to build a chess engine. Start with Python, practice algorithms daily and build small projects. Break the dream into smaller steps. You'll get there.