1
0
mirror of https://github.com/tiyn/yeschess.git synced 2025-10-16 12:51:24 +02:00

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.
This commit is contained in:
TiynGER
2021-05-16 03:15:40 +02:00
parent 80772462da
commit e306de0573
5 changed files with 121 additions and 66 deletions

View File

@@ -52,3 +52,32 @@ The engine uses a simple implementation of the
For the evaluation function each piece has a corresponding value.
Additionally [piece-square tables](https://www.chessprogramming.org/Piece-Square_Tables)
are used.
## Contributing
### Setup
To setup the project for development you need to create the file
`src/secret.nim`.
It should contain values for the following variables:
```nim
let projectdir* = "<absolute path to root dir of ychess>"
let api_token* = "<lichess api token for bot>"
```
### Code Style Guide
Basic arithmetic operations should be surrounded by spaces for example: `1 + 3`.
This however is not true for negation of a single value (`-1`) or if the
arithmetic operation is done inside array brackets or in iterators (`a+1..3`,
`a[c+3]`).
Determining the length of a string, array, etc should not be done via a function
(`len(array)`) but by appending it like `array.len`.
If statements should not contain outer brackets.
In some cases (especially concatenations of `and` and `or`) inner brackets are
useful to increase readability in complexer logic formulas.
When assigning booleans with logical formulas outer brackets are expected.