comparison lisp/play/gametree.el @ 62402:a7e02ef1e3d6

Replace `string-to-int' by `string-to-number'.
author Juanma Barranquero <lekktu@gmail.com>
date Mon, 16 May 2005 11:33:47 +0000
parents eaa9acd9122c
children 18a818a2ee7c f042e7c0fe20
comparison
equal deleted inserted replaced
62401:4512c4db6912 62402:a7e02ef1e3d6
202 (let ((boundary (concat "[ \t]*\\([1-9][0-9]*\\)\\(" 202 (let ((boundary (concat "[ \t]*\\([1-9][0-9]*\\)\\("
203 gametree-full-ply-regexp "\\|" 203 gametree-full-ply-regexp "\\|"
204 gametree-half-ply-regexp "\\)")) 204 gametree-half-ply-regexp "\\)"))
205 (limit (save-excursion (beginning-of-line 1) (point)))) 205 (limit (save-excursion (beginning-of-line 1) (point))))
206 (if (looking-at boundary) 206 (if (looking-at boundary)
207 (+ (* 2 (string-to-int (match-string 1))) 207 (+ (* 2 (string-to-number (match-string 1)))
208 (if (string-match gametree-half-ply-regexp (match-string 2)) 1 0)) 208 (if (string-match gametree-half-ply-regexp (match-string 2)) 1 0))
209 (save-excursion 209 (save-excursion
210 (re-search-backward boundary limit) 210 (re-search-backward boundary limit)
211 (skip-chars-backward "0123456789") 211 (skip-chars-backward "0123456789")
212 (1+ (* 2 (string-to-int 212 (1+ (* 2 (string-to-number
213 (buffer-substring (point) (match-end 1)))))))))) 213 (buffer-substring (point) (match-end 1))))))))))
214 214
215 (defun gametree-current-branch-ply () 215 (defun gametree-current-branch-ply ()
216 "Return the ply number of the first move of the current variation." 216 "Return the ply number of the first move of the current variation."
217 (save-excursion 217 (save-excursion
343 343
344 (defun gametree-current-branch-score () 344 (defun gametree-current-branch-score ()
345 "Return score of current variation according to its score tag. 345 "Return score of current variation according to its score tag.
346 When no score tag is present, use the value of `gametree-default-score'." 346 When no score tag is present, use the value of `gametree-default-score'."
347 (if (looking-at gametree-score-regexp) 347 (if (looking-at gametree-score-regexp)
348 (string-to-int (match-string 3)) 348 (string-to-number (match-string 3))
349 gametree-default-score)) 349 gametree-default-score))
350 350
351 (defun gametree-compute-reduced-score () 351 (defun gametree-compute-reduced-score ()
352 "Return current internal node score computed recursively from subnodes. 352 "Return current internal node score computed recursively from subnodes.
353 Subnodes which have been manually scored are honored." 353 Subnodes which have been manually scored are honored."