1
0
mirror of https://github.com/tiyn/yeschess.git synced 2025-03-30 21:57:46 +02:00

54 Commits

Author SHA1 Message Date
TiynGER
ca73df4fbb configs and projectPath
In the last few commits the problem occured
that absolute paths are needed for correct
and unambiguous locations for binary files
or the database.
For the compiler arguments the problem is now
solved with an automatic script, that creates
the absolute paths automatically for different
systems.
The database path is now specified by calling
a new function, that finds the root of the
project followed by a relative path.
2021-05-17 00:01:18 +02:00
TiynGER
fa05c87cb1 Todo: added todo file 2021-05-16 03:20:21 +02:00
TiynGER
e306de0573 refactoring: absolute path for db, general refactoring
Due to the path for the db being relative it came
to problems when importing the openingBook.nim file
in other modules (especially in ).
To change this i added a variable, that needs to point to the
root directory of the project.
Additionally i set some coding guidelines and enforced them
into the current codebase.
2021-05-16 03:15:40 +02:00
TiynGER
80772462da documentation: updated the readme documentation
The readme was partly outdated.
I decided not to put in depth documentation into
the readme.
Additionally i added missing docstrings into posMoveDB
2021-05-15 02:33:21 +02:00
TiynGER
362d293fb1 openingdatabase: added db access and pgn crawler
An opening database is an important feature of an engine.
This is because the opening has many possibilities and
there arent much pieces taken yet.
To quickly evaluate the position a database can be useful.
The first step for the database integration was now done by
a program to create and store pgn data in the db.
The next step is to add a way to use the data in the engine.
2021-05-15 02:12:59 +02:00
TiynGER
73f32e8598 project structure
The project previously wasnt structured very
well.
Now the engine has its own module so its more
visible what file belongs to what topic.
2021-05-15 02:10:29 +02:00
TiynGER
c6ecdd4c83 tests: created tests dir
The tests where cluttering the src dir
so i moved them to a separate dir.
Same goes for the binaries so i changed the
outputdirectory for them and
added these to the new gitignore file
2021-05-15 00:46:35 +02:00
TiynGER
2d021366cb art: created art dir and moved pictures into it 2021-05-14 23:57:17 +02:00
marten
acb6a1ad77
readme: removed not working notice for engine 2021-05-14 21:15:39 +02:00
TiynGER
f6787eedd3 chess bugfix: castle and convertToFen
Castling was bugged in the previous version.
The pieces moved on the wrong squares due to W and E being set wrongly.
convertToFen didnt record empty squares if located
at the end of the fen string.
2021-05-13 18:29:52 +02:00
TiynGER
23a97ae9fe chess bugfix: en passant square creation
The en passant square is only important if it is
target of an enemy pawn.
If that is not the case it should not be set
and shouldn't appear in the fen string either.

