13
13
14
14
## Chess lib includes:
15
15
16
- - Chess board with 2-dimentional array of ` Pieces `
17
- - Generation, Validation and Execution of ` Moves ` on Chess board
18
- - Logic to ` Convert ` :
19
- - ` Move ` into ` SAN ` and back into Move object
20
- - ` Chess Board ` into ` FEN ` and back into ChessBoard object
21
- - ` Chess Game ` into ` PGN ` and back into ChessBoard object
22
- - Event Handlers:
23
- - ` OnInvalidMoveKingChecked ` - Raises when trying to execute move that places own king in check
24
- - ` OnWhiteKingCheckedChanged ` /` OnBlackKingCheckedChanged ` with state (checked or not) and its position
25
- - ` OnPromotePawn ` with PromotionEventArgs.PromotionResult (default: PromotionToQueen)
26
- - ` OnEndGame ` with according end game info (` Win ` /` Loss ` /` Draw ` )
27
- - ` OnCaptured ` with captured piece and all recently captured pieces (White/Black)
28
- - ` End Game ` Declaration: ` Draw ` or ` Resign ` of one of sides
29
- - ` Navigation ` between executed moves:
30
- - ` First ` /` Last `
31
- - ` Next ` /` Previous `
32
- - Also: ` board.MoveIndex ` property to navigate direct to specific move
33
- - ` Cancelation ` of last executed move
16
+ - ** ChessBoard** with 2-dimentional array of ** Pieces**
17
+ - Generation, Validation and Execution of ** Moves** on chess board
18
+ - ** Parse** :
19
+ - ** Move object** into [ SAN] ( https://www.chessprogramming.org/Algebraic_Chess_Notation#Standard_Algebraic_Notation_.28SAN.29 ) and back into Move object
20
+ - ** Load** and play further:
21
+ - ** Chess _ Board_ ** from [ FEN] ( https://www.chessprogramming.org/Forsyth-Edwards_Notation ) and back to * FEN-string*
22
+ - ** Chess _ Game_ ** from [ PGN] ( https://en.wikipedia.org/wiki/Portable_Game_Notation ) and back to * PGN-string*
23
+ - ** Event handlers** are raised:
24
+ - * OnInvalidMoveKingChecked* - when trying to execute move that places own king in ** check**
25
+ - * On(White/Black)KingCheckedChanged* - with ** state** (checked or not) and its ** position**
26
+ - * OnPromotePawn* - with * PromotionEventArgs.PromotionResult* (default: ** PromotionToQueen** )
27
+ - * OnEndGame* - with according end game info (** Won Side** /** Draw** )
28
+ - * OnCaptured* - with captured piece and all recently captured pieces (** White** /** Black** )
29
+ - ** End Game** Declaration: ** Draw** or ** Resign** of one of sides
30
+ - ** Navigation** between executed moves:
31
+ - ** First** /** Last**
32
+ - ** Next** /** Previous**
33
+ - Also: ** board.MoveIndex** property to navigate directly to specific move
34
+ - ** Cancelation** of last executed move
34
35
35
36
# Usage!
36
37
37
- Example simple console chess game:
38
+ Example simple ** console** chess game:
38
39
39
40
``` csharp
40
41
using Chess ;
@@ -67,7 +68,7 @@ Console.WriteLine(board.ToPgn());
67
68
// 1. e4 f5 2. f4 g5 3. Qh5# 1-0
68
69
```
69
70
70
- Example random chess game:
71
+ Example ** random** chess game:
71
72
72
73
``` csharp
73
74
while (! board .IsEndGame )
@@ -131,13 +132,13 @@ board.Move("e8=K"); // => Bad
131
132
board .Move (" 0-0" ); // => Bad
132
133
```
133
134
134
- Move pieces using Move object and corresponding positions:
135
+ Move pieces using ** Move object** and corresponding positions:
135
136
136
137
``` csharp
137
138
board .Move (new Move (" b1" , " c3" ));
138
139
```
139
140
140
- Ambiguity:
141
+ ** Ambiguity** :
141
142
142
143
``` csharp
143
144
if (ChessBoard .TryLoadFromPgn (" 1. e4 e5 2. Ne2 f6" , out var board ))
@@ -188,7 +189,7 @@ board.LoadFen("rnb1kbnr/pppppppp/8/8/8/8/5q2/7K w kq - 0 1");
188
189
board .EndGame .. . // => { EndgameType = Stalemate, WonSide = null }
189
190
```
190
191
191
- Load full chess game from PGN:
192
+ Load full chess game from ** PGN** :
192
193
193
194
``` csharp
194
195
board = ChessBoard .LoadFromPgn (
@@ -211,7 +212,7 @@ board.ToAscii();
211
212
// a b c d e f g h
212
213
```
213
214
214
- Alternative moves and comments are (temporary ) skipped<br />
215
+ Alternative moves and comments are (temporarily ) skipped<br />
215
216
In further versions:<br />
216
217
Navigate between alternative branches, also load branches from PGN<br />
217
218
Adding comments to each move<br />
@@ -230,9 +231,15 @@ board.Resign(PieceColor.Black);
230
231
board .EndGame .. . // => { EndgameType = Resigned, WonSide = White }
231
232
```
232
233
234
+ ## [ Unit Tests] ( /ChessUnitTests/UnitTests.cs )
235
+ Here you can see all the tests that have been used to test and improve chess library
236
+
237
+ ## [ Benchmarks] ( /ChessBenchmarks/Benchmarks.cs )
238
+ Here you can see the evolution of performance of chess library
239
+
233
240
## Found a bug?
234
241
235
242
Drop to <a href =" https://github.com/Geras1mleo/Chess/issues " >Issues</a ><br />
236
- Or to : sviatoslav.harasymchuk@gmail.com <br />
243
+ Or: sviatoslav.harasymchuk@gmail.com <br />
237
244
<br />
238
245
Thanks in advance!
0 commit comments