-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
63 lines (54 loc) · 1.58 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package main
import (
"fmt"
. "github.com/captainsano/golang-chess/core"
)
func oldMain() {
// fen := "rnb1kbnr/ppp1q1pp/8/3P1p2/2PP4/3B1p2/PP3PPP/RNBQK2R w KQkq - 0 7"
// fen := "rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq - 1 1"
board := NewDefaultBoard()
printStatus(&board)
printAfterMove(&board, "e2e4")
printAfterMove(&board, "c7c5")
printAfterMove(&board, "g1f3")
printAfterMove(&board, "d7d6")
printAfterMove(&board, "d2d4")
printAfterMove(&board, "c5d4")
printAfterMove(&board, "f3d4")
printAfterMove(&board, "g8f6")
printAfterMove(&board, "b1c3")
printAfterMove(&board, "a7a6")
printAfterMove(&board, "f1e2")
printAfterMove(&board, "e7e5")
printAfterMove(&board, "d4f3")
printAfterMove(&board, "f8e7")
printAfterMove(&board, "e1g1")
printAfterMove(&board, "e8g8")
}
func printAfterMove(board *Board, uci string) {
m, _ := NewMoveFromUci(uci)
board.Push(m)
fmt.Println(board.FEN(false, "legal", NoPiece))
printStatus(board)
}
func printStatus(b *Board) {
fmt.Println()
fmt.Println("Current Board: ")
fmt.Println(b.Unicode(false, false))
fmt.Print("Legal Moves: ")
for m := range b.GenerateLegalMoves(BBAll, BBAll) {
fmt.Print(b.San(&m), " ")
}
fmt.Println()
}
func main() {
fmt.Println("--> ", StatusValid)
fmt.Println("--> ", StatusNoWhiteKing)
fmt.Println("--> ", StatusNoBlackKing)
fmt.Println("--> ", StatusTooManyKings)
fmt.Println("--> ", StatusTooManyWhitePawns)
fmt.Println("--> ", StatusTooManyBlackPawns)
fmt.Println("--> ", StatusPawnsOnBackRank)
fmt.Println("--> ", StatusTooManyWhitePieces)
fmt.Println("--> ", StatusRaceMaterial)
}