1
0
mirror of https://github.com/tiyn/yeschess.git synced 2025-05-10 07:47:46 +02:00

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.
This commit is contained in:
TiynGER 2021-05-15 02:10:29 +02:00
parent c6ecdd4c83
commit 73f32e8598
7 changed files with 15 additions and 9 deletions

3
.gitignore vendored
View File

@ -1,3 +1,6 @@
*.db
bin bin
docs docs
pgn
secret.nim secret.nim

View File

@ -1,6 +1,6 @@
import algorithm import algorithm
import ./chess.nim import chess
type type
MoveTree = object MoveTree = object
@ -184,7 +184,7 @@ proc bestMove*(chess: Chess, depth: int): Move =
var tmpChess = chess var tmpChess = chess
tmpChess.checkedMove(move) tmpChess.checkedMove(move)
var tmpEval = -tmpChess.negaMax(depth, LoVal, HiVal) var tmpEval = -tmpChess.negaMax(depth, LoVal, HiVal)
#echo("move:", moveToNotation(move, tmpChess.board), "; eval:", tmpEval) echo("move:", moveToNotation(move, tmpChess.board), "; eval:", tmpEval)
if tmpEval > bestEval: if tmpEval > bestEval:
bestEval = tmpEval bestEval = tmpEval
bestMove = move bestMove = move

View File

@ -1,9 +1,9 @@
import nimpy import nimpy
import asyncnet, asyncdispatch import asyncnet, asyncdispatch
import ./secret.nim import chess
import ./chess.nim import engine/secret
import ./engine.nim import engine/engine
let berserk = pyImport("berserk") let berserk = pyImport("berserk")
@ -11,7 +11,7 @@ var session = berserk.TokenSession(secret.api_token)
var client = berserk.Client(session = session) var client = berserk.Client(session = session)
let engineID = "tiyn-ychess" let engineID = "tiyn-ychess"
let engineDifficulty = 3 let engineDifficulty = 2
let toAccept = ["tiynger"] let toAccept = ["tiynger"]

1
src/engine/nim.cfg Normal file
View File

@ -0,0 +1 @@
--outdir:"../../bin/src"

View File

@ -1,7 +1,7 @@
import parseutils import parseutils
import ./chess.nim import chess
import ./engine.nim import engine/engine
proc runGameHotseat*(): void = proc runGameHotseat*(): void =
## Initializes and runs a game of chess as hotseat. ## Initializes and runs a game of chess as hotseat.

2
src/nim.cfg Normal file
View File

@ -0,0 +1,2 @@
--outdir:"../bin/src"
--path:"."

View File

@ -1,7 +1,7 @@
import einheit import einheit
include chess include chess
include engine include engine/engine
testSuite ChessTest of TestSuite: testSuite ChessTest of TestSuite: