getChessString 获取 PGN 字符串
(room chessRoom)
| 608 | |
| 609 | // getChessString 获取 PGN 字符串 |
| 610 | func getChessString(room chessRoom) string { |
| 611 | game := room.chessGame |
| 612 | dataString := fmt.Sprintf("[Date \"%s\"]\n", time.Now().Format("2006-01-02")) |
| 613 | whiteString := fmt.Sprintf("[White \"%s\"]\n", room.whiteName) |
| 614 | blackString := fmt.Sprintf("[Black \"%s\"]\n", room.blackName) |
| 615 | chessString := game.String() |
| 616 | |
| 617 | return dataString + whiteString + blackString + chessString |
| 618 | } |
| 619 | |
| 620 | // getELORate 获取玩家的 ELO 等级分 |
| 621 | func getELORate(whiteUin, blackUin int64, dbService *chessDBService) (whiteRate int, blackRate int, err error) { |