cheeplay.go (518B) [raw]
1 package main 2 3 import ( 4 "os" 5 "fmt" 6 "github.com/notnil/chess" 7 ) 8 9 func main() { 10 fmt.Println("Hello World") 11 f, err := os.Open("examples/Byrne_vs_Fischer_1956.pgn") 12 if err != nil { 13 panic(err) 14 } 15 defer f.Close() 16 17 pgn, err := chess.PGN(f) 18 if err != nil { 19 panic(err) 20 } 21 replay := chess.NewGame() 22 game := chess.NewGame(pgn) 23 for _, mh := range game.MoveHistory() { 24 fmt.Println(replay.Position().Board().Draw()) 25 replay.Move(mh.Move) 26 fmt.Println(mh.Move) 27 28 } 29 fmt.Println(replay.Position().Board().Draw()) 30 }