Fortran Can I create a chess engine using Fortran 90?

AI Thread Summary
A beginner in programming seeks resources for creating a chess engine in Fortran, noting that some older engines were developed in this language. A user provides a link to a relevant thread on comp.lang.fortran, where a Fortran chess program is discussed. The program's source code is available for download, and it is noted that it compiles correctly using the Silverfrost FTN95 compiler, though runtime error checking must be disabled due to issues with uninitialized arrays. Users discuss their experiences with debugging, the differences between debugging tools, and the challenges of creating standalone executable files. One user successfully compiles a version of the chess engine using the g95 compiler, which produces a standalone executable without requiring additional libraries. The conversation highlights the collaborative nature of troubleshooting and improving code among users interested in Fortran programming.
fluidistic
Gold Member
Messages
3,928
Reaction score
272
I'm just a very beginner when it comes to program and I have a question. I've read that some (old) chess engines are written in fortran so I know it's possible to create a chess engine using the fortran language. I wanted to know if someone has a link or a file providing the source of a chess engine which was written in fortran.
 
Technology news on Phys.org
Hi fluidistic,

fluidistic said:
I'm just a very beginner when it comes to program and I have a question. I've read that some (old) chess engines are written in fortran so I know it's possible to create a chess engine using the fortran language. I wanted to know if someone has a link or a file providing the source of a chess engine which was written in fortran.

It's not an old program, but you might be interested in looking at a program posted on comp.lang.fortran several months ago. If this link works, you can find the thread at

http://groups.google.com/group/comp...781e802adfc2?lnk=gst&q=chess#4f85781e802adfc2

or you can go to

http://groups.google.com/group/comp.lang.fortran/topics

and search the group for "chess". (In the thread itself, about five posts down there are some links that might be interesting, including an old paper by Shannon.)

The program itself is posted several times in the thread (being corrected as comments about it are made), and the final version of the program is posted at

http://samanddeanus.no-ip.org/chess.f90

where you can download the source file. (Of course, the browser does not display it properly.)
 
Last edited by a moderator:
Thank you alphysicist for having done the research. (I tried but wasn't that successful). Seems a bit too hard for me to understand it all but I'll do my best to understand it well and why not make it better then.
 
The good thing is that it is a relatively short program, so I think it would be easy to play around with, and to see how well any changes you make affect it. Unfortunately I am not much of a chess player, so I don't know how good it actually is.
 
Unfortunately I am not much of a chess player, so I don't know how good it actually is.
I know it's hard to evaluate on a single game but I beat it with ease. It's maybe around 1400-1500 Elo. Not that bad though. Maybe I can change the program to calculate deeper in depth. It would slow it down but increase its strenght.
 
Yes thanks for the link alphysicist, I also found it quite interesting to look at that code.

BTW. This program compiles correctly on "silverfrost" fortran95 (free/evaluation version), but you have to compile it with runtime error checking (debugging) disabled or else it gets runtime errors. The errors seem to be due to some arrays not being initialised properly, though I'm pretty sure those elements of the array that are actually being used have in fact been initialised, otherwise I doubt that the program could run correctly.
 
Last edited:
uart,

I appreciate you mentioning the errors. I was unable to see what you were referring to, but I finally figured out (I think) that you were using checkmate (appropriately enough!) and I was using debug. From a bit of playing around it looks like debug just assigns some garbage value to an uninitialized variable, while checkmate does better by leaving it as undefined.
 
Yeah, the Plato IDE with the silverfrost (salford) FTN95 that I'm using automatically complies/links with the checkmate debugger and the code halts with a run time error in the "EVALUATE" fuction due to array "CC" being un-initialised.

At first I added code to zero CC on the entering EVALUATE and that got rid of the error. Then I realized that perhaps the un-initialised elements of CC were just being passed but not actually used in any real calculations. So I took the initialistion code back out and compliled/linked manually with the debugger off, which gave the most efficient working code.
 
I'm using the same program, except instead of the plato IDE I have it plugged into visual studio .net. For some reason, when you use VS instead of plato it uses the DEBUG debugger by default, although you can still choose to use CHECKMATE, and I'm thinking now about starting to do that.

I remember looking on the web some time ago for the differences between debug and checkmate, but was unsuccessful (just found a lot of 'selling points' about checkmate); this is the first difference between the two I have actually come across.
 
  • #10
alphysicist said:
I'm using the same program, except instead of the plato IDE I have it plugged into visual studio.

Thanks Al, could you please let me know if your compiler produces a stand-alone executable file or if you need to also copy the library dll (salflibc.dll) if you want to run that compiled chess program on another computer?

At the moment I'm making a really small chess.exe file (only 28k) but it relies on the libraries in salflibc.dll to run. I'd really like to make a stand alone exe file but I'm not sure of the linker options required to do so.

I've been trying to figure this out in another thread here : https://www.physicsforums.com/showthread.php?t=257746
 
  • #11
As far as I know, using silverfrost you have to include salflibc.dll for the executables to run. (You mean binding just the needed parts of salflibc.dll to your executable, right? I've never seen that capability mentioned for the silverfrost compiler.)

I also use g95, and I believe it requires cygwin.dll to run its executables.
 
  • #12
You mean binding just the needed parts of salflibc.dll to your executable, right?

Yeah that's what I was looking for. Anyway if it doesn't have it then I'll stop looking.

Thanks.
 
  • #13
uart said:
Yeah that's what I was looking for. Anyway if it doesn't have it then I'll stop looking.

Thanks.

uart,

I've been thinking about this question, and I went back to look at the g95 compiler. I think that g95 has been updated so that it might actually produce stand-alone executables and not require cygwin.dll anymore. I have a clean laptop around here somewhere so I'll try it out and see if it works.
 
  • #14
Okay, I guess I have to correct myself. Using the g95 compiler gives a 330kB executable that can run on a machine with essentially a new windows install.
 
  • #15
Yep I just tried the g95 compiler and it woks great. Thanks for the suggestion.
 

Similar threads

Replies
8
Views
1K
Replies
17
Views
6K
Replies
12
Views
3K
Replies
4
Views
2K
Replies
8
Views
2K
Replies
2
Views
2K
Back
Top