Neurosis 2.1                     By Stan Arts                    29 November 2006
------------------------------------------------------------------------------------

Neurosis is my 3rd attempt at writing a computerchessprogram.

(My earlier chess and other programs can be found at.: 
 www.geocities.com/tasteofinsanity81/stanspage ) 

My name is Stan Arts, 25, live in the Netherlands. 


Configuration options. 
---------------------------------------------------------------------

Configurationsettings you can set and change in the configuration(text)file
NConfig.txt. In there you will find comments on how to use, and how to set the
commands. Hashtablesize, contemptfactor and videomode are also used by Neurosis3D,
the rest of the options are for the Winboard version of Neurosis. (Most other
options you can set separate in Neurosis3D itself.) 

My program understands eleven possible commands. Please include them all in the
configurationfile, and then turn them on or off. The default settings are:

ht 16
log 0
sol 0
hum 0
spe 0
slw 0
var 0
rsn 0
ctf 0
kib 0
vid 0

For the Winboard version, make sure you have NConfig.txt, and Neurosis.bk (opening-
book) in the same folder and location as the program Neurosis.exe.

For the 3D version, make sure to have NConfig.txt, N3D.dll, N3D.dat and Neurosis.bk
in the same folder and location as the program N3D.exe.


Options and commands for the Winboard-compatible version. (Neurosis.exe) 
--------------------------------------------------------------------------

Neurosis understands timecontrols sent with the level command, fixed time per move
sent with the st command, and fixed search depth sent with the sd command. (With a
minimum of 2 ply, and a maximum of 40 ply.)
It supports force mode, and therefore edit-game mode etc. Further it accepts
positions sent with setboard in FEN format. Out of the FEN line it will read the
position, and castle posibilities. The enpassant square and 50 move rule counter
are not read out of the FEN-line. (never cared to implement)
Neurosis can do shuffle-chess in Arena. Neurosis will accept any type of position,
even if it is not fully legal, (for instance, pawns on the lowest rank, or
something like 20 queens from one side, that can not happen in a real game) as
long as the position has a white and black king. 
Neurosis WB does not ponder, it can not read winboard commands while it is
thinking. Therefore I don't let it support analysis-mode, but you can easely let
Neurosis look at a position by having it think for a longer time. I made a special
option so you can set timecontrol of 1 move in x minutes, it will then use this
time exactly. Send a command such as: level 1 10 0 (one move in ten minutes) , and
it will look at the position for 10 minutes. (Minus 5 seconds, that my program will
not use to avoid going through a time-flag.) 
When Neurosis has received the xboard command, it will not display the ASCII
chessboard every move, and it will send it's book-move in a way so that winboard
can read and display it. 
My program supports and will play castling, en-passant and underpromotions. 
Neurosis will claim result when the game ends in: mate, draw by stalemate, draw by
3x repetition, draw by the 50 move rule, and resigning the game.
My program will display a hintmove when you request one. It can only give a hint
after it calculated the last move. When you request a hint while Neurosis is still
in book, or directly after you set up a new position, it will display "none".

How to use Neurosis3D. (N3D.exe) The 3D stand alone graphical version.
----------------------------------------------------------------------

Before running Neurosis3D, make sure your computer can meet the following
system requirements:

- It's atleast an MMX compatible processor.
- Atleast 32 MB free internal memory available. (More, if you set Neurosis to 
  use more (hashtable)memory in NConfig.txt.) 
- Can run at 800x600 at 65536 colours (16-bit colours) as a full-screen mode.
  (In NConfig.txt you can set Neurosis3D to use a higher 1024x768 resolution.)
  3D card or any sort of graphicsdrivers aren't used or needed.
- Make sure your mouse works without problems. 
- All the data-files that belong to Neurosis3D are in the same folder as the
N3D.exe main file and that you start the program from this folder. Also when you
want to save a played game or enable the log-file, make sure you aren't running
the program from a CD-ROM and that your disk isn't full. The games will be saved
in the same folder all the N3D files are in.

After starting N3D you are in the main menu. 

