Can I create a chess engine using Fortran 90?

In summary: I think I might be able to compile it into an executable but I don't know if I need to include the library dll or not.No problem, I'll let you know if I'm able to do that.
  • #1
fluidistic
Gold Member
3,923
261
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
  • #2
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:
  • #3
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.
 
  • #4
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.
 
  • #5
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.
 
  • #6
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:
  • #7
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.
 
  • #8
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.
 
  • #9
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.
 

1. What is Fortran 90?

Fortran 90 is a programming language commonly used in scientific and engineering applications. It is an updated version of the Fortran 77 language, with added features such as dynamic memory allocation, modular programming, and built-in data types.

2. What is a chess engine?

A chess engine is a computer program that is capable of playing chess autonomously. It uses algorithms and artificial intelligence techniques to analyze positions and make moves based on pre-defined rules and strategies.

3. How does Fortran 90 relate to a chess engine?

Fortran 90 can be used to write the code for a chess engine. It provides the necessary tools and features for creating complex algorithms and data structures, which are essential for building a strong and efficient chess engine.

4. What are the advantages of using Fortran 90 for a chess engine?

Fortran 90 is a high-level language with a simple and elegant syntax, making it easy to write and maintain complex code. It also allows for efficient use of system resources, which is crucial for a computationally intensive task like playing chess.

5. Can Fortran 90 be used to create other types of engines?

Yes, Fortran 90 can be used to create various types of engines, such as game engines, search engines, and simulation engines. Its robust and flexible nature makes it suitable for handling complex and data-intensive tasks in a wide range of scientific and engineering fields.

Similar threads

  • Programming and Computer Science
Replies
17
Views
4K
  • Programming and Computer Science
Replies
12
Views
2K
  • Programming and Computer Science
Replies
8
Views
1K
  • Programming and Computer Science
Replies
17
Views
4K
  • Programming and Computer Science
Replies
12
Views
1K
  • Programming and Computer Science
12
Replies
397
Views
13K
  • Programming and Computer Science
Replies
4
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
7
Views
1K
  • Programming and Computer Science
Replies
5
Views
2K
  • Programming and Computer Science
Replies
2
Views
1K
Back
Top