eschulte pushed a commit to branch go
in repository elpa.
commit f16e3e5266250f219c83dee6c46c5557daf4af45
Author: Eric Schulte <[email protected]>
Date: Sun May 19 18:35:17 2013 -0600
calculate the final score
---
back-ends/gtp.el | 2 ++
back-ends/igs.el | 3 +++
back-ends/sgf.el | 3 +++
go-api.el | 1 +
go-board.el | 3 ++-
5 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/back-ends/gtp.el b/back-ends/gtp.el
index 4b9724e..4343edc 100644
--- a/back-ends/gtp.el
+++ b/back-ends/gtp.el
@@ -134,4 +134,6 @@
(defmethod go-quit ((gtp gtp)) (gtp-command gtp "quit"))
+(defmethod go-score ((gtp gtp)) (gtp-command gtp "final_score"))
+
(provide 'gtp)
diff --git a/back-ends/igs.el b/back-ends/igs.el
index 29f53d5..8ab9799 100644
--- a/back-ends/igs.el
+++ b/back-ends/igs.el
@@ -455,4 +455,7 @@ This is used to re-send messages to keep the IGS server
from timing out.")
(defmethod go-quit ((igs igs))
(with-igs igs (igs-send "quit")))
+(defmethod go-score ((igs igs))
+ (signal 'unsupported-back-end-command (list igs :score)))
+
(provide 'igs)
diff --git a/back-ends/sgf.el b/back-ends/sgf.el
index 17052b2..185753b 100644
--- a/back-ends/sgf.el
+++ b/back-ends/sgf.el
@@ -188,4 +188,7 @@
(when (y-or-n-p "Save game to file: ")
(sgf-to-file sgf (read-file-name "Save game to: "))))
+(defmethod go-score ((sgf sgf))
+ (signal 'unsupported-back-end-command (list sgf :score)))
+
(provide 'sgf)
diff --git a/go-api.el b/go-api.el
index 5eb24d6..13cd9f4 100644
--- a/go-api.el
+++ b/go-api.el
@@ -75,5 +75,6 @@
(defgeneric go-resign (back-end) "Send resign to BACK-END.")
(defgeneric go-reset (back-end) "Send reset to BACK-END.")
(defgeneric go-quit (back-end) "Quit the BACK-END.")
+(defgeneric go-score (back-end) "Ask BACK-END to report the final score.")
(provide 'go-api)
diff --git a/go-board.el b/go-board.el
index ff8488a..89e5e05 100644
--- a/go-board.el
+++ b/go-board.el
@@ -392,7 +392,8 @@
(when *autoplay*
(when (equalp :pass (go-board-next))
;; TODO: print the score
- (message "Game Over")))))
+ (message "final score: %s"
+ (with-backends back (go-score back)))))))
(defun go-board-undo (&optional num)
(interactive "p")