mirror of
https://github.com/tiyn/yeschess.git
synced 2025-04-02 23:17:47 +02:00
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.
This commit is contained in:
parent
0a0accb3d0
commit
0e27d0a6b5
@ -107,7 +107,7 @@ const
|
|||||||
(0, 1, 0, 0, 0), # bishop only
|
(0, 1, 0, 0, 0), # bishop only
|
||||||
(0, 2, 0, 0, 0) # 2 knights
|
(0, 2, 0, 0, 0) # 2 knights
|
||||||
] ## `InsufficientMaterial` describes the pieces where no checkmate can be
|
] ## `InsufficientMaterial` describes the pieces where no checkmate can be
|
||||||
## forced
|
## forced
|
||||||
|
|
||||||
let
|
let
|
||||||
PieceChar = {
|
PieceChar = {
|
||||||
@ -252,7 +252,7 @@ proc initGame*(): Game =
|
|||||||
return game
|
return game
|
||||||
|
|
||||||
proc initGame*(board: array[0..63, int], color: Color): Game =
|
proc initGame*(board: array[0..63, int], color: Color): Game =
|
||||||
## Create ad return a Game object based on a position of choice.
|
## Create and return a Game object based on a position of choice.
|
||||||
## `board` describes the pieces, `color` the color that is about to move.
|
## `board` describes the pieces, `color` the color that is about to move.
|
||||||
let board = initBoard(board)
|
let board = initBoard(board)
|
||||||
let compare = initBoard()
|
let compare = initBoard()
|
||||||
@ -831,25 +831,25 @@ proc checkInsufficientMaterial(board: Board): bool =
|
|||||||
for field in board.low..board.high:
|
for field in board.low..board.high:
|
||||||
case board[field]:
|
case board[field]:
|
||||||
of WPawn:
|
of WPawn:
|
||||||
wp = wp + 1
|
wp += 1
|
||||||
of BPawn:
|
of BPawn:
|
||||||
bp = bp + 1
|
bp += 1
|
||||||
of WKnight:
|
of WKnight:
|
||||||
wn = wn + 1
|
wn += 1
|
||||||
of BKnight:
|
of BKnight:
|
||||||
bn = bn + 1
|
bn += 1
|
||||||
of WBishop:
|
of WBishop:
|
||||||
wb = wb + 1
|
wb += 1
|
||||||
of BBishop:
|
of BBishop:
|
||||||
bb = bb + 1
|
bb += 1
|
||||||
of WRook:
|
of WRook:
|
||||||
wr = wr + 1
|
wr += 1
|
||||||
of BRook:
|
of BRook:
|
||||||
br = br + 1
|
br += 1
|
||||||
of WQueen:
|
of WQueen:
|
||||||
wq = wq + 1
|
wq += 1
|
||||||
of BQueen:
|
of BQueen:
|
||||||
bq = bq + 1
|
bq += 1
|
||||||
else:
|
else:
|
||||||
continue
|
continue
|
||||||
let wpieces: PieceAmount = (wp, wn, wb, wr, wq)
|
let wpieces: PieceAmount = (wp, wn, wb, wr, wq)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user