Initial commit
[trapthecap.git] / doc / classes / GameTest.src / M000027.html
1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <!DOCTYPE html
3 PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
6 <html>
7 <head>
8 <title>test_undo_move! (GameTest)</title>
9 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10 <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
11 </head>
12 <body class="standalone-code">
13 <pre><span class="ruby-comment cmt"># File test/libttc_test.rb, line 710</span>
14 <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_undo_move!</span>
15 <span class="ruby-identifier">game</span> = <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">3</span>)
16
17 <span class="ruby-identifier">pieceA1</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a1'</span>]
18 <span class="ruby-identifier">pieceA2</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a2'</span>]
19 <span class="ruby-identifier">pieceC1</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c1'</span>]
20 <span class="ruby-identifier">pieceC2</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c2'</span>]
21 <span class="ruby-identifier">pieceE1</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e1'</span>]
22 <span class="ruby-identifier">pieceE2</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e2'</span>]
23
24 <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>
25 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a1'</span>], <span class="ruby-identifier">pieceA1</span>
26 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a2'</span>], <span class="ruby-identifier">pieceA2</span>
27 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c1'</span>], <span class="ruby-identifier">pieceC1</span>
28 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c2'</span>], <span class="ruby-identifier">pieceC2</span>
29 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e1'</span>], <span class="ruby-identifier">pieceE1</span>
30 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e2'</span>], <span class="ruby-identifier">pieceE2</span>
31 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a1'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a'</span>]
32 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a1'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
33 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a1'</span>].<span class="ruby-identifier">contains</span>, []
34 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a2'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a'</span>]
35 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
36 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a2'</span>].<span class="ruby-identifier">contains</span>, []
37 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c1'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'c'</span>]
38 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c1'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
39 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c1'</span>].<span class="ruby-identifier">contains</span>, []
40 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c2'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'c'</span>]
41 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
42 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c2'</span>].<span class="ruby-identifier">contains</span>, []
43 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e1'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'e'</span>]
44 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e1'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
45 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e1'</span>].<span class="ruby-identifier">contains</span>, []
46 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e2'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'e'</span>]
47 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
48 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e2'</span>].<span class="ruby-identifier">contains</span>, []
49 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">current_player</span>, <span class="ruby-value str">'a'</span>
50
51 <span class="ruby-identifier">game</span>.<span class="ruby-identifier">undo_move!</span>
52 <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>
53 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a1'</span>], <span class="ruby-identifier">pieceA1</span>
54 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a2'</span>], <span class="ruby-identifier">pieceA2</span>
55 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c1'</span>], <span class="ruby-identifier">pieceC1</span>
56 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c2'</span>], <span class="ruby-identifier">pieceC2</span>
57 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e1'</span>], <span class="ruby-identifier">pieceE1</span>
58 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e2'</span>], <span class="ruby-identifier">pieceE2</span>
59 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a1'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a'</span>]
60 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a1'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
61 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a1'</span>].<span class="ruby-identifier">contains</span>, []
62 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a2'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a'</span>]
63 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
64 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a2'</span>].<span class="ruby-identifier">contains</span>, []
65 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c1'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'c'</span>]
66 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c1'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
67 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c1'</span>].<span class="ruby-identifier">contains</span>, []
68 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c2'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'c'</span>]
69 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
70 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c2'</span>].<span class="ruby-identifier">contains</span>, []
71 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e1'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'e'</span>]
72 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e1'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
73 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e1'</span>].<span class="ruby-identifier">contains</span>, []
74 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e2'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'e'</span>]
75 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
76 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e2'</span>].<span class="ruby-identifier">contains</span>, []
77 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">current_player</span>, <span class="ruby-value str">'a'</span>
78
79 <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_moves!</span> [<span class="ruby-value str">'A1 A3'</span>].<span class="ruby-identifier">collect</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span> <span class="ruby-identifier">m</span>.<span class="ruby-identifier">to_move</span>(<span class="ruby-identifier">game</span>) }
80 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
81 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a1'</span>], <span class="ruby-identifier">pieceA1</span>
82 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a2'</span>], <span class="ruby-identifier">pieceA2</span>
83 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c1'</span>], <span class="ruby-identifier">pieceC1</span>
84 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c2'</span>], <span class="ruby-identifier">pieceC2</span>
85 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e1'</span>], <span class="ruby-identifier">pieceE1</span>
86 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e2'</span>], <span class="ruby-identifier">pieceE2</span>
87 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a1'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a3'</span>]
88 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a1'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
89 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a1'</span>].<span class="ruby-identifier">contains</span>, []
90 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a2'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a'</span>]
91 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
92 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a2'</span>].<span class="ruby-identifier">contains</span>, []
93 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c1'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'c'</span>]
94 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c1'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
95 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c1'</span>].<span class="ruby-identifier">contains</span>, []
96 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c2'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'c'</span>]
97 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
98 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c2'</span>].<span class="ruby-identifier">contains</span>, []
99 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e1'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'e'</span>]
100 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e1'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
101 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e1'</span>].<span class="ruby-identifier">contains</span>, []
102 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e2'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'e'</span>]
103 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
104 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e2'</span>].<span class="ruby-identifier">contains</span>, []
105 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">current_player</span>, <span class="ruby-value str">'c'</span>
106
107 <span class="ruby-identifier">game</span>.<span class="ruby-identifier">undo_move!</span>
108 <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>
109 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a1'</span>], <span class="ruby-identifier">pieceA1</span>
110 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a2'</span>], <span class="ruby-identifier">pieceA2</span>
111 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c1'</span>], <span class="ruby-identifier">pieceC1</span>
112 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c2'</span>], <span class="ruby-identifier">pieceC2</span>
113 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e1'</span>], <span class="ruby-identifier">pieceE1</span>
114 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e2'</span>], <span class="ruby-identifier">pieceE2</span>
115 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a1'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a'</span>]
116 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a1'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
117 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a1'</span>].<span class="ruby-identifier">contains</span>, []
118 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a2'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a'</span>]
119 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
120 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a2'</span>].<span class="ruby-identifier">contains</span>, []
121 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c1'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'c'</span>]
122 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c1'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
123 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c1'</span>].<span class="ruby-identifier">contains</span>, []
124 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c2'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'c'</span>]
125 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
126 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c2'</span>].<span class="ruby-identifier">contains</span>, []
127 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e1'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'e'</span>]
128 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e1'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
129 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e1'</span>].<span class="ruby-identifier">contains</span>, []
130 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e2'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'e'</span>]
131 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
132 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e2'</span>].<span class="ruby-identifier">contains</span>, []
133 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">current_player</span>, <span class="ruby-value str">'a'</span>
134
135 <span class="ruby-identifier">move_set1</span> = [<span class="ruby-value str">'A1 AC5'</span>, <span class="ruby-value str">'A2 AC5'</span>, <span class="ruby-value str">'A1 AC6'</span>,
136 <span class="ruby-value str">'C1 CC5'</span>, <span class="ruby-value str">'C2 CC5'</span>, <span class="ruby-value str">'C1 AC6'</span>] <span class="ruby-comment cmt"># A1 now captured by C1</span>
137 <span class="ruby-identifier">move_set1a</span> = [<span class="ruby-value str">'C1 AC6'</span>]
138 <span class="ruby-identifier">move_set2</span> = [<span class="ruby-value str">'E1 EC5'</span>, <span class="ruby-value str">'E2 EC5'</span>, <span class="ruby-value str">'E1 AC6'</span>] <span class="ruby-comment cmt"># C1+A1 now caputred by E1</span>
139 <span class="ruby-identifier">move_set2a</span> = [<span class="ruby-value str">'E1 AC6'</span>]
140
141 <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_moves!</span> <span class="ruby-identifier">move_set1</span>.<span class="ruby-identifier">collect</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span> <span class="ruby-identifier">m</span>.<span class="ruby-identifier">to_move</span>(<span class="ruby-identifier">game</span>)}
142 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">6</span>
143 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a1'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'ac6'</span>]
144 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a1'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">true</span>
145 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a1'</span>].<span class="ruby-identifier">contains</span>, []
146 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a2'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'ac5'</span>]
147 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
148 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a2'</span>].<span class="ruby-identifier">contains</span>, []
149 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c1'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'ac6'</span>]
150 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c1'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
151 <span class="ruby-identifier">assert</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c1'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
152 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c2'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'cc5'</span>]
153 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
154 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c2'</span>].<span class="ruby-identifier">contains</span>, []
155 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e1'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'e'</span>]
156 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e1'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
157 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e1'</span>].<span class="ruby-identifier">contains</span>, []
158 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e2'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'e'</span>]
159 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
160 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e2'</span>].<span class="ruby-identifier">contains</span>, []
161 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">current_player</span>, <span class="ruby-value str">'e'</span>
162
163 <span class="ruby-identifier">game</span>.<span class="ruby-identifier">undo_move!</span>
164 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">5</span>
165 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a1'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'ac6'</span>]
166 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a1'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
167 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a1'</span>].<span class="ruby-identifier">contains</span>, []
168 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a2'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'ac5'</span>]
169 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
170 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a2'</span>].<span class="ruby-identifier">contains</span>, []
171 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c1'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'cc5'</span>]
172 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c1'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
173 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c1'</span>].<span class="ruby-identifier">contains</span>, []
174 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c2'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'cc5'</span>]
175 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
176 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c2'</span>].<span class="ruby-identifier">contains</span>, []
177 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e1'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'e'</span>]
178 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e1'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
179 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e1'</span>].<span class="ruby-identifier">contains</span>, []
180 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e2'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'e'</span>]
181 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
182 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e2'</span>].<span class="ruby-identifier">contains</span>, []
183 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">current_player</span>, <span class="ruby-value str">'c'</span>
184
185 <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_moves!</span> <span class="ruby-identifier">move_set1a</span>.<span class="ruby-identifier">collect</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span> <span class="ruby-identifier">m</span>.<span class="ruby-identifier">to_move</span>(<span class="ruby-identifier">game</span>)}
186 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">6</span>
187 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a1'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'ac6'</span>]
188 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a1'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">true</span>
189 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a1'</span>].<span class="ruby-identifier">contains</span>, []
190 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a2'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'ac5'</span>]
191 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
192 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a2'</span>].<span class="ruby-identifier">contains</span>, []
193 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c1'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'ac6'</span>]
194 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c1'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
195 <span class="ruby-identifier">assert</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c1'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
196 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c2'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'cc5'</span>]
197 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
198 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c2'</span>].<span class="ruby-identifier">contains</span>, []
199 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e1'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'e'</span>]
200 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e1'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
201 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e1'</span>].<span class="ruby-identifier">contains</span>, []
202 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e2'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'e'</span>]
203 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
204 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e2'</span>].<span class="ruby-identifier">contains</span>, []
205 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">current_player</span>, <span class="ruby-value str">'e'</span>
206
207 <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_moves!</span> <span class="ruby-identifier">move_set2</span>.<span class="ruby-identifier">collect</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span> <span class="ruby-identifier">m</span>.<span class="ruby-identifier">to_move</span>(<span class="ruby-identifier">game</span>)}
208 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">9</span>
209 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a1'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'ac6'</span>]
210 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a1'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">true</span>
211 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a1'</span>].<span class="ruby-identifier">contains</span>, []
212 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a2'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'ac5'</span>]
213 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
214 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a2'</span>].<span class="ruby-identifier">contains</span>, []
215 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c1'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'ac6'</span>]
216 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c1'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">true</span>
217 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c1'</span>].<span class="ruby-identifier">contains</span>, []
218 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c2'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'cc5'</span>]
219 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
220 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c2'</span>].<span class="ruby-identifier">contains</span>, []
221 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e1'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'ac6'</span>]
222 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e1'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
223 <span class="ruby-identifier">assert</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e1'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
224 <span class="ruby-identifier">assert</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e1'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceC1</span>)
225 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e2'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'ec5'</span>]
226 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
227 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e2'</span>].<span class="ruby-identifier">contains</span>, []
228 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">current_player</span>, <span class="ruby-value str">'a'</span>
229
230 <span class="ruby-identifier">game</span>.<span class="ruby-identifier">undo_move!</span>
231 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">8</span>
232 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a1'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'ac6'</span>]
233 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a1'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">true</span>
234 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a1'</span>].<span class="ruby-identifier">contains</span>, []
235 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a2'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'ac5'</span>]
236 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
237 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a2'</span>].<span class="ruby-identifier">contains</span>, []
238 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c1'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
239 <span class="ruby-identifier">assert</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c1'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
240
241 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c2'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'cc5'</span>]
242 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
243 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c2'</span>].<span class="ruby-identifier">contains</span>, []
244 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e1'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'ec5'</span>]
245 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e1'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
246 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e1'</span>].<span class="ruby-identifier">contains</span>, []
247 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e2'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'ec5'</span>]
248 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
249 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e2'</span>].<span class="ruby-identifier">contains</span>, []
250 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">current_player</span>, <span class="ruby-value str">'e'</span>
251
252 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c1'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a1'</span>].<span class="ruby-identifier">position</span>
253 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c1'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'ac6'</span>]
254
255
256 <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_moves!</span> <span class="ruby-identifier">move_set2a</span>.<span class="ruby-identifier">collect</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span> <span class="ruby-identifier">m</span>.<span class="ruby-identifier">to_move</span>(<span class="ruby-identifier">game</span>)}
257 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">9</span>
258 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a1'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'ac6'</span>]
259 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a1'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">true</span>
260 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a1'</span>].<span class="ruby-identifier">contains</span>, []
261 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a2'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'ac5'</span>]
262 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
263 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'a2'</span>].<span class="ruby-identifier">contains</span>, []
264 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c1'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'ac6'</span>]
265 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c1'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">true</span>
266 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c1'</span>].<span class="ruby-identifier">contains</span>, []
267 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c2'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'cc5'</span>]
268 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
269 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'c2'</span>].<span class="ruby-identifier">contains</span>, []
270 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e1'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'ac6'</span>]
271 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e1'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
272 <span class="ruby-identifier">assert</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e1'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
273 <span class="ruby-identifier">assert</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e1'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceC1</span>)
274 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e2'</span>].<span class="ruby-identifier">position</span>, <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'ec5'</span>]
275 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
276 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'e2'</span>].<span class="ruby-identifier">contains</span>, []
277 <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">current_player</span>, <span class="ruby-value str">'a'</span>
278
279 <span class="ruby-keyword kw">end</span></pre>
280 </body>
281 </html>