[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 175/255: support for playing different types of games
From: |
Eric Schulte |
Subject: |
[elpa] 175/255: support for playing different types of games |
Date: |
Sun, 16 Mar 2014 01:02:43 +0000 |
eschulte pushed a commit to branch go
in repository elpa.
commit 06bc8914702961417ec21b9a3ad32d59a2790cc9
Author: Eric Schulte <address@hidden>
Date: Sat Jun 9 18:32:24 2012 -0600
support for playing different types of games
---
go.el | 37 +++++++++++++++++++++++++------------
1 files changed, 25 insertions(+), 12 deletions(-)
diff --git a/go.el b/go.el
index 5980172..6389417 100644
--- a/go.el
+++ b/go.el
@@ -46,17 +46,30 @@
(require 'sgf2el "back-ends/sgf2el.el")
(require 'igs "back-ends/igs.el")
-(defun play-go (&optional level)
- "Play a game of GO against gnugo.
-Optional argument LEVEL specifies gnugo's level of play."
- (interactive "P")
- (with-current-buffer
- (go-board
- (make-instance 'gnugo
- :buffer (apply #'gnugo-start-process
- (when level
- (list "--level" (number-to-string level)))))
- (make-instance 'sgf))
- (setq *autoplay* t)))
+(defun go-instantiate (back-end)
+ (interactive)
+ ;; TODO: read and set handicap.
+ (let ((it (make-instance back-end))
+ (size (read (org-icompleting-read
+ "board size: "
+ (mapcar #'number-to-string '(9 13 19)))))
+ (name (read-from-minibuffer "name: ")))
+ (setf (go-size it) size)
+ (ignoring-unsupported (setf (go-name it) name))
+ it))
+
+(defun play-go ()
+ "Play a game of GO."
+ (interactive)
+ (let ((back-end (case (intern (org-icompleting-read
+ "play against: " '("gnugo" "person")))
+ (gnugo (go-instantiate 'gnugo))
+ (person (go-instantiate 'sgf)))))
+ (with-current-buffer (apply #'go-board
+ (cons back-end
+ (unless (equal (class-of back-end) 'sgf)
+ (list (make-instance 'sgf)))))
+ (unless (equal (class-of back-end) 'sgf)
+ (setq *autoplay* t)))))
(provide 'go)
- [elpa] 153/255: safety measure when observing igs games, (continued)
- [elpa] 153/255: safety measure when observing igs games, Eric Schulte, 2014/03/15
- [elpa] 163/255: sorted out different types of backgrounds, Eric Schulte, 2014/03/15
- [elpa] 168/255: adding option to play a sound during moves, Eric Schulte, 2014/03/15
- [elpa] 155/255: less permissive igs move regular expression, Eric Schulte, 2014/03/15
- [elpa] 166/255: board images working with backgrounds, Eric Schulte, 2014/03/15
- [elpa] 173/255: start gnugo process when object is created, Eric Schulte, 2014/03/15
- [elpa] 167/255: cleanup images in board faces, Eric Schulte, 2014/03/15
- [elpa] 170/255: fix spacing of labels when using image for display, Eric Schulte, 2014/03/15
- [elpa] 174/255: quit the main back-end as well, Eric Schulte, 2014/03/15
- [elpa] 160/255: removing stones/ directory, Eric Schulte, 2014/03/15
- [elpa] 175/255: support for playing different types of games,
Eric Schulte <=
- [elpa] 157/255: images of stones, Eric Schulte, 2014/03/15
- [elpa] 177/255: future tasks, Eric Schulte, 2014/03/15
- [elpa] 182/255: reverse order of sizes, Eric Schulte, 2014/03/15
- [elpa] 172/255: re-organized how files are loaded, Eric Schulte, 2014/03/15
- [elpa] 156/255: chunking responses from IGS server into full lines, Eric Schulte, 2014/03/15
- [elpa] 183/255: explicit connection method for back-end objects, Eric Schulte, 2014/03/15
- [elpa] 179/255: track and display prisoners, Eric Schulte, 2014/03/15
- [elpa] 184/255: safer and automatic quitting, Eric Schulte, 2014/03/15
- [elpa] 186/255: better interactive debugging, Eric Schulte, 2014/03/15
- [elpa] 191/255: don't throw error when backend passes, Eric Schulte, 2014/03/15