With "options" you are able to set all the options for the game. 
Enable or disable options by clicking the small boxes with your mouse. Select
a timecontrol to play at. This only sets the computer's playing speed, and you
won't get flagged for thinking too long. With "show computer's thinking" you can
select if you would like to see what the computer thinks of the position and
what it would like to play and expects you to play.
The "show movelist" option will show a small box with the moves of the game. You
can scroll up and down by clicking the up and down arrow at the left side of the
box. 
You can change side to play, but not during a game. When you do so, it will
automaticly start a new game. If you want to change sides with the current 
boardposition, use edit boardposition, and change your playside. (But time used
by both sides will then be set to 0.)
There are 4 main levels of play. Default is Neurosis at full speed, and it will
use all the computer's speed for thinking, suitable for strong players. The second
option will limit Neurosis's speed to about 5000 nodes/second and will play a bit
weaker. At the third option Neurosis will run at just approx. 500 nodes/sec, and
it will not be able to think very deeply. At the lowest setting Neurosis will also
run very slowly at about 500 nodes/sec, and also further limit search and
knowledge in many ways, simulating a beginner in chess.
Toggle "use time more realistic" to make Neurosis use it's time more human-alike.
For example, not to move instantly when playing moves out of the openingbook, and
vary it's time a little more.
Use the "speculative" modes to sometimes let Neurosis find positional advantages
more important then material, and might sacrifice material for positional
advantages. This can lead to more interesting gameplay. 
With the vary option Neurosis will use small random values in it's search to
vary it's play to some extent. 
Set "ponder in your time" to let Neurosis think in your time. (essentially giving
it more time to think, when it predicted your move correctly.)
You can change the number of nodes before letting Neurosis recalculate and draw
a new screenframe. Normally the lowest setting will be fine, but if you want the
highest chessperformance out of Neurosis3D, you can set it to a higher setting,
where more processingpower will be available for chess calculation, at the cost
of new screenframes drawn per second.
 
There are 3 available backgrounds/enviroments for the 3D room. Default is none,
but you can select the background to be a room.  Also you can select the dots as a
bit of a computeristic background. They are mostly to give a background reference
when you are flying around.
You can select several different boardcolours. They are stone, wood, green and
blue. 
Also you can select a different colour for the white pieces. These can be wood
or white. The black pieces are always grey, but can be turned light or dark. 
Select the 2D perspective to see the board from above. To see the board from the
opponent's side in 2D mode select the flip-2Dboard option.
Switch log-file (it will create a file named N3Dlog.txt in the current folder) on
to review after the game what Neurosis was thinking. When a N3Dlog.txt file
already exists, it will be overwritten when switched on.
Change the size of the pieces by selecting another percentage. Normaly the pieces
are quite small to give the impression of a large tournament board, but you might
prefer the pieces to be bigger compared to the board. You can switch on and off
if captured pieces should be kept next to the board, so you can keep better track
of what's happening and the material balance.  
 
With "edit boardposition" you can setup a new boardposition to play. It's use is
straightforward. However note that when clicking edit boardposition, the time-
clocks will be set to 0, even when you don't change the position. To use a position
you created, you have to go back to main menu and click "resume current game". 

Click "Save to PGN-file" to save your current game to a pgn-file. Many other
chessprograms such as Winboard are capable of reading these files. (Also, the 
PGN's are in readable format, so you can open them with any text-editor and print
them.) 
After clicking this option you have to select game1 to 5 as a filename. Note
that existing files will be overwritten. When you play many games please copy
existing files to another folder, or rename them, to keep them.

"Help and info" is a screen with some info about Neurosis3D and short help on 
how to use the program.

With "Start new game" a new game at the selected timecontrols and playside will
start.  By pressing the Escape key while in the game, or clicking the upper-left
button you can return to the main menu. Then you have to use the "resume current
game" option to return to the current game.

Click "quit the game" to exit Neurosis3D and return to windows.

Neurosis3D will also use a contemptfactor if you set one in NConfig.txt.

