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

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

[elpa] 10/255: helper functions


From: Eric Schulte
Subject: [elpa] 10/255: helper functions
Date: Sun, 16 Mar 2014 01:02:09 +0000

eschulte pushed a commit to branch go
in repository elpa.

commit 764de98c13cfbcf370a3d164d3aa7a0f972df8ed
Author: Eric Schulte <address@hidden>
Date:   Tue May 15 08:03:39 2012 -0400

    helper functions
---
 games/jp-ming-5.sgf |   23 +++++++++++++++++++++++
 sgf.el              |   12 ++++++++++++
 2 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/games/jp-ming-5.sgf b/games/jp-ming-5.sgf
new file mode 100644
index 0000000..61be3b2
--- /dev/null
+++ b/games/jp-ming-5.sgf
@@ -0,0 +1,23 @@
+(;EV[Famous Blood Vomiting Game]DT[1835-07-27]PC[Japan]PB[Akaboshi 
Intetsu]BR[7p]PW[Honinbo Jowa]WR[9p]RE[W+R]SZ[19]C[This is the most famous game 
in Japanese Go History, not only because Honinbo Jowa played the three famous 
moves in this game(W68, W70 and W78 were considered as the clever moves of no 
category in ancient and modern time), and also because Akaboshi Intetsu vomited 
blood and died after he lost this match, it is the most saddened tragic in Go 
history.];B[cp]C[Akaboshi Intet [...]
+;W[eq];B[qo];W[qk];B[qi];W[op];B[iq];W[dn]C[The Great Slant joseki was very 
popular at that time.];B[ep];W[dp];B[do];W[dq];B[co];W[eo]
+;B[fp];W[cq];B[bq]LB[cn:a]C[B21: Normally Black would extend at 'a', the play 
in the game is also one variation of the Great Slant 
joseki.];W[br];B[cm];W[gr];B[hp];W[en];B[bp];W[ck]C[W28 is Jowa's unique and 
fight-oriented style.];B[dl]
+;W[dk];B[el];W[gn];B[cr]C[B33 is a very thoughtful move.];W[dr];B[bs]C[B33 and 
B35 are correlated good moves.];W[fq]LB[ar:a][fr:b][ds:c]C[White has no choice, 
if White elects to descend at 'a', then B36, W 'b' and B 'c', leading to a ko, 
White is no good.];B[go];W[ar]C[So far, White has gained a little in the 
corner, however...]
+;B[hn]C[The hane of B39 is also very strong.];W[gm];B[hm];W[gl];B[ek]C[Through 
B43, the efficiency of Black's making the first move is still 
obvious.];W[hl];B[di];W[io];B[ho];W[fo]C[W46 and W48 are good sequence 
plays.];B[ch]LB[gp:a][bk:b]C[B49: If Black connects at 'a', then White will 
descend at 'b'.]
+;W[cd];B[lq];W[pn];B[gc]C[B53 is an eye-catching big point.];W[qn];B[dc]C[The 
strike of B55 is severe!];W[cc];B[ec]LB[eb:a][cb:b]C[B57 is questionable and no 
better than the diagonal's extension at 'a', although there is only one line 
difference, but next because of the hane at 'b', White's corner would be still 
not safe.];W[cf];B[il]C[After this move, the game was closed for the first 
time, Black is a little favorable.]
+;W[gp]C[W60: White takes two stones and it is a thick 
play.];B[nq]LB[jd:a]C[B61 is a questionable move, now Black should make an 
extension at 'a', this way Black would still keep the 
lead.];W[ic];B[fd];W[lc]C[White easily plays the two-space extension with W62 
and W64,  it now becomes a close game.];B[bg];W[bf];B[af]C[With B65 and B67, 
Black wants to take advantage in sente, but there is some aji still left on the 
left side, therefore White adopts an excellent maneuver ...];W[bi]C[W68 is [...]
+;W[eh]C[W70 is again a clever move, Black still can't 
tenuki.];B[fj]LB[dh:a][cg:b][qg:c]C[After Black reinforces with B71, because W 
'a' and W 'b' are all sente now, so White has already settled his upper left 
corner, White's clever moves turn gote into sente and White gets to invade at 
'c', instantly White becomes slightly favorable in the 
game.];W[qg];B[oi];W[qe];B[pd];W[nf];B[ok];W[pk]LB[rl:a][ri:b]C[After the cap 
of B77, W78 is the third clever move in this game. W78 prevents Black f [...]
+;B[ol]C[Black elects to extend with B79, making the strongest 
resistance.];W[pj]C[However after White turns with W80, the defect in Black's 
shape has been clearly exposed.];B[rn];W[rm];B[qq]C[Black invades the corner 
with B81 and B83, which are game-deciding moves, Black has to play this way in 
order to have a chance of winning.];W[qr];B[rr];W[qp]C[W86 is the right 
move.];B[rq];W[pr];B[rp]LB[po:a]C[Black has missed the last chance, if Black 
pushes at 'a', Black would still have a chance.]
+;W[po];B[pp];W[mp]LB[oq:a][np:b]C[W92 is a good move, Black can't cut at 'a' 
to initiate the ko, because the connection of W 'b' is a local ko threat, Black 
has no chance to win the ko fight.];B[qm];W[pm]C[W94: White is resolute and 
decisive, Black dares not extend B93, so Black has incurred loss 
again.];B[np];W[mq];B[mo];W[lp];B[lo]C[After this move, the game was closed for 
the second time, now White already takes control of the game.]
+;W[kp];B[no];W[nr];B[or];W[qp];B[mr];W[ro]C[White simply eliminates the ko, 
White is already favorable in the game.];B[pi]C[Black connects back one stone, 
otherwise Black's territory would be inadequate. But now Black still doesn't 
reinforce the bottom.];W[lr];B[ns];W[ip]C[W108 and W100 are decisively 
attacking moves.];B[jr]LB[hq:a][jq:b]C[B111: Black goes all out to fight back, 
if Black connects at 'a',  then W 'b', next because White can play at 111 to 
live in sente, Black would be sti [...]
+;W[hq];B[jn];W[ko];B[kq]LB[kn:a][jq:b]C[B115: If Black blocks at 'a', then 
White will play at 'b', Black is no good either.];W[kn]LB[jo:a]C[After White 
pushes out with W116, because W 'a' is sente, Black's defensive line has been 
broken and Black is hard to handle.];B[jm];W[km];B[ik];W[mk]C[With W120, White 
manages to settle himself and also aims to attack Black, showing Jowa's 
incomparable fighting strength, Black's situation has further deteriorated.]
+;B[mm];W[ir];B[jq]LB[jo:a]C[In fact, the exchange of W122 and B123 is 
unnecessary, because W 'a' becomes not sente any more, Jowa must think White's 
advantage is clear so that he elects to simply settle the shape this 
way.];W[kk];B[mi];W[nm]LB[ls:a]C[W126: White cuts Black's connection. What's 
worth noticing is that, after the exchange of W122 and B123, when the time is 
ripe, White can descend at 'a', Black at the bottom is still not completely 
alive.];B[ml];W[ki];B[lj];W[lk]
+;B[kj];W[jj];B[kl];W[ll];B[lm];W[oj];B[mg]LB[jl:a]C[B137: Black has no choice, 
if Black connects at 'a', Black on the right side would sink into a hopeless 
situation.];W[jl];B[jk];W[nj];B[ni];W[im]C[White starts the ko with W142, which 
is cleverly managed, this ko is much heavier for Black, White completely takes 
control of the game. So far, Jowa's talent has been thoroughly showed on the 
board.]
+;B[in];W[jo];B[kl];W[js];B[ks];W[jl];B[im];W[is];B[kl];W[ei];B[ej];W[jl];B[hr]
+;W[hs];B[kl];W[cn];B[bn];W[jl];B[gs];W[fs];B[kl];W[hi];B[ij];W[jl];B[ls];W[ji]
+;B[hj]C[W164 is a very strong move, forcing Black to connect with B165 and 
B169.];W[oe];B[kg];W[jg]C[After this move, the game was closed for the third 
and last time, now Black is already in a desperate situation.];B[gi]C[Black has 
no alternative but to reinforce with B173.];W[nc]C[W174: White presses Black's 
corner and also aims to attack Black in the center from 
afar.];B[jf];W[nb];B[re];W[if];B[je]
+;W[hd];B[fe];W[gf];B[ff];W[fg];B[gg];W[gh];B[hg];W[fi];B[gj];W[ig];B[hh];W[hf]
+;B[ii];W[rf];B[pe];W[pf];B[le];W[kd];B[ad];W[kh];B[qf];W[ef];B[de];W[qe];B[ld]
+;W[lg];B[kc];W[jd];B[qf];W[db];B[eb];W[qe];B[jb];W[od];B[ib];W[mf];B[qf];W[jp]
+;B[kr];W[qe];B[lf];W[kf];B[qf];W[hc];B[qe];W[hb];B[pg];W[og];B[of];W[cg];B[bh]
+;W[pf];B[ph];W[bb];B[da];W[cb];B[fh];W[ac];B[eg];W[bd];B[ob];W[oa];B[of];W[mh]
+;B[rj];W[kl]C[After this move, Black concedes defeat, a mighty, magnificent 
and fierce fight finally comes to an end.])
\ No newline at end of file
diff --git a/sgf.el b/sgf.el
index 48b5954..ad693c3 100644
--- a/sgf.el
+++ b/sgf.el
@@ -107,6 +107,14 @@
                     (cons tree-part res)))
         (setq cont-p (string= (match-string 2 str) "("))))))
 
+(defun parse-from-buffer (buffer)
+  (parse-trees (with-current-buffer buffer (buffer-string))))
+
+(defun parse-from-file (file)
+  (with-temp-buffer
+    (insert-file-contents-literally file)
+    (parse-from-buffer (current-buffer))))
+
 
 ;;; Tests
 (require 'ert)
@@ -160,3 +168,7 @@
     (should (= 2  (length tree)))
     (should (= 9 (length (car (first tree)))))
     (should (= 2 (length (second tree))))))
+
+(ert-deftest sgf-parse-file-test ()
+  (let ((game (car (parse-from-file "games/jp-ming-5.sgf"))))
+    (should (= 247 (length game)))))



reply via email to

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