Chess Engine in FORTRAN 90

No, I just used the defaults.

1 Like

The program lacks an opening book (a comment, not a criticism – thanks to the author). Suppose you have a text file with opening moves indicating how White should play, say

1.e4 e5 2.Nf3 Nc6 3.Bb5 a6 4.Ba4
3…Nf6 4.0-0 Nxe4 5.d4 ! Black diverges on move 3 – Berlin Defense
3…Nf6 3.Nxe5 d6 4.Nf3 Nxe4 5.d4 ! Black diverges on move 3 – Petroff Defense
1…e6 2.d4 d5 3.Nc3 Nf6 4.Bg5 ! Black diverges on move 1 – French Defense

I wonder how a Fortran program would read such an opening book at start-up and then while playing look up whether a position is in its opening book. Probably o3 could explain :slight_smile:

My understanding is that modern chess engines don’t use opening books, or do they?

I think they do, and Grok agrees. The crude way to program an opening book would be to see if a sequence of moves appears in the book and play the next move in the book if it does. A better approach would be position-based and handle transpositions, so that you play the same move after both

1.e4 e6 2.d4 d5
and
1.d4 e6 2.e4 d5

1 Like

Another chess engine, at least 12 years old, that works similarly, is

It compiles with gfortran, ifx, and g95.

1 Like

This is great, @dmenezes. Also, welcome to the discourse. :slight_smile:

1 Like

With Codex I added an opening book (for the computer when it plays black) and fixed some bugs in the project of the OP. It usually plays pretty well now but sometimes blunders. If you give the sequence of moves to Codex including a blunder it can often fix the algorithm.

1 Like