Hold the right mousebutton or spacebar and move the mouse around to change your
viewing direction.

Press the up, down, left or right arrowkey on the keyboard to fly into the 
direction you like.

Playing chess with my program.:  Just select the piece you would like to move by
clicking (with your left mousebutton) on the square the piece is on. It will then
light up. Then move your mouse to the square you would like to move the piece to
and click again. Neurosis will make sure your move is legal, so when the piece
doesn't move make sure you selected the right square, that it is a legal move,
that it is your turn to move, and your king isn't in check. Please refer the 
"rules of chess" section below of this readme file, or other chess-documentation
if you are unfamiliar with the rules of chess.


The rules of chess in short, and some tips to get started.
-----------------------------------------------------------
 
Here is a quick explanation of the rules of chess. Please refer to other chess-
documentation for a more detailed explanation.

Chess is a boardgame, and it's played on 64 squares. (8 rows and 8 collums.)
There are always 2 players and one side has the white side, and one side has the
black side. 

Each side has pieces, which could represent an army or a kingdom if you like. 

The goal of the game is to capture the opponent's king. When the opponents king
can not avoid capture anymore the game ends and you win. (This is called check-
mate, the actual kingcapture is never played.)

For each side, there are 6 different pieces, and they can all move in a different
way. As you'll find out, the way each piece can move will turn out to be very
important for it's value or importance in the game. 

A list of the pieces and their movement :

The Pawn.   The pawn is least important of pieces, and that is because it is most 
limited in it's movement. It can only move forward (never backwards) one square at
a time. And it may only move forward when there is no piece on the square infront.
There are however a lot of exceptions to the pawns movement where it can move in a
different way.: When it is still in it's original place on the 2nd row, it may
jump forward 2 squares, when both squares infront are free. 

. . . . . . . .8 black
. . . . . . . .7
. . . . . . . .6
. . . . . . . .5
. . . . . * . .4  < it may go here because it was still on the 2nd original row
. . . . . . . .3
. . . . . P . .2  < 2nd row
. . . . . . . .1 white
a b c d e f g h 

A pawn can "capture" a piece (capturing in chess is done by landing on the enemy
piece and taking it's square. Unlike checkers for example, where you jump over
the enemy piece to capture it.) when it is 1 square up and to the left or right
of the pawn. 

. . . . . . . .8 black
. . . . . . . .7
. . * . * . . .6  < It can only capture pieces on the *'s . 
. . . P . . . .5
. . . . . . . .4  
. . . . . . . .3
. . . . . . . .2  
. . . . . . . .1 white
a b c d e f g h 

A pawn can become very important, when it has managed to get all the way across
the board and reaches the 8th row. Then it "promotes", and you can choose it to
become either a Queen, Rook, Bishop or Knight.  

There is one special chessmove for the pawn, that is called an en-passant
pawncapture, and it can be played when you reach the 4th row of the opponent (5th
row of the board in the case you are white) and the opponent has a pawn on the
original row eighter 1 square left or right of your pawn. When the opponent
chooses to play his pawn on the original square 2 squares forward so it lands
directly left or right from your pawn, you can choose to capture it. This is the
only case in chess where a capture doesn't happen on the square the enemy piece
is on. And you place your pawn 1 square forward and 1 square eighter left or
right (depending on what side the opponent pawn is on) and take the opponent's
pawn of the board. It can only be done DIRECTLY after the opponent played up his
pawn two squares.

. . . . . . . .8 black
. . . . = . . .7  < original square of the opponents pawn.
. . . . * . . .6  < You can capture to the e6 square, and take his pawn off.
. . . . p P . .5  < The opponent moved his pawn up two squares.
. . . . . . . .4  
. . . . . . . .3
. . . . . . . .2  
. . . . . . . .1 white
a b c d e f g h 

The Knight.  The knight is more important than a pawn, because it can move more
freely over the board. Unlike the pawn, it can move forward but also backward.
When capturing it always has to land on the square occupied by the opponent's
piece. The knight is special because it can jump over any piece, and move in a L
shape. It always moves eighter 2 squares up or down or to the left or right, and
1 square up or down or to the left or right but always in a 90 degree angle to the
2 square direction. In English notation the Knight is often refered to as N,
(kNight) because the King already uses the K. 

