1982 - 1983: HIARCS 5 (0.5)
Following the 'O' level project which became the HIARCS chess program, my mind was made up on what my 'A' level (for those outside the UK this is the exams done at age 17/18) Computer Science project was going to be - HIARCS 5! Henceforth I will call it 0.5 to avoid confusion with commercial versions over a decade later.
Overview
According to the project documentation which I guess is a lot more accurate than my memory, version 0.5 was started in September 1982 and finished 24th March 1983.
The program was written in the BASIC+ (interpreted) programming language and ran on a PDP 11/70 located in Hatfield Polytechnic campus. This was before University, but I was allowed remote access via teletype to produce the project. Earlier while at school I had worked on a similar system to produce the first HIARCS program so I was familiar with this system. I believe the program was initially submitted through punch cards and later edited online by teletype via modem. Certainly I did this for the previous HIARCS versions in 1980/81.
Representation
The board was represented as an array (one dimensional for performance!?) with the square A1 as location 11, A8 as 18, H1 as 81 and H8 as 88. The pieces were represented as Pawn=1, Knight=2, Bishop=3, Rook=4, Queen=5, King=6, positive numbers for computer pieces, negative for player pieces.
An offset method of move generation was used and En passant captures were computed by temporarily inserting a pawn on the En Passant square before move generation began!
Search
The inspiration for the new HIARCS search was sought from the book Chess Skill in Man and Machine and in particular the article "The heuristic search: An alternative to the alpha-beta minimax procedure" by Larry Harris from Dartmouth College. HIARCS was still written in the relatively primitive BASIC programming language and being interpreted it meant the program was rather slow. To compensate for this I developed some heuristics to help guide the search and evaluation in a more targeted way.
The search was based on plausible (mainly tactical) moves generated and searched at plies 1, 2 and 3 with a swap-off evaluation at ply 4 giving some level of tactical security in its play. According to the documentation on its top level searching up to 4 plies HIARCS 0.5 would typically search about 350 positions/moves. Considering the average time spent per move seems to of been about 50 seconds I conclude HIARCS 0.5 was searching a massive 7 nodes (positions/moves) per second (watch out Deep Blue!?)
Ok, so how did it search to such great depths by only searching 350 positions?
HIARCS 0.5 used the following heuristics to decide which moves to search at each ply depth:
- Ply 1: Generated all moves and scored them based on its position evaluation function (more later). The moves were then ordered. Interesting moves such as Checks and Captures were examined earlier than their score might otherwise indicate. It limited the moves selected even at ply 1 based on plausibility! Basically it limited the moves to analyse deeper to 2 positional moves and a selection of high interest tactical moves. If the positional moves proved to be tactically unsound within the 4 ply search horizon, HIARCS was able to reselect another positional move for further analysis.
- Ply 2: Examined all check evasions, checks, captures, forks(!) and pawn promotions.
- Ply 3: Examined all check evasions, captures, forks and pawn promotions.
- Ply 4: Examined all threatened captures to determine swap off values to see if any material was threatened with loss.
Tactical Evaluation
Material BalanceHIARCS used the following values for the material:
Pawn = 100, Knight = 335, Bishop = 350, Rook = 500, Queen = 900, King = 15000
A material balance exchange adjustment was used which encouraged exchanging pieces when ahead in material and discouraged it when behind.
The exchange function was: value of capture = ((totalComputerMaterial / totalPlayerMaterial * valuePieceTaken) - valuePieceTaken) * 4 + valuePieceTaken
For example when a Rook up, exchanging Knights would receive a 37 point bonus.
Swap offsPieces attacking and guarding other pieces and squares were evaluated for exchanges which might lead to some win of material. This included the ability for HIARCS to see forks without actually searching the moves. Often the tactical conditions spotted were not guaranteed outcomes so were evaluated lower than actually winning material but enough to make HIARCS aware of tactical issues and play accordingly.
Amazingly HIARCS seems to have some code to spot pins and include this information in its tactical analysis. I am actually surprised how sophisticated it was in some respects. Please forgive me, this was a long time ago and my memory is not what it might be and despite being written in BASIC it is nice to see some concepts already included.
Check and Mate!HIARCS had special subroutines (Gosub - remember that?) that could compute check evasions based on:
- Capture Checking Piece
- Move King
- Try interposing check
HIARCS used this routine to also spot checkmate much earlier than it could based on its normal search.
Position Evaluation
PawnAdvancing bonus: (rank - 2) * file bonus where file bonus is {1, 0, 4, 6, 7, 3, 0, 0}
Some other limited evaluation but nothing one could call a pawn structure eval!
KnightEvaluated for Centre closeness: (8 - abs(4.5 - rank) *2 - abs(4.5-file)) * 2
For example a knight move Ng1f3 received a bonus of 10
Evaluated for enemy King closenesss: 5 - sum of rank and file distance to enemy king
There were further development bonuses for vacating the back rank and a special fork bonus to encourage forking pieces (even if the search could no resolve the outcome)
BishopBishops were penalised for being on the back rank similar to knights
Bishop mobility was computed as: number of moves * 2 - 7
RookRooks received many bonuses and penalties covering:
- Square control/mobility
- Enemy king closeness
- Open and semi-open files
- Rook on kings rank -1 bonus - e.g. rook on the 7th
- Attack bonus for attacking enemy pawns and pieces
Queens were evaluated for:
- Mobility
- Enemy king closeness
- Attack bonus
The King received rewards for:
- Castling
- Closeness to edge or centre or target pawns!
Source Code
You can see the source code for HIARCS 0.5 here.
Games played in early 1983
You can play through some of the games played by the HIARCS 0.5 version in early 1983 here. In these games HIARCS was running on a PDP11/70 located in Hatfield Polytechnic while I was operating the program via teletype in Welwyn Garden City College Campus in February/March 1983.