Skip to content

Commit 74e673d

Browse files
committed
removed some TODO
1 parent 24f0c6f commit 74e673d

File tree

3 files changed

+27
-5
lines changed

3 files changed

+27
-5
lines changed

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"_config.yml": true,
1313
"diverese": true,
1414
"pm.txt": true,
15-
".gitignore": true
15+
".gitignore": true,
16+
"engine-interface.txt": true
1617
},
1718
"cSpell.words": [
1819
"Pval",

engine_test.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package main
2+
3+
import "testing"
4+
5+
func Test_evaluate(t *testing.T) {
6+
tests := []struct {
7+
name string
8+
pos string
9+
want int
10+
}{
11+
{"","position startpos",0},
12+
{"","position startpos moves e2e4 d7d5 e4d5",100},
13+
}
14+
pSqInit()
15+
for _, tt := range tests {
16+
handlePosition(tt.pos)
17+
t.Run(tt.name, func(t *testing.T) {
18+
if got := board.evaluate(); got != tt.want {
19+
t.Errorf("%v: evaluate() = %v, want %v", tt.name, got, tt.want)
20+
}
21+
})
22+
}
23+
}

position.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,6 @@ func (b *boardStruct) genKingMoves(ml *moveList) {
421421
if b.sq[castl[sd].rookSh] == castl[sd].rook && // NOTE: Maybe not needed. We should know that the rook is there if the flags are ok
422422
(castl[sd].betweenSh&b.allBB()) == 0 {
423423
if b.castlingShOk(sd) {
424-
// TODO: not in check and between not attacked
425424
mv.packMove(uint(b.King[sd]), uint(b.King[sd]+2), uint(b.sq[b.King[sd]]), empty, empty, uint(b.ep), uint(b.castlings))
426425
ml.add(mv)
427426
}
@@ -430,7 +429,6 @@ func (b *boardStruct) genKingMoves(ml *moveList) {
430429
// long castling
431430
if b.sq[castl[sd].rookL] == castl[sd].rook && // NOTE: Maybe not needed. We should know that the rook is there if the flags are ok
432431
(castl[sd].betweenL&b.allBB()) == 0 {
433-
// TODO: not in check and between not attacked
434432
if b.castlingLOk(sd) {
435433
mv.packMove(uint(b.King[sd]), uint(b.King[sd]-2), uint(b.sq[b.King[sd]]), empty, empty, uint(b.ep), uint(b.castlings))
436434
ml.add(mv)
@@ -741,7 +739,6 @@ func (b *boardStruct) genFrMoves(p12 int, toBB bitBoard, ml *moveList) {
741739

742740
// is sq attacked by the sd color side
743741
func (b *boardStruct) isAttacked(sq int, sd color) bool {
744-
// TODO: Fixar inte alla attacker både true och false
745742
if pawnAtks[sd](b, sq) {
746743
return true
747744
}
@@ -796,7 +793,6 @@ func (b *boardStruct) bPawnAtks(sq int) bool {
796793

797794
// print all legal moves
798795
func (b *boardStruct) printAllLegals() {
799-
// TODO: det blir felaktigheter från inCheck() move eller unmove
800796
var ml moveList
801797
b.genAllMoves(&ml)
802798
fmt.Println(ml.String())
@@ -1054,6 +1050,8 @@ func pc2P12(pc int, sd color) int {
10541050
return (pc << 1) | int(sd)
10551051
}
10561052

1053+
1054+
10571055
// map fen-sq to int
10581056
var fenSq2Int = make(map[string]int)
10591057

0 commit comments

Comments
 (0)