. . . . . . . .8 black
. . . . . . . .7  
. . . * . * . .6  
. . * . . . * .5  
. . . . N . . .4   < your knight can land on all the *'s . 
. . * . . . * .3
. . . * . * . .2  
. . . . . . . .1 white
a b c d e f g h 

The Bishop.  The bishop is capable of moving in a diagonal way. This may be
forward, left or right but also backward. It can not jump over any pieces so the
line must be free and the square you want it to go to can't be occupied by any of
your own pieces. But it can capture an opponent's piece by landing on it. You'll
notice each side has a bishop on a light square and a dark square, a bishop can
never leave the light or dark squares it started the game on. 

. . . . . . . *8 black
* . . . . . * .7  
. * . . . * . .6  
. . * . * . . .5  
. . . B . . . .4   < your bishop can go to all the *'s . 
. . * . * . . .3
. * . . . * . .2  
* . . . . . * .1 white
a b c d e f g h 

The Rook.   The rook is one of your more important pieces, because it has 
impressive power and force. The rook is similair to the bishop, but instead of
diagonal lines, the rook moves in a straight line. These can be left, right but
also forward and backward. Just aslong as the line is free and the square you
want to go to isn't occupied by any of your pieces. It too may capture opponent
pieces by landing on them. 

. . . . * . . .8 black
. . . . * . . .7  
. . . . * . . .6  
. . . . * . . .5  
* * * * R * * *4   < your rook can go to all the *'s . 
. . . . * . . .3
. . . . * . . .2  
. . . . * . . .1 white
a b c d e f g h 

The Queen.  The queen is your most important combating piece, because she has
the greatest power in movement and force. She is a combination between a bishop
and a rook. 

* . . . * . . .8 black
. * . . * . . *7  
. . * . * . * .6  
. . . * * * . .5  
* * * * Q * * *4   < your queen can go to all the *'s . 
. . . * * * . .3
. . * . * . * .2  
. * . . * . . *1 white
a b c d e f g h 

The King.  Although the king is your most important piece of the game, it can't
move as far and as powerfull as the queen.  The king can move the same as the
queen but it can only move 1 square at a time. It can capture similair to other
pieces but you can't let it capture a piece when it could be captured afterwards
itself. (Can not put itself in check)

. . . . . . . .8 black
. . . . . . . .7  
. . . . . . . .6  
. . . * * * . .5  
. . . * K * . .4   < your king can go to all the *'s . 
. . . * * * . .3
. . . . . . . .2  
. . . . . . . .1 white
a b c d e f g h 

The king (and rook) have a special move, called castling. It allows the king to
get away from the centre of the board, and be more protected. 

. . . . . . . .8 black
. . . . . . . .7  
. . . . . . . .6  
. . . . . . . .5  
. . . . . . . .4   
. . . . . . . .3
. . . . . . . .2  
. . . . K # * R1 white
a b c d e f g h 

In this case, the king (on e1) can be moved to g1, and the rook (on h1) to f1.
But only, if -The king and rook haven't moved before -The path between the two
pieces is free -The squares e1,f1 and g1 are not in check.

The resulting position would be : 

. . . . . . . .8 black
. . . . . . . .7  
. . . . . . . .6  
. . . . . . . .5  
. . . . . . . .4   
. . . . . . . .3
. . . . . . . .2  
. . . . . R K .1 white
a b c d e f g h 

This is called a short ("kingside") castle. It is also possible to castle
long, to the queen side. See below.

. . . . . . . .8 black
. . . . . . . .7  
. . . . . . . .6  
. . . . . . . .5  
. . . . . . . .4   
. . . . . . . .3
. . . . . . . .2  
R . * # K . . .1 white
a b c d e f g h 

