Hi,
i was working on some Forth Ideas and i had a question, if someone would like to try my chess algorithm. Could someone implement it? It is an idea for evaluating every position. I will explain it. I call this Algorithm the GSG-Algorithm.... for General-Strategic-Game-Algorithm. This algorithm is not the best, but it is able to expand and you can play every game with the right variables.
The normal evaluation says:
F1 + F2 + Fi + Fs - Ffs = Wf
F1 = Coordinates of field one added. For example (E2 would be 5+2 = 7)
F2 = is the field where your piece can move (E4 is 5+4=9)
Fi = is the value of the piece you are moving.
here is the list:
pawn = 1
knight = 2
Bishop = 3
Rook = 4
Queen = 5
King = 6
So and Fs is a variable, which says if a piece can be taken:
If you can take a pawn, then add +20
if you can take a knight, then add +40
if you can take a bishop, then add +50
if you can take a rook, then add +70
if you can take the queen, then add +80
if you can take the king ( check ), then add +100 ( but subtract one field away from this piece, you can't defeat the king.. )
Now Ffs:
If a piece is able to take your piece, then do this calculations:
for every piece, which can defeat you, subtract the Fs value and add on this value +50.
Now something important for the king:
if the computer's king is in check, then the computer has to look, if the king is able to move or a piece is able to protect the king.
if a piece protected a king from check and wants to move away, you have to subtract -100
if a piece can protect the king, then add +100
and if the king can move away, then add +150
Now the workings of the program:
the program has to do this steps:
after initializing the board and setting up the pieces:
1. draw the board
2. wait for an input
// for this program i don't think it's a good idea to check for a legal move
3. make whites move ( you can program the computer to play black or white, if you change the code of the pieces)
4. now store all legal moves of black ( including, if black is in check )
5. calculate all moves and store the best move
6. make the move
7. goto 1
this is all. Just an idea of an 9. grade boy, who plays chess :D . Ok the system is complex, but you all can understand it and the algorithm can be expanded by another variables.
I am writing a BASIC version for the ZX81 computer ( I call it PeChess ). So if someone is interested in or has some questions, then ask.
I hope you all understand, it's just a simple algorithm, but if you are a bad chess player, the program will maybe win :D.
Greetings
Christoph