mirror of
https://github.com/tiyn/yeschess.git
synced 2025-04-02 23:17:47 +02:00
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
This commit is contained in:
parent
362d293fb1
commit
80772462da
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,6 +1,6 @@
|
|||||||
*.db
|
*.db
|
||||||
|
|
||||||
bin
|
bin
|
||||||
docs
|
htmldocs
|
||||||
pgn
|
pgn
|
||||||
secret.nim
|
secret.nim
|
||||||
|
36
README.md
36
README.md
@ -4,29 +4,35 @@
|
|||||||
|
|
||||||
ychess is a chess implementation and engine written in nim.
|
ychess is a chess implementation and engine written in nim.
|
||||||
|
|
||||||
## Usage
|
## Quick Setup
|
||||||
|
|
||||||
To play chess in the commandline simply download the code and run `nim c -r game.nim`.
|
To play chess in the commandline simply download the code (or clone the
|
||||||
|
repository) and run `nim c -r game.nim`.
|
||||||
You can either play the 1v1 hotseat mode or a single player mode vs the engine.
|
You can either play the 1v1 hotseat mode or a single player mode vs the engine.
|
||||||
|
|
||||||
### Lichess
|
Additionally ychess uses the lichess api to make playing more convenient.
|
||||||
|
An instance of the engine occasionally plays on
|
||||||
ychess uses the lichess api with the python plugin [berserk](https://github.com/rhgrant10/berserk).
|
[lichess](https://lichess.org/@/tiyn-ychess).
|
||||||
An instance of the engine occasionally plays on [lichess](https://lichess.org/@/tiyn-ychess).
|
|
||||||
To get into the whitelist just write a ingame message to the account.
|
To get into the whitelist just write a ingame message to the account.
|
||||||
|
|
||||||
## Testing
|
## Project Structure
|
||||||
|
|
||||||
Testing is done by `einheit` by [jyapayne](https://github.com/jyapayne/einheit).
|
- `art` - contains pictures and arts not used in the code.
|
||||||
All legal chess moves are implemented in `chess.nim` and tested by the TestSuite
|
- `bin` - is not pushed to the git repository but contains all binaries and will
|
||||||
in `test.nim`.
|
be created if you compile a program.
|
||||||
You can simply run the tests with `nim c -r test.nim`.
|
- `htmldocs` - is not pushed to the git repository but contains all
|
||||||
|
automatically generated documentation.
|
||||||
|
- `src` - is the root folder for all programs except tests.
|
||||||
|
- `tests` - contains all tests.
|
||||||
|
|
||||||
## Documentation
|
### Documentation
|
||||||
|
|
||||||
Documentation is written into the code via DocGen.
|
Documentation is written into the code via DocGen.
|
||||||
For this reason it is not saved in this repository.
|
For this reason it is not saved in this repository.
|
||||||
To extract it into html run `nim doc --project --index:on --outdir:docs game.nim`
|
To extract it into html (assuming you want the documentation for `game.nim`)
|
||||||
|
run `nim doc --project --index:on --outdir:htmldocs game.nim`.
|
||||||
|
|
||||||
|
## General Design Choices
|
||||||
|
|
||||||
### Moves
|
### Moves
|
||||||
|
|
||||||
@ -44,5 +50,5 @@ The engine uses a simple implementation of the
|
|||||||
[NegaMax](https://www.chessprogramming.org/NegaMax)-algorithm with
|
[NegaMax](https://www.chessprogramming.org/NegaMax)-algorithm with
|
||||||
[Alpha-Beta-Pruning](https://www.chessprogramming.org/Alpha-Beta#Negamax_Framework).
|
[Alpha-Beta-Pruning](https://www.chessprogramming.org/Alpha-Beta#Negamax_Framework).
|
||||||
For the evaluation function each piece has a corresponding value.
|
For the evaluation function each piece has a corresponding value.
|
||||||
Additionally there are [piece-square tables](https://www.chessprogramming.org/Piece-Square_Tables)
|
Additionally [piece-square tables](https://www.chessprogramming.org/Piece-Square_Tables)
|
||||||
to encurage putting pieces on active squares.
|
are used.
|
||||||
|
@ -15,6 +15,7 @@ let dbName = ""
|
|||||||
let tableName = "posmoves"
|
let tableName = "posmoves"
|
||||||
|
|
||||||
proc initDB*(): void =
|
proc initDB*(): void =
|
||||||
|
## Initialize the database with a table if it doesnt currently exist.
|
||||||
let db = open(dbConn, dbUser, dbPasswd, dbName)
|
let db = open(dbConn, dbUser, dbPasswd, dbName)
|
||||||
db.exec(sql"""CREATE TABLE IF NOT EXISTS ? (
|
db.exec(sql"""CREATE TABLE IF NOT EXISTS ? (
|
||||||
fen VARCHAR(100) NOT NULL,
|
fen VARCHAR(100) NOT NULL,
|
||||||
@ -30,6 +31,9 @@ proc initDB*(): void =
|
|||||||
|
|
||||||
proc storeMove*(fen: string, move: string, white: bool, black: bool, draw: bool,
|
proc storeMove*(fen: string, move: string, white: bool, black: bool, draw: bool,
|
||||||
rating: int): void =
|
rating: int): void =
|
||||||
|
## Store a possible `move` done by a player with `rating` (0 for unknown)
|
||||||
|
## in a position described by `fen`.
|
||||||
|
## The result of the game is described by `white`, `black` and `draw`.
|
||||||
let db = open(dbConn, dbUser, dbPasswd, dbName)
|
let db = open(dbConn, dbUser, dbPasswd, dbName)
|
||||||
var query = """
|
var query = """
|
||||||
INSERT INTO ? (fen, move, white, black, draw, rating)
|
INSERT INTO ? (fen, move, white, black, draw, rating)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user