I wrote a chess program in 1994 for an assignment in college.

Sort:
hitfan

I recently scanned it and uploaded it to my GitHub:

https://github.com/gdeblois/GDB-Chess1-1994

This was a major assignment where we had to choose a relatively difficult computer problem, so I proposed that I write a chess program for the class.

Silly me waited all semester until 4 days before it was due before I even wrote one line of code or a single word for the text of the document that I uploaded.  I spent 18 hours every day for 4 days churning a very rushed program written in Borland Turbo BASIC.

If any of you here happen to have Borland Turbo BASIC, I would be eternally grateful if you can transfer the OCR txt file with the source code (the original disk was lost, so I scanned the source code and then OCR'd it the best that I could with an online tool).  Maybe the one that does it can fork it on GitHub and be a contributor.

From my cursory reading on chess programming on the internet these past few days, my game uses a 2 ply search method to find the best possible move.  It basically has most of the rules of chess, but en-passant is most notably missing.

For the chess programming experts here I'd like to say in my defense that this program was written well before chess programming concepts were readily available on the internet (1994 was just before the WWW started to become widely accessible).  My college still had VT-100 terminals connected to old PDP-11s and VMS servers.

I'm creating a sequel to this program that is being written in C# .NET right now.  Once my chess engine is ported over, then I will make another follow-up to implement the more advanced features of computer chess.

u0110001101101000

Did you really write a working chess program as a student in 4 days? That seems pretty impressive... you must have done similar projects in the past?

I don't know anything about Borland Turbo BASIC though, sorry.

hitfan

Yes, I effectively wrote a chess program in 4 days. Now, During my procrastination in putting off in doing the actual work to write thhe program I actually thought over on how to write a chess program in the meantime.

But during those 4 days I had this "sink or swim" attitude that it was time to get serious and get to work. I went on a coding marathon to get it done.

EscherehcsE
hitfan wrote:
If any of you here happen to have Borland Turbo BASIC, I would be eternally grateful if you can transfer the OCR txt file with the source code (the original disk was lost, so I scanned the source code and then OCR'd it the best that I could with an online tool).  Maybe the one that does it can fork it on GitHub and be a contributor.

I don't have a copy of Turbo Basic, but it's easy to get. I just went to the Wikipedia entry for Turbo Basic, and it had links to the abandonware Turbo Basic and a couple of manuals. I'm assuming you'd have to set up Turbo Basic inside DosBox. If I had lots of extra time to kill, I could key the source into Turbo Basic, but unfortunately I'm very busy right now.

Another-Life

If it wasn't OCR I would bother.  But I am afraid it will not be compilable, there must be some mistakes in OCR 

EscherehcsE
Another-Life wrote:

If it wasn't OCR I would bother.  But I am afraid it will not be compilable, there must be some mistakes in OCR 

He has the complete source code listing in his college report. Had I done this, I probably would have transcribed it directly from his report.

solskytz

I find the story impressive. 

How much talented people can do per unit of time

How much all people tend to put things off...

And how some talented people just know, how far they can let things slide, and when is the exact moment that something actually tends to get done. 

Of course, we could all work calmly and industriously and get 4X more done with our available time, rather than play these games with ourselves... such as also right programs for backgammon, checkers and go and pass the exams with flying colors...

But alas, not the way things work :-)

ArgoNavis

The correct way to study for an exam

Start studying the day before

Get an A+

Mock those who studied more than you and got a lower mark.

Another-Life

Start studying the day before.

Get an F.

Watch as clueless stupid people have gotten good grades because they aren't lazy.

Be a disappointment to your family.

ArgoNavis
Another-Life escribió:

Start studying the day before.

Get an F.

Watch as clueless stupid people have gotten good grades because they aren't lazy.

Be a disappointment to your family.

You do that if you're not intelligent enough.

u0110001101101000

Grades aren't as important as learning, so it doesn't really matter how much you study or what grades you make as long as you learn. And after you're hired they'll pretty much only care about your work ethic. Making a habit of procrastination isn't the end of the world... but it's not ideal heh.

u0110001101101000
Don_frye1 wrote:
0110001101101000 wrote:

Grades aren't as important as learning, so it doesn't really matter how much you study or what grades you make as long as you learn. And after you're hired they'll pretty much only care about your work ethic. Making a habit of procrastination isn't the end of the world... but it's not ideal heh.

Be sure to tell your potential boss that your c+ average doesn't matter since you learned a lot. Im sure he'll understand.

Actually some employers don't give a **** about your grades.

I mean, they shouldn't be terrible of course, but if your references like classmates are saying "he'd wait till the last minute to start a project" or "he only showed up to the tests" then that's a big red flag too.

Elubas
kingofshedinjas wrote:
Another-Life escribió:

Start studying the day before.

Get an F.

Watch as clueless stupid people have gotten good grades because they aren't lazy.

Be a disappointment to your family.

You do that if you're not intelligent enough.

Oh trust me I would try that all the time. In the junior and senior years of college it finally started not to work too well anymore. I mean I would maybe get a c or something, but it starts to become a real grind working that way. Even if you study 10+ hours the day before, the brain can only take in so much information at a time.

bunicula

That's what the technical interview is for. Scoring for exams and building amazing products are often two very different things. But then what would an undead bunny know?

Don_frye1 wrote:

0110001101101000 wrote:

Grades aren't as important as learning, so it doesn't really matter how much you study or what grades you make as long as you learn. And after you're hired they'll pretty much only care about your work ethic. Making a habit of procrastination isn't the end of the world... but it's not ideal heh.

Be sure to tell your potential boss that your c+ average doesn't matter since you learned a lot. Im sure he'll understand.

bunicula

Also gnuchess has been available since the mid 80s

u0110001101101000
bunicula wrote:

That's what the technical interview is for.

Yes.

hitfan

I have the .img files for Turbo Basic -- I'll figure out how to attach these to DOS BOX and see what I can do.

Having much more fun re-doing this game in C# .NET anyhow. My goal is to eventually get it to play other chess engines.

EscherehcsE wrote:

hitfan wrote:

If any of you here happen to have Borland Turbo BASIC, I would be eternally grateful if you can transfer the OCR txt file with the source code (the original disk was lost, so I scanned the source code and then OCR'd it the best that I could with an online tool).  Maybe the one that does it can fork it on GitHub and be a contributor.

I don't have a copy of Turbo Basic, but it's easy to get. I just went to the Wikipedia entry for Turbo Basic, and it had links to the abandonware Turbo Basic and a couple of manuals. I'm assuming you'd have to set up Turbo Basic inside DosBox. If I had lots of extra time to kill, I could key the source into Turbo Basic, but unfortunately I'm very busy right now.

hitfan

My only resource was Botvinnik's book on computer chess that he wrote in 1970 at the time. Was completely unaware of gnuchess back then.

bunicula wrote:

Also gnuchess has been available since the mid 80s

Another-Life
hitfan wrote:

My only resource was Botvinnik's book on computer chess that he wrote in 1970 at the time. Was completely unaware of gnuchess back then.

 

 

 

 

bunicula wrote:

Also gnuchess has been available since the mid 80s

Check this guy's programs

 

http://nanochess.org/chess6.html

hitfan

So I figured out how to convert an OCR'd text file of my Borland Turbo BASIC chess program into an actual file that can be read by Borland Turbo BASIC.  Since the chess game can only be played Computer VS Computer and it had a crude text-based interface, I decided to add some graphics (albeit in CGA format) as well as showing chess notation on the screen as the game is played.

On an old early 1990s PC, my chess engine would take about 2-3 minutes per move.  Running in DOSBOX on a modern computer with the parameter "cycles=max" it takes only a few seconds.  It would probably perform each move almost instantaneously once I finally port it to C# .NET, but I want to be as familiar as possible with my old code before I do that.

Here's a screenshot of a game in progress.  Obviously, the chess engine is not exactly a world beater here.  But I did write the original engine under a lot of time pressure at the time.

My old CompSci teacher did ask me back then he'd like for me to make it playable with a user (Human VS Computer), once I finally make it playable against a human I might just contact him via FaceBook and tell him I finally acquiesced to his desire for me to make it playable by him.

Things still to implement:

  • En-Passant
  • Allow for Human VS Computer playing mode.
  • Promotion to other pieces (currently, it autopromotes to Queen)
  • Check for Draw
  • Checkmate ends the game (currently, your King can be captured and the game will keep playing)
  • Make the chess engine play with some randomization (currently, it plays the same Computer VS Computer game over and over again).
  • Convert it to C# .NET and make it an Object-Oriented program so that it can play beyond 2 plys.