2 require File
.join(File
.dirname(__FILE__
), '..', 'lib', 'libttc')
5 class GameTest
< Test
::Unit::TestCase
8 assert_nothing_raised
{ Game
.new(6,6,6,6,6) }
9 assert_equal
[], Game
.new(6,6,6,6,6).history
14 game
= Game
.new(6,6,6,6,6)
16 pieceA1
= game
.pieces
['a1']
17 pieceA2
= game
.pieces
['a2']
18 pieceB2
= game
.pieces
['b2']
20 posA
= game
.board
.positions
['a']
21 posB
= game
.board
.positions
['b']
22 posA3
= game
.board
.positions
['a3']
23 posA4
= game
.board
.positions
['a4']
24 posA5
= game
.board
.positions
['a5']
26 moveA2A
= Move
.new(pieceA2
, posA
, true)
27 moveA1A5
= Move
.new(pieceA1
, posA5
)
28 moveA2A4
= Move
.new(pieceA2
, posA4
)
29 moveA2A3
= Move
.new(pieceA2
, posA3
)
30 moveB2A5
= Move
.new(pieceB2
, posA5
)
31 moveB2A3
= Move
.new(pieceB2
, posA3
)
32 moveB2A4
= Move
.new(pieceB2
, posA4
)
34 assert_equal
[], game
.history
35 assert_equal game
.pieces
['a1'].position
, game
.board
.positions
['a']
36 assert_equal game
.pieces
['a1'].captured
, false
37 assert_equal game
.pieces
['a1'].contains
, []
38 assert_equal game
.pieces
['a2'].position
, game
.board
.positions
['a']
39 assert_equal game
.pieces
['a2'].captured
, false
40 assert_equal game
.pieces
['a2'].contains
, []
41 assert_equal game
.pieces
['b2'].position
, game
.board
.positions
['b']
42 assert_equal game
.pieces
['b2'].captured
, false
43 assert_equal game
.pieces
['b2'].contains
, []
47 def test_single_moves_1
48 game
= Game
.new(6,6,6,6,6)
50 pieceA1
= game
.pieces
['a1']
51 pieceA2
= game
.pieces
['a2']
52 pieceB2
= game
.pieces
['b2']
54 posA
= game
.board
.positions
['a']
55 posB
= game
.board
.positions
['b']
56 posA3
= game
.board
.positions
['a3']
57 posA4
= game
.board
.positions
['a4']
58 posA5
= game
.board
.positions
['a5']
60 moveA2A
= Move
.new(pieceA2
, posA
, true)
61 moveA1A5
= Move
.new(pieceA1
, posA5
)
62 moveA2A4
= Move
.new(pieceA2
, posA4
)
63 moveA2A3
= Move
.new(pieceA2
, posA3
)
64 moveB2A5
= Move
.new(pieceB2
, posA5
)
65 moveB2A3
= Move
.new(pieceB2
, posA3
)
66 moveB2A4
= Move
.new(pieceB2
, posA4
)
68 assert_equal
[], game
.history
69 assert_equal game
.pieces
['a1'].position
, game
.board
.positions
['a']
70 assert_equal game
.pieces
['a1'].captured
, false
71 assert_equal game
.pieces
['a1'].contains
, []
72 assert_equal game
.pieces
['a2'].position
, game
.board
.positions
['a']
73 assert_equal game
.pieces
['a2'].captured
, false
74 assert_equal game
.pieces
['a2'].contains
, []
75 assert_equal game
.pieces
['b2'].position
, game
.board
.positions
['b']
76 assert_equal game
.pieces
['b2'].captured
, false
77 assert_equal game
.pieces
['b2'].contains
, []
79 assert_raise(InvalidMoveError
) {game
.apply_move
!(moveA1A5
, 'b')}
81 assert_equal
[], game
.history
82 assert_equal game
.pieces
['a1'].position
, game
.board
.positions
['a']
83 assert_equal game
.pieces
['a1'].captured
, false
84 assert_equal game
.pieces
['a1'].contains
, []
85 assert_equal game
.pieces
['a2'].position
, game
.board
.positions
['a']
86 assert_equal game
.pieces
['a2'].captured
, false
87 assert_equal game
.pieces
['a2'].contains
, []
88 assert_equal game
.pieces
['b2'].position
, game
.board
.positions
['b']
89 assert_equal game
.pieces
['b2'].captured
, false
90 assert_equal game
.pieces
['b2'].contains
, []
92 game
.apply_move
!(moveA1A5
, 'a')
93 assert_equal game
.history
.length
, 1
94 assert_equal game
.pieces
['a1'].position
, game
.board
.positions
['a5']
95 assert_equal game
.pieces
['a1'].captured
, false
96 assert_equal game
.pieces
['a1'].contains
, []
97 assert_equal game
.pieces
['a2'].position
, game
.board
.positions
['a']
98 assert_equal game
.pieces
['a2'].captured
, false
99 assert_equal game
.pieces
['a2'].contains
, []
100 assert_equal game
.pieces
['b2'].position
, game
.board
.positions
['b']
101 assert_equal game
.pieces
['b2'].captured
, false
102 assert_equal game
.pieces
['b2'].contains
, []
105 def test_separate_moves
106 game
= Game
.new(6,6,6,6,6)
108 pieceA1
= game
.pieces
['a1']
109 pieceA2
= game
.pieces
['a2']
110 pieceB2
= game
.pieces
['b2']
112 posA
= game
.board
.positions
['a']
113 posB
= game
.board
.positions
['b']
114 posA3
= game
.board
.positions
['a3']
115 posA4
= game
.board
.positions
['a4']
116 posA5
= game
.board
.positions
['a5']
118 moveA2A
= Move
.new(pieceA2
, posA
, true)
119 moveA1A5
= Move
.new(pieceA1
, posA5
)
120 moveA2A4
= Move
.new(pieceA2
, posA4
)
121 moveA2A3
= Move
.new(pieceA2
, posA3
)
122 moveB2A5
= Move
.new(pieceB2
, posA5
)
123 moveB2A3
= Move
.new(pieceB2
, posA3
)
124 moveB2A4
= Move
.new(pieceB2
, posA4
)
126 assert_equal
[], game
.history
127 assert_equal game
.pieces
['a1'].position
, game
.board
.positions
['a']
128 assert_equal game
.pieces
['a1'].captured
, false
129 assert_equal game
.pieces
['a1'].contains
, []
130 assert_equal game
.pieces
['a2'].position
, game
.board
.positions
['a']
131 assert_equal game
.pieces
['a2'].captured
, false
132 assert_equal game
.pieces
['a2'].contains
, []
133 assert_equal game
.pieces
['b2'].position
, game
.board
.positions
['b']
134 assert_equal game
.pieces
['b2'].captured
, false
135 assert_equal game
.pieces
['b2'].contains
, []
137 game
.apply_move
!(moveA1A5
, 'a')
138 assert_equal game
.history
.length
, 1
139 assert_equal game
.pieces
['a1'].position
, game
.board
.positions
['a5']
140 assert_equal game
.pieces
['a1'].captured
, false
141 assert_equal game
.pieces
['a1'].contains
, []
142 assert_equal game
.pieces
['a2'].position
, game
.board
.positions
['a']
143 assert_equal game
.pieces
['a2'].captured
, false
144 assert_equal game
.pieces
['a2'].contains
, []
145 assert_equal game
.pieces
['b2'].position
, game
.board
.positions
['b']
146 assert_equal game
.pieces
['b2'].captured
, false
147 assert_equal game
.pieces
['b2'].contains
, []
149 game
.apply_move
!(moveB2A3
, 'b')
150 assert_equal game
.history
.length
, 2
151 assert_equal game
.pieces
['a1'].position
, game
.board
.positions
['a5']
152 assert_equal game
.pieces
['a1'].captured
, false
153 assert_equal game
.pieces
['a1'].contains
, []
154 assert_equal game
.pieces
['a2'].position
, game
.board
.positions
['a']
155 assert_equal game
.pieces
['a2'].captured
, false
156 assert_equal game
.pieces
['a2'].contains
, []
157 assert_equal game
.pieces
['b2'].position
, game
.board
.positions
['a3']
158 assert_equal game
.pieces
['b2'].captured
, false
159 assert_equal game
.pieces
['b2'].contains
, []
165 game
= Game
.new(6,6,6,6,6)
167 pieceA1
= game
.pieces
['a1']
168 pieceA2
= game
.pieces
['a2']
169 pieceB2
= game
.pieces
['b2']
171 posA
= game
.board
.positions
['a']
172 posB
= game
.board
.positions
['b']
173 posA3
= game
.board
.positions
['a3']
174 posA4
= game
.board
.positions
['a4']
175 posA5
= game
.board
.positions
['a5']
177 moveA2A
= Move
.new(pieceA2
, posA
, true)
178 moveA1A5
= Move
.new(pieceA1
, posA5
)
179 moveA2A4
= Move
.new(pieceA2
, posA4
)
180 moveA2A3
= Move
.new(pieceA2
, posA3
)
181 moveB2A5
= Move
.new(pieceB2
, posA5
)
182 moveB2A3
= Move
.new(pieceB2
, posA3
)
183 moveB2A4
= Move
.new(pieceB2
, posA4
)
185 assert_equal
[], game
.history
186 assert_equal game
.pieces
['a1'].position
, game
.board
.positions
['a']
187 assert_equal game
.pieces
['a1'].captured
, false
188 assert_equal game
.pieces
['a1'].contains
, []
189 assert_equal game
.pieces
['a2'].position
, game
.board
.positions
['a']
190 assert_equal game
.pieces
['a2'].captured
, false
191 assert_equal game
.pieces
['a2'].contains
, []
192 assert_equal game
.pieces
['b2'].position
, game
.board
.positions
['b']
193 assert_equal game
.pieces
['b2'].captured
, false
194 assert_equal game
.pieces
['b2'].contains
, []
196 game
.apply_move
!(moveA1A5
, 'a')
197 assert_equal game
.history
.length
, 1
198 assert_equal game
.pieces
['a1'].position
, game
.board
.positions
['a5']
199 assert_equal game
.pieces
['a1'].captured
, false
200 assert_equal game
.pieces
['a1'].contains
, []
201 assert_equal game
.pieces
['a2'].position
, game
.board
.positions
['a']
202 assert_equal game
.pieces
['a2'].captured
, false
203 assert_equal game
.pieces
['a2'].contains
, []
204 assert_equal game
.pieces
['b2'].position
, game
.board
.positions
['b']
205 assert_equal game
.pieces
['b2'].captured
, false
206 assert_equal game
.pieces
['b2'].contains
, []
208 game
.apply_move
!(moveB2A5
, 'b')
209 assert_equal game
.history
.length
, 2
210 assert_equal game
.pieces
['a1'].position
, game
.board
.positions
['a5']
211 assert_equal game
.pieces
['a1'].captured
, true
212 assert_equal game
.pieces
['a1'].contains
, []
213 assert_equal game
.pieces
['a2'].position
, game
.board
.positions
['a']
214 assert_equal game
.pieces
['a2'].captured
, false
215 assert_equal game
.pieces
['a2'].contains
, []
216 assert_equal game
.pieces
['b2'].position
, game
.board
.positions
['a5']
217 assert_equal game
.pieces
['b2'].captured
, false
218 assert game
.pieces
['b2'].contains
.include?(pieceA1
)
219 assert_equal game
.pieces
['b2'].contains
.length
, 1
223 def test_no_captures_on_safe_spaces
224 game
= Game
.new(6,6,6,6,6)
226 pieceA1
= game
.pieces
['a1']
227 pieceA2
= game
.pieces
['a2']
228 pieceB2
= game
.pieces
['b2']
230 posA
= game
.board
.positions
['a']
231 posB
= game
.board
.positions
['b']
232 posA3
= game
.board
.positions
['a3']
233 posA4
= game
.board
.positions
['a4']
234 posA5
= game
.board
.positions
['a5']
236 moveA2A
= Move
.new(pieceA2
, posA
, true)
237 moveA1A5
= Move
.new(pieceA1
, posA5
)
238 moveA2A4
= Move
.new(pieceA2
, posA4
)
239 moveA2A3
= Move
.new(pieceA2
, posA3
)
240 moveB2A5
= Move
.new(pieceB2
, posA5
)
241 moveB2A3
= Move
.new(pieceB2
, posA3
)
242 moveB2A4
= Move
.new(pieceB2
, posA4
)
244 assert_equal
[], game
.history
245 assert_equal game
.pieces
['a1'].position
, game
.board
.positions
['a']
246 assert_equal game
.pieces
['a1'].captured
, false
247 assert_equal game
.pieces
['a1'].contains
, []
248 assert_equal game
.pieces
['a2'].position
, game
.board
.positions
['a']
249 assert_equal game
.pieces
['a2'].captured
, false
250 assert_equal game
.pieces
['a2'].contains
, []
251 assert_equal game
.pieces
['b2'].position
, game
.board
.positions
['b']
252 assert_equal game
.pieces
['b2'].captured
, false
253 assert_equal game
.pieces
['b2'].contains
, []
255 game
.apply_move
!(moveA2A4
, 'a')
256 assert_equal game
.history
.length
, 1
257 assert_equal game
.pieces
['a1'].position
, game
.board
.positions
['a']
258 assert_equal game
.pieces
['a1'].captured
, false
259 assert_equal game
.pieces
['a1'].contains
, []
260 assert_equal game
.pieces
['a2'].position
, game
.board
.positions
['a4']
261 assert_equal game
.pieces
['a2'].captured
, false
262 assert_equal game
.pieces
['a2'].contains
, []
263 assert_equal game
.pieces
['b2'].position
, game
.board
.positions
['b']
264 assert_equal game
.pieces
['b2'].captured
, false
265 assert_equal game
.pieces
['b2'].contains
, []
267 game
.apply_move
!(moveB2A4
, 'b')
268 assert_equal game
.history
.length
, 2
269 assert_equal game
.pieces
['a1'].position
, game
.board
.positions
['a']
270 assert_equal game
.pieces
['a1'].captured
, false
271 assert_equal game
.pieces
['a1'].contains
, []
272 assert_equal game
.pieces
['a2'].position
, game
.board
.positions
['a4']
273 assert_equal game
.pieces
['a2'].captured
, false
274 assert_equal game
.pieces
['a2'].contains
, []
275 assert_equal game
.pieces
['b2'].position
, game
.board
.positions
['a4']
276 assert_equal game
.pieces
['b2'].captured
, false
277 assert_equal game
.pieces
['b2'].contains
, []
280 def test_move_after_captures
281 game
= Game
.new(6,6,6,6,6)
283 pieceA1
= game
.pieces
['a1']
284 pieceA2
= game
.pieces
['a2']
285 pieceB2
= game
.pieces
['b2']
287 posA
= game
.board
.positions
['a']
288 posB
= game
.board
.positions
['b']
289 posA3
= game
.board
.positions
['a3']
290 posA4
= game
.board
.positions
['a4']
291 posA5
= game
.board
.positions
['a5']
293 moveA2A
= Move
.new(pieceA2
, posA
, true)
294 moveA1A5
= Move
.new(pieceA1
, posA5
)
295 moveA2A4
= Move
.new(pieceA2
, posA4
)
296 moveA2A3
= Move
.new(pieceA2
, posA3
)
297 moveB2A5
= Move
.new(pieceB2
, posA5
)
298 moveB2A3
= Move
.new(pieceB2
, posA3
)
299 moveB2A4
= Move
.new(pieceB2
, posA4
)
301 assert_equal
[], game
.history
302 assert_equal game
.pieces
['a1'].position
, game
.board
.positions
['a']
303 assert_equal game
.pieces
['a1'].captured
, false
304 assert_equal game
.pieces
['a1'].contains
, []
305 assert_equal game
.pieces
['a2'].position
, game
.board
.positions
['a']
306 assert_equal game
.pieces
['a2'].captured
, false
307 assert_equal game
.pieces
['a2'].contains
, []
308 assert_equal game
.pieces
['b2'].position
, game
.board
.positions
['b']
309 assert_equal game
.pieces
['b2'].captured
, false
310 assert_equal game
.pieces
['b2'].contains
, []
312 game
.apply_move
!(moveA1A5
, 'a')
313 assert_equal game
.history
.length
, 1
314 assert_equal game
.pieces
['a1'].position
, game
.board
.positions
['a5']
315 assert_equal game
.pieces
['a1'].captured
, false
316 assert_equal game
.pieces
['a1'].contains
, []
317 assert_equal game
.pieces
['a2'].position
, game
.board
.positions
['a']
318 assert_equal game
.pieces
['a2'].captured
, false
319 assert_equal game
.pieces
['a2'].contains
, []
320 assert_equal game
.pieces
['b2'].position
, game
.board
.positions
['b']
321 assert_equal game
.pieces
['b2'].captured
, false
322 assert_equal game
.pieces
['b2'].contains
, []
324 game
.apply_move
!(moveB2A5
, 'b')
325 assert_equal game
.history
.length
, 2
326 assert_equal game
.pieces
['a1'].position
, game
.board
.positions
['a5']
327 assert_equal game
.pieces
['a1'].captured
, true
328 assert_equal game
.pieces
['a1'].contains
, []
329 assert_equal game
.pieces
['a2'].position
, game
.board
.positions
['a']
330 assert_equal game
.pieces
['a2'].captured
, false
331 assert_equal game
.pieces
['a2'].contains
, []
332 assert_equal game
.pieces
['b2'].position
, game
.board
.positions
['a5']
333 assert_equal game
.pieces
['b2'].captured
, false
334 assert game
.pieces
['b2'].contains
.include?(pieceA1
)
335 assert_equal game
.pieces
['b2'].contains
.length
, 1
337 game
.apply_move
!(moveA2A4
, 'a')
338 assert_equal game
.history
.length
, 3
339 assert_equal game
.pieces
['a1'].position
, game
.board
.positions
['a5']
340 assert_equal game
.pieces
['a1'].captured
, true
341 assert_equal game
.pieces
['a1'].contains
, []
342 assert_equal game
.pieces
['a2'].position
, game
.board
.positions
['a4']
343 assert_equal game
.pieces
['a2'].captured
, false
344 assert_equal game
.pieces
['a2'].contains
, []
345 assert_equal game
.pieces
['b2'].position
, game
.board
.positions
['a5']
346 assert_equal game
.pieces
['b2'].captured
, false
347 assert game
.pieces
['b2'].contains
.include?(pieceA1
)
348 assert_equal game
.pieces
['b2'].contains
.length
, 1
350 game
.apply_move
!(moveB2A3
, 'b')
351 assert_equal game
.history
.length
, 4
352 assert_equal game
.pieces
['a1'].position
, game
.board
.positions
['a3']
353 assert_equal game
.pieces
['a1'].captured
, true
354 assert_equal game
.pieces
['a1'].contains
, []
355 assert_equal game
.pieces
['a2'].position
, game
.board
.positions
['a4']
356 assert_equal game
.pieces
['a2'].captured
, false
357 assert_equal game
.pieces
['a2'].contains
, []
358 assert_equal game
.pieces
['b2'].position
, game
.board
.positions
['a3']
359 assert_equal game
.pieces
['b2'].captured
, false
360 assert game
.pieces
['b2'].contains
.include?(pieceA1
)
361 assert_equal game
.pieces
['b2'].contains
.length
, 1
366 game
= Game
.new(6,6,6,6,6)
368 pieceA1
= game
.pieces
['a1']
369 pieceA2
= game
.pieces
['a2']
370 pieceB2
= game
.pieces
['b2']
372 posA
= game
.board
.positions
['a']
373 posB
= game
.board
.positions
['b']
374 posA3
= game
.board
.positions
['a3']
375 posA4
= game
.board
.positions
['a4']
376 posA5
= game
.board
.positions
['a5']
378 moveA2A
= Move
.new(pieceA2
, posA
, true)
379 moveA1A3
= Move
.new(pieceA1
, posA3
)
380 moveA1A5
= Move
.new(pieceA1
, posA5
)
381 moveA2A4
= Move
.new(pieceA2
, posA4
)
382 moveA2A3
= Move
.new(pieceA2
, posA3
)
383 moveB2A5
= Move
.new(pieceB2
, posA5
)
384 moveB2A3
= Move
.new(pieceB2
, posA3
)
385 moveB2A4
= Move
.new(pieceB2
, posA4
)
387 assert_equal
[], game
.history
388 assert_equal game
.pieces
['a1'].position
, game
.board
.positions
['a']
389 assert_equal game
.pieces
['a1'].captured
, false
390 assert_equal game
.pieces
['a1'].contains
, []
391 assert_equal game
.pieces
['a2'].position
, game
.board
.positions
['a']
392 assert_equal game
.pieces
['a2'].captured
, false
393 assert_equal game
.pieces
['a2'].contains
, []
394 assert_equal game
.pieces
['b2'].position
, game
.board
.positions
['b']
395 assert_equal game
.pieces
['b2'].captured
, false
396 assert_equal game
.pieces
['b2'].contains
, []
398 game
.apply_move
!(moveA1A5
, 'a')
399 assert_equal game
.history
.length
, 1
400 assert_equal game
.pieces
['a1'].position
, game
.board
.positions
['a5']
401 assert_equal game
.pieces
['a1'].captured
, false
402 assert_equal game
.pieces
['a1'].contains
, []
403 assert_equal game
.pieces
['a2'].position
, game
.board
.positions
['a']
404 assert_equal game
.pieces
['a2'].captured
, false
405 assert_equal game
.pieces
['a2'].contains
, []
406 assert_equal game
.pieces
['b2'].position
, game
.board
.positions
['b']
407 assert_equal game
.pieces
['b2'].captured
, false
408 assert_equal game
.pieces
['b2'].contains
, []
410 game
.apply_move
!(moveB2A3
, 'b')
411 assert_equal game
.history
.length
, 2
412 assert_equal game
.pieces
['a1'].position
, game
.board
.positions
['a5']
413 assert_equal game
.pieces
['a1'].captured
, false
414 assert_equal game
.pieces
['a1'].contains
, []
415 assert_equal game
.pieces
['a2'].position
, game
.board
.positions
['a']
416 assert_equal game
.pieces
['a2'].captured
, false
417 assert_equal game
.pieces
['a2'].contains
, []
418 assert_equal game
.pieces
['b2'].position
, game
.board
.positions
['a3']
419 assert_equal game
.pieces
['b2'].captured
, false
420 assert_equal game
.pieces
['b2'].contains
, []
422 game
.apply_move
!(moveA2A4
, 'a')
423 assert_equal game
.history
.length
, 3
424 assert_equal game
.pieces
['a1'].position
, game
.board
.positions
['a5']
425 assert_equal game
.pieces
['a1'].captured
, false
426 assert_equal game
.pieces
['a1'].contains
, []
427 assert_equal game
.pieces
['a2'].position
, game
.board
.positions
['a4']
428 assert_equal game
.pieces
['a2'].captured
, false
429 assert_equal game
.pieces
['a2'].contains
, []
430 assert_equal game
.pieces
['b2'].position
, game
.board
.positions
['a3']
431 assert_equal game
.pieces
['b2'].captured
, false
432 assert_equal game
.pieces
['b2'].contains
, []
434 game
.apply_move
!(moveB2A5
, 'b')
435 assert_equal game
.history
.length
, 4
436 assert_equal game
.pieces
['a1'].position
, game
.board
.positions
['a5']
437 assert_equal game
.pieces
['a1'].captured
, true
438 assert_equal game
.pieces
['a1'].contains
, []
439 assert_equal game
.pieces
['a2'].position
, game
.board
.positions
['a4']
440 assert_equal game
.pieces
['a2'].captured
, false
441 assert_equal game
.pieces
['a2'].contains
, []
442 assert_equal game
.pieces
['b2'].position
, game
.board
.positions
['a5']
443 assert_equal game
.pieces
['b2'].captured
, false
444 assert game
.pieces
['b2'].contains
.include?(pieceA1
)
445 assert_equal game
.pieces
['b2'].contains
.length
, 1
447 assert_raise(InvalidMoveError
) {game
.apply_move
!(moveA1A3
, 'a')}
448 assert_equal game
.history
.length
, 4
449 assert_equal game
.pieces
['a1'].position
, game
.board
.positions
['a5']
450 assert_equal game
.pieces
['a1'].captured
, true
451 assert_equal game
.pieces
['a1'].contains
, []
452 assert_equal game
.pieces
['a2'].position
, game
.board
.positions
['a4']
453 assert_equal game
.pieces
['a2'].captured
, false
454 assert_equal game
.pieces
['a2'].contains
, []
455 assert_equal game
.pieces
['b2'].position
, game
.board
.positions
['a5']
456 assert_equal game
.pieces
['b2'].captured
, false
457 assert game
.pieces
['b2'].contains
.include?(pieceA1
)
458 assert_equal game
.pieces
['b2'].contains
.length
, 1
460 game
.apply_move
!(moveA2A3
, 'a')
461 assert_equal game
.history
.length
, 5
462 assert_equal game
.pieces
['a1'].position
, game
.board
.positions
['a5']
463 assert_equal game
.pieces
['a1'].captured
, true
464 assert_equal game
.pieces
['a1'].contains
, []
465 assert_equal game
.pieces
['a2'].position
, game
.board
.positions
['a3']
466 assert_equal game
.pieces
['a2'].captured
, false
467 assert_equal game
.pieces
['a2'].contains
, []
468 assert_equal game
.pieces
['b2'].position
, game
.board
.positions
['a5']
469 assert_equal game
.pieces
['b2'].captured
, false
470 assert game
.pieces
['b2'].contains
.include?(pieceA1
)
471 assert_equal game
.pieces
['b2'].contains
.length
, 1
473 game
.apply_move
!(moveB2A4
, 'b')
474 assert_equal game
.history
.length
, 6
475 assert_equal game
.pieces
['a1'].position
, game
.board
.positions
['a4']
476 assert_equal game
.pieces
['a1'].captured
, true
477 assert_equal game
.pieces
['a1'].contains
, []
478 assert_equal game
.pieces
['a2'].position
, game
.board
.positions
['a3']
479 assert_equal game
.pieces
['a2'].captured
, false
480 assert_equal game
.pieces
['a2'].contains
, []
481 assert_equal game
.pieces
['b2'].position
, game
.board
.positions
['a4']
482 assert_equal game
.pieces
['b2'].captured
, false
483 assert game
.pieces
['b2'].contains
.include?(pieceA1
)
484 assert_equal game
.pieces
['b2'].contains
.length
, 1
486 game
.apply_move
!(moveA2A4
, 'a')
487 assert_equal game
.history
.length
, 7
488 assert_equal game
.pieces
['a1'].position
, game
.board
.positions
['a4']
489 assert_equal game
.pieces
['a1'].captured
, true
490 assert_equal game
.pieces
['a1'].contains
, []
491 assert_equal game
.pieces
['a2'].position
, game
.board
.positions
['a4']
492 assert_equal game
.pieces
['a2'].captured
, false
493 assert_equal game
.pieces
['a2'].contains
, []
494 assert_equal game
.pieces
['b2'].position
, game
.board
.positions
['a4']
495 assert_equal game
.pieces
['b2'].captured
, false
496 assert game
.pieces
['b2'].contains
.include?(pieceA1
)
497 assert_equal game
.pieces
['b2'].contains
.length
, 1
499 game
.apply_move
!(moveB2A3
, 'b')
500 assert_equal game
.history
.length
, 8
501 assert_equal game
.pieces
['a1'].position
, game
.board
.positions
['a3']
502 assert_equal game
.pieces
['a1'].captured
, true
503 assert_equal game
.pieces
['a1'].contains
, []
504 assert_equal game
.pieces
['a2'].position
, game
.board
.positions
['a4']
505 assert_equal game
.pieces
['a2'].captured
, false
506 assert_equal game
.pieces
['a2'].contains
, []
507 assert_equal game
.pieces
['b2'].position
, game
.board
.positions
['a3']
508 assert_equal game
.pieces
['b2'].captured
, false
509 assert game
.pieces
['b2'].contains
.include?(pieceA1
)
510 assert_equal game
.pieces
['b2'].contains
.length
, 1
512 game
.apply_move
!(moveA2A3
, 'a')
513 assert_equal game
.history
.length
, 9
514 assert_equal game
.pieces
['a1'].position
, game
.board
.positions
['a3']
515 assert_equal game
.pieces
['a1'].captured
, true
516 assert_equal game
.pieces
['a1'].contains
, []
517 assert_equal game
.pieces
['a2'].position
, game
.board
.positions
['a3']
518 assert_equal game
.pieces
['a2'].captured
, false
519 assert game
.pieces
['a2'].contains
.include?(pieceA1
)
520 assert game
.pieces
['a2'].contains
.include?(pieceB2
)
521 assert_equal game
.pieces
['a2'].contains
.length
, 2
522 assert_equal game
.pieces
['b2'].position
, game
.board
.positions
['a3']
523 assert_equal game
.pieces
['b2'].captured
, true
524 assert_equal game
.pieces
['b2'].contains
, []
526 game
.apply_move
!(moveA2A
, 'a')
527 assert_equal game
.history
.length
, 10
528 assert_equal game
.pieces
['a1'].position
, game
.board
.positions
['a']
529 assert_equal game
.pieces
['a1'].captured
, false
530 assert_equal game
.pieces
['a1'].contains
, []
531 assert_equal game
.pieces
['a2'].position
, game
.board
.positions
['a']
532 assert_equal game
.pieces
['a2'].captured
, false
533 assert_equal game
.pieces
['a2'].contains
, []
534 assert_equal game
.pieces
['b2'].position
, game
.board
.positions
['a']
535 assert_equal game
.pieces
['b2'].captured
, true
536 assert_equal game
.pieces
['b2'].contains
, []
539 def test_apply_moves
!
541 move_set
= ['A1 A2', 'C1 C2', 'E1 E2']
542 assert_nothing_raised
{ move_set
.collect
{ |m
| m
.to_move(game
) } }
543 move_set_m
= move_set
.collect
{ |m
| m
.to_move(game
) }
544 assert_nothing_raised
{ game
.apply_moves
! move_set_m
}
547 def test_eliminations
548 game
= Game
.new(3, 6, 6, 6, 2)
550 pieceA1
= game
.pieces
['a1']
551 pieceA2
= game
.pieces
['a2']
552 pieceC1
= game
.pieces
['c1']
553 pieceC2
= game
.pieces
['c2']
554 pieceE1
= game
.pieces
['e1']
555 pieceE2
= game
.pieces
['e2']
557 posAC5
= game
.board
.positions
['ac5']
558 posBC5
= game
.board
.positions
['bc5']
559 posCC5
= game
.board
.positions
['cc5']
560 posEC5
= game
.board
.positions
['ec5']
561 posAC6
= game
.board
.positions
['ac6']
563 move_set1
= ['A1 AC5', 'A2 AC5', 'A1 AC6',
564 'C1 CC5', 'C2 CC5', 'C1 AC6'] # A1 now captured by C1
565 move_set2
= ['E1 EC5', 'E2 EC5', 'E1 AC6'] # C1+A1 now caputred by E1
566 move_set3
= ['A2 AC6'] # E1+C1+A1 captured by A2
567 move_set4
= ['C2 AC6'] # A2+E1+C1+A1 captured by C2. Player A now eliminated
568 move_set5
= ['E2 BC5']
569 move_set6
= ['C2 BC5'] # C2 (plus stack) captures E2. Player E now eliminated
571 assert_equal
[], game
.history
572 assert_equal game
.pieces
['a1'].position
, game
.board
.positions
['a']
573 assert_equal game
.pieces
['a1'].captured
, false
574 assert_equal game
.pieces
['a1'].contains
, []
575 assert_equal game
.pieces
['a2'].position
, game
.board
.positions
['a']
576 assert_equal game
.pieces
['a2'].captured
, false
577 assert_equal game
.pieces
['a2'].contains
, []
578 assert_equal game
.pieces
['c1'].position
, game
.board
.positions
['c']
579 assert_equal game
.pieces
['c1'].captured
, false
580 assert_equal game
.pieces
['c1'].contains
, []
581 assert_equal game
.pieces
['c2'].position
, game
.board
.positions
['c']
582 assert_equal game
.pieces
['c2'].captured
, false
583 assert_equal game
.pieces
['c2'].contains
, []
584 assert_equal game
.pieces
['e1'].position
, game
.board
.positions
['e']
585 assert_equal game
.pieces
['e1'].captured
, false
586 assert_equal game
.pieces
['e1'].contains
, []
587 assert_equal game
.pieces
['e2'].position
, game
.board
.positions
['e']
588 assert_equal game
.pieces
['e2'].captured
, false
589 assert_equal game
.pieces
['e2'].contains
, []
590 assert_equal game
.current_player
, 'a'
592 game
.apply_moves
! move_set1
.collect
{|m
| m
.to_move(game
)}
593 assert_equal game
.history
.length
, 6
594 assert_equal game
.pieces
['a1'].position
, game
.board
.positions
['ac6']
595 assert_equal game
.pieces
['a1'].captured
, true
596 assert_equal game
.pieces
['a1'].contains
, []
597 assert_equal game
.pieces
['a2'].position
, game
.board
.positions
['ac5']
598 assert_equal game
.pieces
['a2'].captured
, false
599 assert_equal game
.pieces
['a2'].contains
, []
600 assert_equal game
.pieces
['c1'].position
, game
.board
.positions
['ac6']
601 assert_equal game
.pieces
['c1'].captured
, false
602 assert game
.pieces
['c1'].contains
.include?(pieceA1
)
603 assert_equal game
.pieces
['c2'].position
, game
.board
.positions
['cc5']
604 assert_equal game
.pieces
['c2'].captured
, false
605 assert_equal game
.pieces
['c2'].contains
, []
606 assert_equal game
.pieces
['e1'].position
, game
.board
.positions
['e']
607 assert_equal game
.pieces
['e1'].captured
, false
608 assert_equal game
.pieces
['e1'].contains
, []
609 assert_equal game
.pieces
['e2'].position
, game
.board
.positions
['e']
610 assert_equal game
.pieces
['e2'].captured
, false
611 assert_equal game
.pieces
['e2'].contains
, []
612 assert_equal game
.current_player
, 'e'
614 game
.apply_moves
! move_set2
.collect
{|m
| m
.to_move(game
)}
615 assert_equal game
.pieces
['a1'].position
, game
.board
.positions
['ac6']
616 assert_equal game
.pieces
['a1'].captured
, true
617 assert_equal game
.pieces
['a1'].contains
, []
618 assert_equal game
.pieces
['a2'].position
, game
.board
.positions
['ac5']
619 assert_equal game
.pieces
['a2'].captured
, false
620 assert_equal game
.pieces
['a2'].contains
, []
621 assert_equal game
.pieces
['c1'].position
, game
.board
.positions
['ac6']
622 assert_equal game
.pieces
['c1'].captured
, true
623 assert_equal game
.pieces
['c1'].contains
, []
624 assert_equal game
.pieces
['c2'].position
, game
.board
.positions
['cc5']
625 assert_equal game
.pieces
['c2'].captured
, false
626 assert_equal game
.pieces
['c2'].contains
, []
627 assert_equal game
.pieces
['e1'].position
, game
.board
.positions
['ac6']
628 assert_equal game
.pieces
['e1'].captured
, false
629 assert game
.pieces
['e1'].contains
.include?(pieceA1
)
630 assert game
.pieces
['e1'].contains
.include?(pieceC1
)
631 assert_equal game
.pieces
['e2'].position
, game
.board
.positions
['ec5']
632 assert_equal game
.pieces
['e2'].captured
, false
633 assert_equal game
.pieces
['e2'].contains
, []
634 assert_equal game
.current_player
, 'a'
636 game
.apply_moves
! move_set3
.collect
{|m
| m
.to_move(game
)}
637 assert_equal game
.pieces
['a1'].position
, game
.board
.positions
['ac6']
638 assert_equal game
.pieces
['a1'].captured
, true
639 assert_equal game
.pieces
['a1'].contains
, []
640 assert_equal game
.pieces
['a2'].position
, game
.board
.positions
['ac6']
641 assert_equal game
.pieces
['a2'].captured
, false
642 assert game
.pieces
['a2'].contains
.include?(pieceA1
)
643 assert game
.pieces
['a2'].contains
.include?(pieceC1
)
644 assert game
.pieces
['a2'].contains
.include?(pieceE1
)
645 assert_equal game
.pieces
['c1'].position
, game
.board
.positions
['ac6']
646 assert_equal game
.pieces
['c1'].captured
, true
647 assert_equal game
.pieces
['c1'].contains
, []
648 assert_equal game
.pieces
['c2'].position
, game
.board
.positions
['cc5']
649 assert_equal game
.pieces
['c2'].captured
, false
650 assert_equal game
.pieces
['c2'].contains
, []
651 assert_equal game
.pieces
['e1'].position
, game
.board
.positions
['ac6']
652 assert_equal game
.pieces
['e1'].captured
, true
653 assert_equal game
.pieces
['e1'].contains
, []
654 assert_equal game
.pieces
['e2'].position
, game
.board
.positions
['ec5']
655 assert_equal game
.pieces
['e2'].captured
, false
656 assert_equal game
.pieces
['e2'].contains
, []
657 assert_equal game
.current_player
, 'c'
659 game
.apply_moves
! move_set4
.collect
{|m
| m
.to_move(game
)}
660 assert_equal game
.pieces
['a1'].position
, game
.board
.positions
['ac6']
661 assert_equal game
.pieces
['a1'].captured
, true
662 assert_equal game
.pieces
['a1'].contains
, []
663 assert_equal game
.pieces
['a2'].position
, game
.board
.positions
['ac6']
664 assert_equal game
.pieces
['a2'].captured
, true
665 assert_equal game
.pieces
['a2'].contains
, []
666 assert_equal game
.pieces
['c1'].position
, game
.board
.positions
['ac6']
667 assert_equal game
.pieces
['c1'].captured
, true
668 assert_equal game
.pieces
['c1'].contains
, []
669 assert_equal game
.pieces
['c2'].position
, game
.board
.positions
['ac6']
670 assert_equal game
.pieces
['c2'].captured
, false
671 assert game
.pieces
['c2'].contains
.include?(pieceA1
)
672 assert game
.pieces
['c2'].contains
.include?(pieceA2
)
673 assert game
.pieces
['c2'].contains
.include?(pieceC1
)
674 assert game
.pieces
['c2'].contains
.include?(pieceE1
)
675 assert_equal game
.pieces
['e1'].position
, game
.board
.positions
['ac6']
676 assert_equal game
.pieces
['e1'].captured
, true
677 assert_equal game
.pieces
['e1'].contains
, []
678 assert_equal game
.pieces
['e2'].position
, game
.board
.positions
['ec5']
679 assert_equal game
.pieces
['e2'].captured
, false
680 assert_equal game
.pieces
['e2'].contains
, []
681 assert_equal game
.current_player
, 'e'
683 game
.apply_moves
! move_set5
.collect
{|m
| m
.to_move(game
)}
684 assert_equal game
.pieces
['a1'].position
, game
.board
.positions
['ac6']
685 assert_equal game
.pieces
['a1'].captured
, true
686 assert_equal game
.pieces
['a1'].contains
, []
687 assert_equal game
.pieces
['a2'].position
, game
.board
.positions
['ac6']
688 assert_equal game
.pieces
['a2'].captured
, true
689 assert_equal game
.pieces
['a2'].contains
, []
690 assert_equal game
.pieces
['c1'].position
, game
.board
.positions
['ac6']
691 assert_equal game
.pieces
['c1'].captured
, true
692 assert_equal game
.pieces
['c1'].contains
, []
693 assert_equal game
.pieces
['c2'].position
, game
.board
.positions
['ac6']
694 assert_equal game
.pieces
['c2'].captured
, false
695 assert game
.pieces
['c2'].contains
.include?(pieceA1
)
696 assert game
.pieces
['c2'].contains
.include?(pieceA2
)
697 assert game
.pieces
['c2'].contains
.include?(pieceC1
)
698 assert game
.pieces
['c2'].contains
.include?(pieceE1
)
699 assert_equal game
.pieces
['e1'].position
, game
.board
.positions
['ac6']
700 assert_equal game
.pieces
['e1'].captured
, true
701 assert_equal game
.pieces
['e1'].contains
, []
702 assert_equal game
.pieces
['e2'].position
, game
.board
.positions
['bc5']
703 assert_equal game
.pieces
['e2'].captured
, false
704 assert_equal game
.pieces
['e2'].contains
, []
705 assert_equal game
.current_player
, 'c'
707 assert_raise (GameWonNotice
) { game
.apply_moves
! move_set6
.collect
{|m
| m
.to_move(game
)} }
713 pieceA1
= game
.pieces
['a1']
714 pieceA2
= game
.pieces
['a2']
715 pieceC1
= game
.pieces
['c1']
716 pieceC2
= game
.pieces
['c2']
717 pieceE1
= game
.pieces
['e1']
718 pieceE2
= game
.pieces
['e2']
720 assert_equal
[], game
.history
721 assert_equal game
.pieces
['a1'], pieceA1
722 assert_equal game
.pieces
['a2'], pieceA2
723 assert_equal game
.pieces
['c1'], pieceC1
724 assert_equal game
.pieces
['c2'], pieceC2
725 assert_equal game
.pieces
['e1'], pieceE1
726 assert_equal game
.pieces
['e2'], pieceE2
727 assert_equal game
.pieces
['a1'].position
, game
.board
.positions
['a']
728 assert_equal game
.pieces
['a1'].captured
, false
729 assert_equal game
.pieces
['a1'].contains
, []
730 assert_equal game
.pieces
['a2'].position
, game
.board
.positions
['a']
731 assert_equal game
.pieces
['a2'].captured
, false
732 assert_equal game
.pieces
['a2'].contains
, []
733 assert_equal game
.pieces
['c1'].position
, game
.board
.positions
['c']
734 assert_equal game
.pieces
['c1'].captured
, false
735 assert_equal game
.pieces
['c1'].contains
, []
736 assert_equal game
.pieces
['c2'].position
, game
.board
.positions
['c']
737 assert_equal game
.pieces
['c2'].captured
, false
738 assert_equal game
.pieces
['c2'].contains
, []
739 assert_equal game
.pieces
['e1'].position
, game
.board
.positions
['e']
740 assert_equal game
.pieces
['e1'].captured
, false
741 assert_equal game
.pieces
['e1'].contains
, []
742 assert_equal game
.pieces
['e2'].position
, game
.board
.positions
['e']
743 assert_equal game
.pieces
['e2'].captured
, false
744 assert_equal game
.pieces
['e2'].contains
, []
745 assert_equal game
.current_player
, 'a'
748 assert_equal
[], game
.history
749 assert_equal game
.pieces
['a1'], pieceA1
750 assert_equal game
.pieces
['a2'], pieceA2
751 assert_equal game
.pieces
['c1'], pieceC1
752 assert_equal game
.pieces
['c2'], pieceC2
753 assert_equal game
.pieces
['e1'], pieceE1
754 assert_equal game
.pieces
['e2'], pieceE2
755 assert_equal game
.pieces
['a1'].position
, game
.board
.positions
['a']
756 assert_equal game
.pieces
['a1'].captured
, false
757 assert_equal game
.pieces
['a1'].contains
, []
758 assert_equal game
.pieces
['a2'].position
, game
.board
.positions
['a']
759 assert_equal game
.pieces
['a2'].captured
, false
760 assert_equal game
.pieces
['a2'].contains
, []
761 assert_equal game
.pieces
['c1'].position
, game
.board
.positions
['c']
762 assert_equal game
.pieces
['c1'].captured
, false
763 assert_equal game
.pieces
['c1'].contains
, []
764 assert_equal game
.pieces
['c2'].position
, game
.board
.positions
['c']
765 assert_equal game
.pieces
['c2'].captured
, false
766 assert_equal game
.pieces
['c2'].contains
, []
767 assert_equal game
.pieces
['e1'].position
, game
.board
.positions
['e']
768 assert_equal game
.pieces
['e1'].captured
, false
769 assert_equal game
.pieces
['e1'].contains
, []
770 assert_equal game
.pieces
['e2'].position
, game
.board
.positions
['e']
771 assert_equal game
.pieces
['e2'].captured
, false
772 assert_equal game
.pieces
['e2'].contains
, []
773 assert_equal game
.current_player
, 'a'
775 game
.apply_moves
! ['A1 A3'].collect
{ |m
| m
.to_move(game
) }
776 assert_equal game
.history
.length
, 1
777 assert_equal game
.pieces
['a1'], pieceA1
778 assert_equal game
.pieces
['a2'], pieceA2
779 assert_equal game
.pieces
['c1'], pieceC1
780 assert_equal game
.pieces
['c2'], pieceC2
781 assert_equal game
.pieces
['e1'], pieceE1
782 assert_equal game
.pieces
['e2'], pieceE2
783 assert_equal game
.pieces
['a1'].position
, game
.board
.positions
['a3']
784 assert_equal game
.pieces
['a1'].captured
, false
785 assert_equal game
.pieces
['a1'].contains
, []
786 assert_equal game
.pieces
['a2'].position
, game
.board
.positions
['a']
787 assert_equal game
.pieces
['a2'].captured
, false
788 assert_equal game
.pieces
['a2'].contains
, []
789 assert_equal game
.pieces
['c1'].position
, game
.board
.positions
['c']
790 assert_equal game
.pieces
['c1'].captured
, false
791 assert_equal game
.pieces
['c1'].contains
, []
792 assert_equal game
.pieces
['c2'].position
, game
.board
.positions
['c']
793 assert_equal game
.pieces
['c2'].captured
, false
794 assert_equal game
.pieces
['c2'].contains
, []
795 assert_equal game
.pieces
['e1'].position
, game
.board
.positions
['e']
796 assert_equal game
.pieces
['e1'].captured
, false
797 assert_equal game
.pieces
['e1'].contains
, []
798 assert_equal game
.pieces
['e2'].position
, game
.board
.positions
['e']
799 assert_equal game
.pieces
['e2'].captured
, false
800 assert_equal game
.pieces
['e2'].contains
, []
801 assert_equal game
.current_player
, 'c'
804 assert_equal
[], game
.history
805 assert_equal game
.pieces
['a1'], pieceA1
806 assert_equal game
.pieces
['a2'], pieceA2
807 assert_equal game
.pieces
['c1'], pieceC1
808 assert_equal game
.pieces
['c2'], pieceC2
809 assert_equal game
.pieces
['e1'], pieceE1
810 assert_equal game
.pieces
['e2'], pieceE2
811 assert_equal game
.pieces
['a1'].position
, game
.board
.positions
['a']
812 assert_equal game
.pieces
['a1'].captured
, false
813 assert_equal game
.pieces
['a1'].contains
, []
814 assert_equal game
.pieces
['a2'].position
, game
.board
.positions
['a']
815 assert_equal game
.pieces
['a2'].captured
, false
816 assert_equal game
.pieces
['a2'].contains
, []
817 assert_equal game
.pieces
['c1'].position
, game
.board
.positions
['c']
818 assert_equal game
.pieces
['c1'].captured
, false
819 assert_equal game
.pieces
['c1'].contains
, []
820 assert_equal game
.pieces
['c2'].position
, game
.board
.positions
['c']
821 assert_equal game
.pieces
['c2'].captured
, false
822 assert_equal game
.pieces
['c2'].contains
, []
823 assert_equal game
.pieces
['e1'].position
, game
.board
.positions
['e']
824 assert_equal game
.pieces
['e1'].captured
, false
825 assert_equal game
.pieces
['e1'].contains
, []
826 assert_equal game
.pieces
['e2'].position
, game
.board
.positions
['e']
827 assert_equal game
.pieces
['e2'].captured
, false
828 assert_equal game
.pieces
['e2'].contains
, []
829 assert_equal game
.current_player
, 'a'
831 move_set1
= ['A1 AC5', 'A2 AC5', 'A1 AC6',
832 'C1 CC5', 'C2 CC5', 'C1 AC6'] # A1 now captured by C1
833 move_set1a
= ['C1 AC6']
834 move_set2
= ['E1 EC5', 'E2 EC5', 'E1 AC6'] # C1+A1 now caputred by E1
835 move_set2a
= ['E1 AC6']
837 game
.apply_moves
! move_set1
.collect
{|m
| m
.to_move(game
)}
838 assert_equal game
.history
.length
, 6
839 assert_equal game
.pieces
['a1'].position
, game
.board
.positions
['ac6']
840 assert_equal game
.pieces
['a1'].captured
, true
841 assert_equal game
.pieces
['a1'].contains
, []
842 assert_equal game
.pieces
['a2'].position
, game
.board
.positions
['ac5']
843 assert_equal game
.pieces
['a2'].captured
, false
844 assert_equal game
.pieces
['a2'].contains
, []
845 assert_equal game
.pieces
['c1'].position
, game
.board
.positions
['ac6']
846 assert_equal game
.pieces
['c1'].captured
, false
847 assert game
.pieces
['c1'].contains
.include?(pieceA1
)
848 assert_equal game
.pieces
['c2'].position
, game
.board
.positions
['cc5']
849 assert_equal game
.pieces
['c2'].captured
, false
850 assert_equal game
.pieces
['c2'].contains
, []
851 assert_equal game
.pieces
['e1'].position
, game
.board
.positions
['e']
852 assert_equal game
.pieces
['e1'].captured
, false
853 assert_equal game
.pieces
['e1'].contains
, []
854 assert_equal game
.pieces
['e2'].position
, game
.board
.positions
['e']
855 assert_equal game
.pieces
['e2'].captured
, false
856 assert_equal game
.pieces
['e2'].contains
, []
857 assert_equal game
.current_player
, 'e'
860 assert_equal game
.history
.length
, 5
861 assert_equal game
.pieces
['a1'].position
, game
.board
.positions
['ac6']
862 assert_equal game
.pieces
['a1'].captured
, false
863 assert_equal game
.pieces
['a1'].contains
, []
864 assert_equal game
.pieces
['a2'].position
, game
.board
.positions
['ac5']
865 assert_equal game
.pieces
['a2'].captured
, false
866 assert_equal game
.pieces
['a2'].contains
, []
867 assert_equal game
.pieces
['c1'].position
, game
.board
.positions
['cc5']
868 assert_equal game
.pieces
['c1'].captured
, false
869 assert_equal game
.pieces
['c1'].contains
, []
870 assert_equal game
.pieces
['c2'].position
, game
.board
.positions
['cc5']
871 assert_equal game
.pieces
['c2'].captured
, false
872 assert_equal game
.pieces
['c2'].contains
, []
873 assert_equal game
.pieces
['e1'].position
, game
.board
.positions
['e']
874 assert_equal game
.pieces
['e1'].captured
, false
875 assert_equal game
.pieces
['e1'].contains
, []
876 assert_equal game
.pieces
['e2'].position
, game
.board
.positions
['e']
877 assert_equal game
.pieces
['e2'].captured
, false
878 assert_equal game
.pieces
['e2'].contains
, []
879 assert_equal game
.current_player
, 'c'
881 game
.apply_moves
! move_set1a
.collect
{|m
| m
.to_move(game
)}
882 assert_equal game
.history
.length
, 6
883 assert_equal game
.pieces
['a1'].position
, game
.board
.positions
['ac6']
884 assert_equal game
.pieces
['a1'].captured
, true
885 assert_equal game
.pieces
['a1'].contains
, []
886 assert_equal game
.pieces
['a2'].position
, game
.board
.positions
['ac5']
887 assert_equal game
.pieces
['a2'].captured
, false
888 assert_equal game
.pieces
['a2'].contains
, []
889 assert_equal game
.pieces
['c1'].position
, game
.board
.positions
['ac6']
890 assert_equal game
.pieces
['c1'].captured
, false
891 assert game
.pieces
['c1'].contains
.include?(pieceA1
)
892 assert_equal game
.pieces
['c2'].position
, game
.board
.positions
['cc5']
893 assert_equal game
.pieces
['c2'].captured
, false
894 assert_equal game
.pieces
['c2'].contains
, []
895 assert_equal game
.pieces
['e1'].position
, game
.board
.positions
['e']
896 assert_equal game
.pieces
['e1'].captured
, false
897 assert_equal game
.pieces
['e1'].contains
, []
898 assert_equal game
.pieces
['e2'].position
, game
.board
.positions
['e']
899 assert_equal game
.pieces
['e2'].captured
, false
900 assert_equal game
.pieces
['e2'].contains
, []
901 assert_equal game
.current_player
, 'e'
903 game
.apply_moves
! move_set2
.collect
{|m
| m
.to_move(game
)}
904 assert_equal game
.history
.length
, 9
905 assert_equal game
.pieces
['a1'].position
, game
.board
.positions
['ac6']
906 assert_equal game
.pieces
['a1'].captured
, true
907 assert_equal game
.pieces
['a1'].contains
, []
908 assert_equal game
.pieces
['a2'].position
, game
.board
.positions
['ac5']
909 assert_equal game
.pieces
['a2'].captured
, false
910 assert_equal game
.pieces
['a2'].contains
, []
911 assert_equal game
.pieces
['c1'].position
, game
.board
.positions
['ac6']
912 assert_equal game
.pieces
['c1'].captured
, true
913 assert_equal game
.pieces
['c1'].contains
, []
914 assert_equal game
.pieces
['c2'].position
, game
.board
.positions
['cc5']
915 assert_equal game
.pieces
['c2'].captured
, false
916 assert_equal game
.pieces
['c2'].contains
, []
917 assert_equal game
.pieces
['e1'].position
, game
.board
.positions
['ac6']
918 assert_equal game
.pieces
['e1'].captured
, false
919 assert game
.pieces
['e1'].contains
.include?(pieceA1
)
920 assert game
.pieces
['e1'].contains
.include?(pieceC1
)
921 assert_equal game
.pieces
['e2'].position
, game
.board
.positions
['ec5']
922 assert_equal game
.pieces
['e2'].captured
, false
923 assert_equal game
.pieces
['e2'].contains
, []
924 assert_equal game
.current_player
, 'a'
927 assert_equal game
.history
.length
, 8
928 assert_equal game
.pieces
['a1'].position
, game
.board
.positions
['ac6']
929 assert_equal game
.pieces
['a1'].captured
, true
930 assert_equal game
.pieces
['a1'].contains
, []
931 assert_equal game
.pieces
['a2'].position
, game
.board
.positions
['ac5']
932 assert_equal game
.pieces
['a2'].captured
, false
933 assert_equal game
.pieces
['a2'].contains
, []
934 assert_equal game
.pieces
['c1'].captured
, false
935 assert game
.pieces
['c1'].contains
.include?(pieceA1
)
937 assert_equal game
.pieces
['c2'].position
, game
.board
.positions
['cc5']
938 assert_equal game
.pieces
['c2'].captured
, false
939 assert_equal game
.pieces
['c2'].contains
, []
940 assert_equal game
.pieces
['e1'].position
, game
.board
.positions
['ec5']
941 assert_equal game
.pieces
['e1'].captured
, false
942 assert_equal game
.pieces
['e1'].contains
, []
943 assert_equal game
.pieces
['e2'].position
, game
.board
.positions
['ec5']
944 assert_equal game
.pieces
['e2'].captured
, false
945 assert_equal game
.pieces
['e2'].contains
, []
946 assert_equal game
.current_player
, 'e'
948 assert_equal game
.pieces
['c1'].position
, game
.pieces
['a1'].position
949 assert_equal game
.pieces
['c1'].position
, game
.board
.positions
['ac6']
952 game
.apply_moves
! move_set2a
.collect
{|m
| m
.to_move(game
)}
953 assert_equal game
.history
.length
, 9
954 assert_equal game
.pieces
['a1'].position
, game
.board
.positions
['ac6']
955 assert_equal game
.pieces
['a1'].captured
, true
956 assert_equal game
.pieces
['a1'].contains
, []
957 assert_equal game
.pieces
['a2'].position
, game
.board
.positions
['ac5']
958 assert_equal game
.pieces
['a2'].captured
, false
959 assert_equal game
.pieces
['a2'].contains
, []
960 assert_equal game
.pieces
['c1'].position
, game
.board
.positions
['ac6']
961 assert_equal game
.pieces
['c1'].captured
, true
962 assert_equal game
.pieces
['c1'].contains
, []
963 assert_equal game
.pieces
['c2'].position
, game
.board
.positions
['cc5']
964 assert_equal game
.pieces
['c2'].captured
, false
965 assert_equal game
.pieces
['c2'].contains
, []
966 assert_equal game
.pieces
['e1'].position
, game
.board
.positions
['ac6']
967 assert_equal game
.pieces
['e1'].captured
, false
968 assert game
.pieces
['e1'].contains
.include?(pieceA1
)
969 assert game
.pieces
['e1'].contains
.include?(pieceC1
)
970 assert_equal game
.pieces
['e2'].position
, game
.board
.positions
['ec5']
971 assert_equal game
.pieces
['e2'].captured
, false
972 assert_equal game
.pieces
['e2'].contains
, []
973 assert_equal game
.current_player
, 'a'