Now it is checked if the en passant square is
the target of an enemy pawn
2021-05-11 01:42:20 +02:00
TiynGER
5e796751d7 chess: repetition now uses less data
Repetitions can only occur if the pieces and castling
rights are exactly the same.
For memory sake the sequence of last boards
is now emptied if a capture occurs,
a pawn moves, or if the castle
rights change.
That directly makes the saving of the castling
rights obsolete.
2021-05-10 23:50:30 +02:00
TiynGER
a3c48fd50c chess: chess to fen notation added
Now there is a method to turn a chess
object into a fen-string.
Additionally the enPassant handling was
changed.
There can be only one enPassant field
at a time.
So a new attribute was added to the chess
object that stores the field for the
enPassant capture.
If there is no enPassant field it will be set to -1.
2021-05-10 01:30:11 +02:00
TiynGER
d5ac25a642 readme: added move notation documentation 2021-05-08 01:15:49 +02:00
TiynGER
53e1cc8df3 bugfix chess: genPawnPromotion always gives back promotions
The if statement was not tailored to the color and according
back ranks.
It didnt even check if the piece is a pawn.
Now it does.
2021-05-07 02:25:08 +02:00
TiynGER
a383e52bd7 ches: added fen
FEN is a notation to describe a state
of a chess game.
Added a initChess function, which is able
to create a chess object from FEN
2021-05-06 02:26:57 +02:00
TiynGER
c195f2da6a chess: refactoring genLegalMoves
genLegalMoves procs where copy and pasted, now they
are done by a common function.
Some magic numbers have been removed.
2021-05-04 18:36:13 +02:00
TiynGER
ee7d5a0a9d chess: refactoring genDests
genDests procs where copy and pasted, now they
are done by a common function.
Single line functions where also removed, due
to them being to trivial
2021-05-04 18:12:05 +02:00
TiynGER
087da7d3f1 bugfix chess: moveToNotation promotion part wrong
The function moveToNotation added the promotion character
even if a piece and not a pawn moves to the final rank.
2021-05-04 00:46:17 +02:00
TiynGER
4cac1ba6bf merge conflict 2021-05-03 17:14:15 +02:00
TiynGER
3c97395ce8 refactoring: cleanup engine code and add alpha beta to readme 2021-05-03 17:09:48 +02:00
TiynGER
b7480a0cd4 engine: added piece-square tables
Piece square tables are a way to encurage the engine to
put pieces on active squares.
Each piece got a corresponding table.
2021-05-03 02:01:36 +02:00
TiynGER
12ed9921f1 engine: added piece-square tables
Piece square tables are a way to encurage the engine to
put pieces on active squares.
Each piece got a corresponding table.
2021-05-03 01:57:12 +02:00
TiynGER
b3c76fd2c1 visibility: use include in tests and only set needed functions as public 2021-05-03 00:15:58 +02:00
TiynGER
10098da82f refactoring: renaming classes and functions
Renamed the 'game' type to 'chess' to make more sense
of the existing filestructure.
Doubled functions where removed.
2021-05-01 16:21:30 +02:00
TiynGER
3bc523c37a chess: fixed field indices
Field indices where counting up from h to a,
now they are counting up from a to h, so the board
is not inverted anymore
2021-05-01 02:40:08 +02:00
TiynGER
9095cf8eee engine: engine now correctly uses the negamax algorithm
NegaMax is a simplified version of the MiniMax algorithm that
doesn't need different subroutines for the different colors.
The testcases were selected and extended.
Evaluation now has values for draws and wins.
2021-05-01 01:58:26 +02:00
TiynGER
9ea20b6c1f lichess: turned down difficulty and removed unnecessary echoes 2021-05-01 01:56:07 +02:00
TiynGER
5bee0f84d2 bugfix: threefold repitition throws nullpointer
If the threefold repitition check is called before enough moves
are saved in the previous board state it throws a nullpointer.
A simple null check solves the problem
2021-05-01 01:54:16 +02:00
TiynGER
91281d97a7 lichess: added lichess integration
Lichess is a free and open source platform to play chess.
Connection is realized via the berserk python plugin that uses the lichess api.
2021-04-29 01:15:54 +02:00
TiynGER
7fb821254c game: added single player
Integrated the engine into the playable game.
Created a menu to choose between single player and hotseat.
Added a way to choose difficulty and color in single player.
2021-04-27 23:13:41 +02:00
TiynGER
4e69bd3977 engine: Readme update according to used algorithm 2021-04-27 00:55:30 +02:00
TiynGER
4ba3e06d93 engine: first push for engine
I created an engine, that uses a basic version of the minimax algorithm
to evaluate a position.
It then evaluates all the possible next moves in a given position and picks
the one that has the best evaluation.
Basic test cases were also added.
2021-04-27 00:49:39 +02:00
TiynGER
0e27d0a6b5 chess: syntax and structure changes
gameTest renamed to chessTest due to it testing chess.nim and not game.nim.
always used += in chess.nim to increase readability.
2021-04-26 19:54:19 +02:00
TiynGER
0a0accb3d0 chess: Moved replaced with CastleRights
Moved was a 10x12 1-d array, that stored bools.
It was only used for checking if a pawn moved (especially important for
the double move of the pawns) and if the other pieces moved (important
for checking if the player can castle or not).
The pawn moves are now checked by the starting position (pawns on the
second rank cant be already moved).
The castle rights of a game are expressed as CastleRights, a tuple with 4 bools.
This saves basically 116 boolean values.
2020-12-18 01:01:58 +01:00
TiynGER
c91bf64047 chess restructuring: changed order of functions 2020-12-18 00:25:22 +01:00
TiynGER
0ceb567048 structure: made a src folder and moved all source file into it 2020-12-16 04:24:19 +01:00
TiynGER
6ad11fde2a chess: updating documentation
Documentation is now set for every method with complete parameters.
Also all global variables and constants as well as types are documented.
2020-12-16 04:19:02 +01:00
TiynGER
9b68538b12 readme: specified plan for engine 2020-12-16 03:29:43 +01:00
TiynGER
c5cf2fd737 chess: refactoring setters and try
Setters are not needed as all the assigning gets handled inside the  file.
All Setters were removed.
The try-statements were used to excessively and were changed for manual checking
2020-12-16 03:18:24 +01:00
TiynGER
c4f7e3b98d chess: improved documentation and deleted unused stuff 2020-12-16 02:42:58 +01:00
TiynGER
81d5d57e75 chess: refactoring getters
Getters are not needed according to the official nim documentation.
https://nim-lang.org/docs/manual.html#procedures-properties
Getters were replaced accordingly
2020-12-16 01:03:06 +01:00
TiynGER
75e804ef6f chess/game: claimable draw at 50-Move-Rule added 2020-12-15 23:31:42 +01:00
TiynGER
9ed8b886db chess/game: claimable draw at 3-fold repitition added 2020-12-15 20:30:04 +01:00
TiynGER
7caa4db120 game bugfix: game isnt stopped after stalemate 2020-12-15 18:09:27 +01:00
TiynGER
8e918aebb7 chess: draw by insufficient material added 2020-12-15 17:31:15 +01:00
TiynGER
2b4598785d readme: added logo 2020-12-14 23:42:08 +01:00
TiynGER
1cc88f6bf9 game bugfix: after castling toMove wasnt changed
If you castle correctly the toMove attribute of the game object wasnt changed.
This is now fixed.
2020-12-14 22:50:28 +01:00
TiynGER
67a3ab4579 readme/license: updated/added 2020-12-14 18:00:05 +01:00
TiynGER
97406d4da3 tests: added unittests
Due to the official nim documentation the snake_case was now swapped
for camelCase.
Tests for nearly any move were added.
A new procedure can initialize a game with a given 8x8 board with pieces and determines if
they have been moved already.
2020-12-14 17:52:49 +01:00