emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/gnugo 2f73382 353/357: [gnugo] Add some docstrings to s


From: Stefan Monnier
Subject: [elpa] externals/gnugo 2f73382 353/357: [gnugo] Add some docstrings to some vars/funcs.
Date: Sun, 29 Nov 2020 14:51:56 -0500 (EST)

branch: externals/gnugo
commit 2f73382ffee6ec21f1e7b72a95dafdeb53cb7715
Author: Thien-Thi Nguyen <ttn@gnu.org>
Commit: Thien-Thi Nguyen <ttn@gnu.org>

    [gnugo] Add some docstrings to some vars/funcs.
    
    * packages/gnugo/gnugo.el (gnugo-option-history): Add docstring.
    (gnugo-other, gnugo-lsquery, gnugo-yang, gnugo-yy): Likewise.
---
 gnugo.el | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/gnugo.el b/gnugo.el
index abc4970..b605d9c 100644
--- a/gnugo.el
+++ b/gnugo.el
@@ -204,7 +204,8 @@ list of forms.")
     ("O" . gnugo-O-face))
   "Font lock keywords for `gnugo-board-mode'.")
 
-(defvar gnugo-option-history nil)
+(defvar gnugo-option-history nil
+  "History list of options for `gnugo' invocation.")
 
 (defvar gnugo-state nil)                ; hint: C-c C-p
 
@@ -386,6 +387,7 @@ Handle the big, slow-to-render, and/or uninteresting ones 
specially."
   (string= "black" string))
 
 (defun gnugo-other (color)
+  "If COLOR is \"black\", return \"white\", otherwise \"black\"."
   (if (gnugo--blackp color) "white" "black"))
 
 (defun gnugo-current-player ()
@@ -486,6 +488,7 @@ when you are sure the command cannot fail."
   (string-to-number (gnugo-query cmd)))
 
 (defun gnugo-lsquery (message-format &rest args)
+  "Apply `gnugo-query' to args; split its rv (return list of strings)."
   (split-string (apply 'gnugo-query message-format args)))
 
 (defsubst gnugo--count-query (fmt &rest args)
@@ -524,12 +527,33 @@ Return final buffer position (i.e., point)."
           (gnugo-get :obarray)))
 
 (defun gnugo-yang (c)
+  "Return the \"image type information\" corresponding to character C.
+C is one of the four characters used in the ASCII representation
+of a game board -- ?+ (U+2B PLUS SIGN), ?. (U+2E FULL STOP), ?X
+and ?O (U+58 and U+4F, LATIN CAPITAL LETTER X and O, respectively).
+For example, here is a 5x5 board with two stones placed:
+
+  . . . . .
+  . O . + .          (white at B4)
+  . . + . .
+  . + . + X          (black at E2)
+  . . . . .
+
+The image type information consists of a single symbol for ?. and ?+
+and a pair (SANS-POINT . WITH-POINT) for ?X and ?O.  Both SANS-POINT
+and WITH-POINT are symbols.  For other C, return nil."
   (gnugo-aqr c '((?+ . hoshi)
                  (?. . empty)
                  (?X . (bmoku . bpmoku))
                  (?O . (wmoku . wpmoku)))))
 
 (defun gnugo-yy (yin yang &optional momentaryp)
+  "Return a symbol made by formatting YIN (an integer) and YANG.
+The returned symbol has the format N-SYMBOL.
+
+If YANG is a symbol, use it directly.  Otherwise, YANG must be a pair.
+If optional arg MOMENTARYP is non-nil, use the `cdr' of YANG.  
+Otherwise, use the `car' of YANG.  See `gnugo-yang'."
   (gnugo-f (format "%d-%s"
                    yin (cond ((symbolp yang) yang)
                              (momentaryp (cdr yang))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]