In this case, the king (on e1) can be moved to c1, and the rook (on a1) to d1.
The same rules as for a short castle count, but square a1 and b1 may be in check. 

For black, it is also possible to castle, when pieces are in the same order but
on the 8th row.

When any of the opponents pieces aim (fall in the movement reach of that piece,
and could capture your king next move) at your king, then your king is in "check"
and you MUST get out of check, eighter by moving out of the way or capturing the
opponents piece or place something in between. When you can't avoid the check it 
is checkmate and the game is over. However, when you are not in check but you can
not move without putting your own king in check or have no other legal moves then
it is stalemate and the game is a draw. (Draw = neither side wins.) 
The game also ends in draw when the same boardposition occurs 3 times, (with all
conditions being the same those 3 times.) or there has not been a pawnmove or
capture by any piece for 50 moves, then the game ends in a draw by the 50 move
rule.

As I already wrote some pieces are more important than others because of their
movement. A queen can be far more helpfull than a pawn. The goal of the game is
to "win" the opponent's king, however this is made difficult by the army forces
the opponent has, and this makes that you have to try to break his/her army.
Usually this is done by outsmarting your opponent in traps or "combinations"
where your opponent loses more material then you do. 

It is important to keep your eye on your material and try to keep your valuable
pieces. When trading, you should think and calculate if it is a good idea, and in
general you could award the pieces the following scores. : 

King   : has infinite importance
Queen  : 9 points
Rook   : 5 points
Bishop : 3 points
kNight : 3 points
Pawn   : 1 point

There are however a lot of exceptions to this. A pawn near the 8th rank can be
worth as much as a queen, and a bishop is usually worth slightly more then a
knight. (Depending if the opponent has many pieces on the square-colour of 
your bishop for instance, and many other factors) A knight near the centre
or near the opponent's weaknesses can be very valuable and maybe worth a rook.
And an undeveloped piece or a piece unable to move somewhere in the back can be
worth very little, to give a few examples.

The starting position is as following: (CAPS are the white pieces)

r n b q k b n r  8 black
p p p p p p p p  7  
. . . . . . . .  6  
. . . . . . . .  5  
. . . . . . . .  4   
. . . . . . . .  3
P P P P P P P P  2  
R N B Q K B N R  1 white  

a b c d e f g h 

Where you can remember that the queen of both white and black is always on the 
d-collum and kings are always on the e-collum. (The white queen starts always on
a light square, and the black queen always starts on a dark square)
At the start of the game, white begins. 

At the beginning of the game, try to get your combating pieces of the back row,
and make them active on the board. You should try to occupy and control more space
then your opponent, this will make it easier for you to come up with plans and to
move around. Besides making your pieces active, try to get your king in a safe
place as fast as possible, this will give the opponent far less chances. (For 
example by castling your king to a safe corner.)

Goodluck ! 


Info about Neurosis. 
---------------------------------------------------------------------

Neurosis is written in Pascal, and compiled with the Free-Pascal compiler.
(www.freepascal.org) The winboard version of Neurosis will run on any 386 and up,
but Neurosis3D requires atleast an MMX-compatible processor.

Contact me for a more technical description of the workings of Neurosis.

Some quick further comments on it's behaviour:

Neurosis will display moves in short notation. For instance: e4, or Nf3. Also it
will always report (also in the best line) when a move leads to check with a +, and
ep when it is an enpassant move. When two or more pieces can move to the same
square, then Neurosis will write the move out long. For example: Nf1xe5+ instead of
Nxe5+ or Nfxe5+. 

My program searches with score-bounds, and when a position is found to be better
or worse, it will display < + > to say it will be better, or < - > if it saw it
will be worse, and it will do a research to determine the correct score and best
line. Note, when it is in the process of doing a re-search and displaying a < + >
or < - > , the hint-move and best line given might not be a good one. Neurosis
opens up it's search window in more then one step sometimes when there's a big
scorechange. Giving two or three < + >'s or < - >'s in a row. 

Hope you will enjoy my program.

Any suggestions, questions or anything else, write to: stan_live@hotmail.com


Stan Arts
