Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Fortran 90 - Chess engine

  1. Sep 18, 2008 #1

    fluidistic

    User Avatar
    Gold Member

    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.
     
  2. jcsd
  3. Sep 18, 2008 #2

    alphysicist

    User Avatar
    Homework Helper

    Hi fluidistic,

    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.)
     
  4. Sep 19, 2008 #3

    fluidistic

    User Avatar
    Gold Member

    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.
     
  5. Sep 19, 2008 #4

    alphysicist

    User Avatar
    Homework Helper

    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.
     
  6. Sep 19, 2008 #5

    fluidistic

    User Avatar
    Gold Member

    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.
     
  7. Sep 20, 2008 #6

    uart

    User Avatar
    Science Advisor

    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: Sep 20, 2008
  8. Sep 20, 2008 #7

    alphysicist

    User Avatar
    Homework Helper

    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.
     
  9. Sep 20, 2008 #8

    uart

    User Avatar
    Science Advisor

    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.
     
  10. Sep 21, 2008 #9

    alphysicist

    User Avatar
    Homework Helper

    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.
     
  11. Sep 21, 2008 #10

    uart

    User Avatar
    Science Advisor

    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
     
  12. Sep 21, 2008 #11

    alphysicist

    User Avatar
    Homework Helper

    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.
     
  13. Sep 21, 2008 #12

    uart

    User Avatar
    Science Advisor

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

    Thanks.
     
  14. Sep 21, 2008 #13

    alphysicist

    User Avatar
    Homework Helper

    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.
     
  15. Sep 21, 2008 #14

    alphysicist

    User Avatar
    Homework Helper

    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.
     
  16. Sep 27, 2008 #15

    uart

    User Avatar
    Science Advisor

    Yep I just tried the g95 compiler and it woks great. Thanks for the suggestion.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: Fortran 90 - Chess engine
  1. Fortran 90 (Replies: 7)

  2. Fortran 90 (Replies: 1)

  3. Fortran 90 (Replies: 1)

Loading...