--- /dev/null
+K 26
+svn:wc:ra_dav:activity-url
+V 19
+/svn/njae/!svn/act/
+K 25
+svn:wc:ra_dav:version-url
+V 38
+/svn/njae/!svn/ver/68/TrapTheCap/trunk
+END
+Rakefile
+K 25
+svn:wc:ra_dav:version-url
+V 47
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/Rakefile
+END
+ga-trace.log
+K 25
+svn:wc:ra_dav:version-url
+V 51
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/ga-trace.log
+END
+main.rb
+K 25
+svn:wc:ra_dav:version-url
+V 46
+/svn/njae/!svn/ver/26/TrapTheCap/trunk/main.rb
+END
+run-ga.rb
+K 25
+svn:wc:ra_dav:version-url
+V 48
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/run-ga.rb
+END
+systemu.rb
+K 25
+svn:wc:ra_dav:version-url
+V 49
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/systemu.rb
+END
+player.log
+K 25
+svn:wc:ra_dav:version-url
+V 49
+/svn/njae/!svn/ver/28/TrapTheCap/trunk/player.log
+END
+README
+K 25
+svn:wc:ra_dav:version-url
+V 45
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/README
+END
+play-one-game.rb
+K 25
+svn:wc:ra_dav:version-url
+V 55
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/play-one-game.rb
+END
--- /dev/null
+K 10
+svn:ignore
+V 8
+ga-logs
+
+END
--- /dev/null
+8
+
+dir
+68
+http://scripts.njae.me.uk/svn/njae/TrapTheCap/trunk
+http://scripts.njae.me.uk/svn/njae
+
+
+
+2009-02-19T08:59:38.293071Z
+68
+neil
+has-props
+
+svn:special svn:externals svn:needs-lock
+
+
+
+
+
+
+
+
+
+
+
+0ada9808-85ab-4924-adda-5bf89eae3818
+\f
+test
+dir
+\f
+Rakefile
+file
+
+
+
+
+2008-03-25T11:38:01.000000Z
+fd234d29a73c0790b21fab1359ff0c85
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+ga-trace.log
+file
+
+
+
+
+2008-04-26T06:22:16.000000Z
+f0911009c5915f48433f0b9bd91ea7e1
+2008-10-16T14:11:23.436422Z
+41
+\f
+doc
+dir
+\f
+lib
+dir
+\f
+nbproject
+dir
+\f
+main.rb
+file
+
+
+
+
+2008-04-18T15:35:11.000000Z
+c4856a322f630f35c8e05527e0fbce97
+2008-04-20T14:21:13.331435Z
+26
+neil
+has-props
+\f
+src
+dir
+\f
+run-ga.rb
+file
+
+
+
+
+2008-04-30T20:59:41.000000Z
+4d5288d51bb2f9ec0d588b5b3d39aa07
+2008-10-16T14:11:23.436422Z
+41
+neil
+\f
+systemu.rb
+file
+
+
+
+
+2008-04-28T10:29:38.000000Z
+34516ad09cfc22c8048e8eeff31541ff
+2008-10-16T14:11:23.436422Z
+41
+\f
+player.log
+file
+
+
+
+delete
+2008-04-25T21:34:04.000000Z
+e573a8367dc2985387b98ca742f05158
+2008-04-25T21:36:06.714616Z
+28
+neil
+\f
+README
+file
+
+
+
+
+2008-03-25T11:38:01.000000Z
+e92ee2fd4bcfbe8bdf15c30ef7ee5859
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+play-one-game.rb
+file
+
+
+
+
+2008-04-26T06:49:12.000000Z
+62194a9eaa52e5108d15084e78165a0c
+2008-10-16T14:11:23.436422Z
+41
+neil
+\f
--- /dev/null
+K 14
+svn:executable
+V 1
+*
+END
--- /dev/null
+== TrapTheCap
+
+You should document your project here.
--- /dev/null
+#
+# To change this template, choose Tools | Templates
+# and open the template in the editor.
+
+
+require 'rake'
+require 'rake/testtask'
+require 'rake/rdoctask'
--- /dev/null
+Generation number 1
+00000001011100001100
+00000010011110101110
+00000101101001100110
+00001000100001100001
+00001000110111011111
+00001010011010001111
+00001011011101101101
+00001100000011111101
+00001100101101000001
+00001101001111111000
+00001110000011000001
+00001111000011101111
+00010000100111111110
+00010001000100000000
+00010001100010011010
+00010011100101011110
+00010101011000110110
+00010101110001000010
+00010110001011101101
+00010110111001110000
+00010111100001010011
+00010111110010001010
+00011001111111011010
+00011100100110000111
+00011110110011100101
+00100000101100001100
+00100000111110101100
+00100010011111000101
+00100100000100110000
+00100110101110010011
+00100111101000010010
+00101000101001111110
+00101010110101011000
+00101100101001000011
+00101100110011011000
+00101110000010100100
+00101110001010111000
+00101111001000011110
+00101111010000111100
+00101111101000001111
+00110010111100011000
+00110011100001110001
+00110011101001100100
+00110011111011100110
+00110100001010100010
+00110101110001010000
+00111000010100111011
+00111001110100010100
+00111010001011011011
+00111100101010110110
+00111100101111011001
+00111101110011000101
+00111111110100110100
+01000001000001010100
+01000001001111111101
+01000001110101011010
+01000010010111101001
+01000010111000001110
+01000101001001100101
+01000101100111111011
+01000110101001001110
+01000110110011011011
+01000111001100101111
+01000111010001001110
+01001101001011100101
+01001101001110000111
+01001110101001010111
+01001111111110000101
+01010000001011011111
+01010010100001101111
+01010100101110011110
+01010101000010110001
+01010101010110010010
+01010101101111010101
+01010110001101010000
+01010111001111100000
+01010111011101100011
+01011001110110110100
+01011100001010110001
+01011100110100000101
+01011101010010010010
+01011110111001010010
+01011111011000000001
+01100000001110100011
+01100000110001111110
+01100001101000100111
+01100010010011101111
+01100010010111000111
+01100010110110101011
+01100100110000100010
+01100101000000101100
+01100101110000000001
+01101010010001001100
+01101010101110101001
+01101011011011001100
+01101100010110000011
+01101101010001111111
+01101101011111110011
+01101111110010110001
+01110001110010101111
+01110001111110111110
+01110010111110000010
+01110100111011110000
+01110101010000010000
+01110111010001011010
+01111000110010000111
+01111001000001000100
+01111001000100010001
+01111001010011010010
+01111011101111110101
+01111111001111110110
+10000010111110000100
+10000101100010100100
+10000110111110100010
+10000111010010110011
+10001010101111001110
+10001100101011000010
+10001101001010001110
+10001111010010001011
+10010001011101011011
+10010010100000100110
+10010010110000010101
+10010100110100101111
+10010110101111110111
+10010110110001001011
+10010111111100011110
+10011000000100011111
+10011010011100010111
+10011100011111000100
+10011110101010100011
+10011110111011100001
+10011111010001000100
+10100000000100001111
+10100000001100101000
+10100010110111001010
+10100011001111111111
+10100100010100110101
+10100110100011010000
+10101001110111000100
+10101010010010100110
+10101100000001111101
+10101101111101101000
+10101110110001011000
+10110000111100111000
+10110010100110110010
+10110011011111011101
+10110011011111100000
+10110101001100010111
+10110101110001111100
+10110111011001010100
+10111000100001111100
+10111100010010111011
+10111100111000100010
+10111101000001100111
+10111101110000101010
+10111101111000111011
+10111111000110001011
+11000001001000101111
+11000010011100111101
+11000010110010110101
+11000011001111011011
+11000100111111011110
+11000101011011110010
+11001000011010000110
+11001000100110011110
+11001001011110011101
+11001010100011011100
+11001011011111110101
+11001011101010110010
+11001111110110010011
+11010000001110101110
+11010000010111110000
+11010000111010101010
+11010001000000101110
+11010001100000010110
+11010001110111100001
+11010010101000000100
+11010011010000100101
+11010011100100111111
+11010101010001100110
+11010110011000001110
+11011001011100110101
+11011010000010010010
+11011101111110110010
+11100011101001110001
+11100100000110011001
+11100101011001010000
+11100111000101011010
+11101011010000101101
+11101101111010111100
+11110000000011001100
+11110100001010011010
+11110101111000001001
+11110110001010000101
+11110110011100111011
+11110110110100101111
+11110111001001111111
+11111010001101011101
+11111011101011111011
+11111111011111000000
+Started at Fri Apr 25 22:39:39 +0100 2008
+Took 1598.862926 seconds
+Generation number 2
+00000100101001100110
+00000101100010101100
+00000101101001101100
+00000101111001010100
+00001000101001110110
+00001010001010001111
+00001010011001000011
+00001010011110001111
+00001011011101101101
+00001100000011110110
+00001100010110000010
+00001100101000001111
+00001100101101111000
+00001111001111111111
+00010000110010000101
+00010001000000000000
+00010001001100010000
+00010001010100000100
+00010001100101011110
+00010001110110011010
+00010010100000100111
+00010010110111111001
+00010011100001110001
+00010100100010001010
+00010100111001001100
+00010101010110101111
+00010110111000001010
+00100000111110101100
+00100001110100010100
+00100010111110000000
+00100010111110000100
+00100100000100110000
+00100100000100110000
+00100100000100110101
+00100100110100100010
+00100110111110100010
+00101010110101111000
+00101100110001110100
+00101100110011011000
+00101100110011011001
+00101101110011010101
+00101110000101010000
+00101110001000111010
+00101110001010011001
+00101110001010110110
+00101110010001001100
+00101110101010010010
+00101111001000011110
+00101111001010111110
+00110011101111010101
+00110100001010011011
+00110100100011101100
+00110110001101011101
+00110111101110110010
+00110111110011110001
+00110111110100110100
+00111000010100111011
+00111000010110000011
+00111000100001111100
+00111000101100001100
+00111001110100000010
+00111010001011011011
+00111100001011100111
+00111100101011000011
+00111101100100011110
+00111101101010100001
+00111110110011010011
+00111110111111100001
+00111111110100110100
+01000001011000110110
+01000010101011011101
+01000010111000010101
+01000010111000011110
+01000101110110010010
+01000110001001001010
+01000111010001100001
+01000111100001000011
+01001000100001101010
+01001000110100000100
+01001100001110000111
+01001100101111011000
+01010000000001101111
+01010001000010011010
+01010010110101011100
+01010100001111011111
+01010101110001100101
+01010101111000001001
+01010111011010110001
+01010111011101100011
+01010111011111000000
+01010111100101011111
+01010111110001000100
+01010111111100000001
+01011011011000000110
+01011100100011110010
+01011100110100010101
+01011110111001010010
+01011111001111100100
+01011111011001000011
+01100000010001111110
+01100000110000100010
+01100000110110101011
+01100001000000110110
+01100001101100101111
+01100010001110100011
+01100010011011000010
+01100100000101100000
+01101000000100101011
+01101010101110101001
+01101011101111110101
+01101101010011111111
+01110000100111111010
+01110001110010101111
+01110001111111011110
+01110100111110000110
+01110111010001011010
+01111000100111111110
+01111010011011000111
+01111100101010111110
+01111111001111111101
+01111111010110001010
+10000010110111001010
+10000101100010100110
+10000110101011001100
+10001010101111000010
+10001010111010100001
+10001011101010110010
+10001100001000110001
+10001101010010001011
+10001110000011000001
+10001111010100100101
+10001111010100111100
+10010001001000010110
+10010001100010100100
+10010010110001110101
+10010010110100010001
+10010110110001001011
+10010110111110010011
+10011101110011000001
+10011110111010100011
+10011110111011001110
+10011110111011100000
+10011110111011100000
+10011110111011100001
+10011111010001110100
+10100000001100101000
+10100000001100101010
+10100100010100110111
+10100110011000000110
+10100110100011010000
+10101001110101000000
+10101001110111000101
+10101110001010111000
+10101111010000111100
+10110000111100111000
+10110001011111111000
+10110010111100011000
+10110011011111110001
+10110011111011000110
+10110110101110010011
+10111000011000001110
+10111001110110011100
+10111011010111010011
+10111111110100101010
+11000001011111110000
+11000001101000101111
+11000010010111111001
+11000100111111011111
+11000101011010110010
+11000101111011111011
+11000111010010110011
+11001001011110010111
+11001001011110011101
+11001111110110010010
+11001111110110010011
+11010001100000010110
+11010001100000010110
+11010010110001011100
+11010011100100111011
+11010111110011110101
+11011010000001000011
+11011101111110110010
+11100011001001100001
+11100100000110011001
+11100111000101011000
+11100111000101011010
+11100111101000110010
+11101010010010100110
+11101011010001101101
+11110000000011000000
+11110000000111001100
+11110001110001010000
+11110101111010101001
+11110110001000000001
+11110110001101010001
+11110110011100111011
+11110111001001111111
+11111000001110011111
+11111000010100111011
+11111000101001011110
+Started at Fri Apr 25 23:06:18 +0100 2008
+Took 1684.749211 seconds
+Generation number 3
+00000001101000101111
+00000010011100001010
+00000011010001100001
+00000100101000001111
+00000100110100000000
+00000100111111011111
+00000101001001100001
+00000101111001000110
+00000101111001110001
+00001000101010100010
+00001010011001000011
+00001011111011111011
+00001100000110100111
+00001100001000110011
+00001100001010010110
+00001100100000010110
+00001100101000111011
+00001110001010011001
+00010000001011100110
+00010001010110011010
+00010010010111111001
+00010011011111110001
+00010011100001110001
+00010011100001110001
+00010011100001110001
+00010011110001010100
+00010100010100011100
+00010100011101010001
+00010100100010001010
+00010100100110010111
+00010101010110000110
+00010101010110101100
+00010101010110101111
+00010111011001000011
+00011001110001010000
+00011100101000101111
+00011101011100101011
+00011110110001000011
+00100000001101010000
+00100000111110101000
+00100010111000010101
+00100010111110110010
+00100100110100100011
+00100100110100100111
+00100100110100101000
+00100100110101110110
+00101000010001110110
+00101010001010011001
+00101010011110001100
+00101010110101110010
+00101100110011010001
+00101101110011010101
+00101101110011010101
+00101110000110010111
+00101110000111010000
+00101110001000101010
+00101110001010111100
+00101110001101011000
+00110011101111010101
+00110011110001011100
+00110011110100110101
+00110100001010011010
+00110100001011011010
+00110100111110000110
+00110110000100000100
+00110110001101011101
+00110111101110110010
+00111000010100111011
+00111000100001011100
+00111000100001111100
+00111000100100010001
+00111000111111011111
+00111001100110100000
+00111001110100000010
+00111001110100100010
+00111010010111010001
+00111100101011011111
+00111101001010101001
+00111110001010110110
+00111110010000111100
+00111110101011011101
+00111110111101100001
+00111111010100101100
+00111111110100110100
+00111111110100110100
+01000000000001101111
+01000001101010101001
+01000010110011110110
+01000010111000000101
+01000100001111010001
+01000100010100110000
+01000101100010101100
+01000110011001001010
+01001000100000101011
+01001000101001011010
+01001000101110011111
+01001000110100000100
+01001010001010011110
+01001010111000011111
+01001100111101011101
+01010000000001101111
+01010010110100010010
+01010011011101101011
+01010101111000001001
+01011000110100000100
+01011011011000000110
+01011100111001001100
+01011101010000001011
+01011110001111100100
+01011111011011100000
+01011111011101100111
+01011111110001100111
+01100000100011101010
+01100001101100101111
+01100010111110000000
+01100011000000110110
+01100100001111100110
+01100101011010111111
+01101011111000011000
+01101100000101110001
+01110000100111111010
+01110000110001010000
+01110000110111101000
+01110110010001011010
+01110110111110110101
+01111010101011011101
+01111111001111011100
+01111111001111111101
+01111111010110001010
+10000010011001011000
+10000010110111001010
+10001001011110011101
+10001100001000100001
+10001101010100111100
+10001101100000010010
+10001110111111101110
+10001111010110100100
+10001111101001101100
+10010000010110000011
+10010000111000111000
+10010000111100110100
+10010001110010101111
+10010010110001111100
+10010010110100010011
+10010101010110101111
+10011111010001101000
+10100000001100101010
+10100100010100110111
+10100110001010011001
+10100110100011010000
+10101001110101000000
+10101111010101110001
+10110000010100111011
+10110001001000010110
+10110010111100011000
+10110110001100001000
+10110110101110000011
+10110110101110110010
+10111001110110011100
+10111011110001011010
+10111011110111011111
+10111101110100101010
+10111110110011010010
+10111110111111100001
+10111111110100101111
+11000001011111110000
+11000001100101011110
+11000100010100111011
+11000100011110001111
+11000100100011100011
+11000101111011001111
+11000111010010110010
+11001001011010001010
+11001011011000000110
+11001101011111010000
+11001110111001010010
+11001111010110000010
+11010011010100100100
+11010101110011110101
+11010111110011110101
+11011001110101111000
+11011101111110000100
+11011110110011010011
+11100100010100110111
+11100101010000110110
+11100101110100011100
+11100111000000111010
+11100111000110100001
+11101111001010111110
+11110000010001101010
+11110011011111110001
+11110100101111011000
+11110110000111101111
+11110110001000001100
+11110110010110101111
+11110111001001110111
+11110111001101111111
+11111000100111111110
+11111111010001100001
+11111111110100110101
+Started at Fri Apr 25 23:34:23 +0100 2008
+Took 1771.991079 seconds
+Generation number 4
+00000000110100000000
+00000001101000101100
+00000001111001000111
+00000010011100101111
+00000011010001100001
+00000100011111010010
+00000100100001001111
+00000101010110101111
+00000101100010101100
+00000101111001110001
+00000101111010000110
+00000101111101000011
+00001000001000110010
+00001010011001000000
+00001010101000111011
+00001100000110100111
+00001100000110111110
+00001100001011011010
+00001100101010111101
+00001110010111111001
+00010000001011100110
+00010000010110000011
+00010010110001000011
+00010011100001110001
+00010100011100000001
+00010100011101010010
+00010101010000010010
+00010101010110101100
+00010101011001001000
+00010101111111011111
+00010110000110101001
+00010111010110000110
+00010111011001000011
+00011000110100000100
+00011001100010100000
+00011100100001010111
+00011100101010100110
+00011101011100101011
+00011101011100101011
+00011110110001000011
+00100010010100111011
+00100010111000000101
+00100010111011110010
+00100010111110110000
+00100011101101010101
+00100100001011111010
+00100100110100101000
+00100100110101110110
+00100100110111110110
+00100100111111011111
+00100101110101010101
+00100110110100100011
+00100111001000001101
+00101000110100000100
+00101001110000010110
+00101010011011001100
+00101010011110001000
+00101100110011011110
+00101100111110000110
+00101101110011010001
+00101101110011110110
+00110001010010101111
+00110001110100000010
+00110010001010011001
+00110010011000011101
+00110011101111010101
+00110100001010010110
+00110100111101100110
+00110110000100111011
+00110110001100001000
+00110110001101011101
+00110110001101011101
+00110110011101100011
+00110111101100010000
+00110111111000001001
+00111000100100100000
+00111000110100010101
+00111001100100000010
+00111001100100110100
+00111001100110010001
+00111001100111110001
+00111001110100000010
+00111001111100101000
+00111001111111101110
+00111010010111010001
+00111010010111010101
+00111100100001010100
+00111100100100010001
+00111100101011011111
+00111100101110011000
+00111101001000000100
+00111101101010101001
+00111101110011010101
+00111110001000101010
+00111110010010111101
+00111110011111110001
+01000001111010101101
+01000011010010110010
+01000100010100111011
+01000100100010101100
+01000100101111010001
+01000101100010101100
+01000110010110101110
+01000110011100001010
+01001000010001110110
+01001000101010011111
+01001010001010010101
+01001110101000010110
+01001111001111000010
+01010010110100011000
+01010011001100000100
+01010011011101010001
+01010101010110000110
+01010101111011001111
+01011100111000101100
+01100000000001101111
+01100011000000110100
+01100100000101110001
+01100100001111100110
+01100101001111100110
+01101011111010110010
+01101100000101101011
+01110000100111111010
+01110000100111111010
+01110000110001010000
+01110000110011010100
+01110000110110001000
+01110110000111101111
+01110111010011100001
+01111000100111111011
+01111001110100000010
+01111010101011000101
+01111100001010111100
+01111101001010101001
+01111111110100101111
+10000010011100011010
+10001101100100010000
+10001111011011001111
+10010000010110000011
+10010000111100100000
+10010111010010111111
+10010111100001011100
+10011001011110010001
+10011110110101000000
+10101001000011101000
+10101101101110101111
+10101110011111011000
+10101111010100100001
+10110000010100000100
+10110000010100111011
+10110001001000010110
+10110001001000010110
+10110010111100011000
+10110100111110000110
+10110110000111100000
+10110110010111001010
+10110110101110000011
+10110110101110110010
+10110110101110110010
+10111011110011011010
+10111100101011011111
+10111101001011101011
+11000000000001101010
+11000001100101011110
+11000010101100001100
+11000011010001000001
+11000100001000111000
+11000100010100111011
+11000100011111001111
+11000100111110101000
+11000101111001101100
+11001000101010011111
+11001001110101011000
+11001100011111000000
+11001100100100110110
+11001101011010001011
+11001101011111010100
+11001110111011010001
+11001111010110000010
+11001111010110000010
+11001111100001001111
+11010000110110110000
+11010010110100010000
+11010100101110001100
+11011001110101110010
+11011001111110000100
+11011011011000000110
+11011101101110001100
+11100100001111000110
+11101101110011110101
+11101111001010111110
+11110010001111110000
+11110011010000111100
+11110100101111011000
+11110110010100101110
+11110110101110110010
+11110111000101111111
+11110111101101111111
+11111000100110111110
+11111000100111010110
+Started at Sat Apr 26 00:03:55 +0100 2008
+Took 1879.650283 seconds
+Generation number 5
+00000000100111111111
+00000000110100000110
+00000000110100010010
+00000001111000110001
+00000001111110101110
+00000010011100100010
+00000100001011100110
+00000100100100100011
+00000101001010101100
+00000101010100101100
+00000101111010000110
+00001000101010010111
+00001100001011000011
+00001100011011001000
+00001100101010000100
+00001101110011110110
+00001110001010001101
+00010011100101110001
+00010100011011111010
+00010100011100000010
+00010100011101010111
+00010100011101011000
+00010101000110111110
+00010101011001000000
+00010101011001001011
+00010101100001111001
+00010101110111011111
+00010110000110101001
+00010111010110000100
+00010111010110000110
+00010111011001010011
+00011000100100100000
+00011000110100010101
+00011001110010100000
+00011101010100110110
+00011101011100100000
+00011101101010100111
+00011110110001000010
+00011110111111000000
+00100000111110110000
+00100010001010010101
+00100010110100110110
+00100010111011110111
+00100010111111011111
+00100011101111100101
+00100100001101011101
+00100100100100101110
+00100100110101011110
+00100100111110110000
+00100101011010000110
+00100110110100100011
+00100111001001011011
+00101000111010000110
+00101001110000000101
+00101010011110001001
+00101010011110100000
+00101011011101010001
+00101100011111110001
+00101100101010101101
+00101101110011010110
+00110000001100010001
+00110000011111010010
+00110001111100101000
+00110001111110101101
+00110010001010000011
+00110010001010011111
+00110010001100111001
+00110010011010010001
+00110011101111100000
+00110101100100010000
+00110110001110101011
+00110110111000000101
+00110111011010000110
+00110111100001011000
+00110111101100010000
+00110111101100010000
+00111000110000010000
+00111001011100101000
+00111001100100000101
+00111001100110110100
+00111001100111111100
+00111001110100000011
+00111010000011111111
+00111010010111000011
+00111010010111010110
+00111010011100101111
+00111011100101010010
+00111100001010111100
+00111101001000000110
+00111101001010101111
+00111101111110010000
+00111110010010101111
+00111110011111110110
+00111110100001001010
+00111111010011101001
+01000000010100111011
+01000000100001101010
+01000001101101011110
+01000001110101010000
+01000100010101111011
+01000100011101000011
+01000100101010010010
+01000100101111010001
+01000101001111100110
+01000101111101010110
+01000110010110111100
+01000110011100001010
+01000110011100001010
+01000111010110101111
+01001000010001110110
+01001000010001111000
+01001000101010011010
+01001010010001111110
+01001010111000010101
+01001110111110000101
+01001111001111001010
+01001111010000000111
+01001111110100101111
+01010011001100010100
+01010011001100100110
+01010011011101010001
+01010011011110111101
+01010100100011011111
+01010101010110101011
+01010101111011001111
+01010111010101111001
+01011010101000111011
+01011100000101101011
+01100000100111111110
+01100011110000000010
+01100100100010101100
+01100110000111101011
+01101000100111111011
+01101111110100111101
+01110000100101101000
+01110000100111111010
+01110111000111101110
+01111000110100000010
+01111100001010101100
+01111101001000101001
+01111101011010100001
+01111111110100101110
+10000001110011110101
+10000010011001000000
+10000101010100000100
+10000101111001000011
+10001010011100010010
+10001101100100011010
+10001101100101011101
+10001110000101001101
+10001111010110000110
+10010000010101111101
+10010001010010101111
+10010100111100111011
+10101100011111010010
+10101101101110100111
+10101101101110101111
+10101101111100001000
+10110001001100011111
+10110010111100011000
+10110100010100001100
+10110100111110000110
+10110110000111010101
+10110110010111010100
+10110110101110100010
+10110110101111011010
+10111001001000010110
+10111100101111011100
+11000000100101011110
+11000010101001100100
+11000011010001100001
+11000100001000110110
+11000100110010000000
+11000101010110100111
+11000101100010001100
+11001000101000011000
+11001000101010011001
+11001001110101011000
+11001100010001000001
+11001101011111010101
+11001101110101110010
+11001110101110101011
+11001111101001001111
+11010000010110110000
+11010110100100111011
+11011001101000010110
+11011001110101110010
+11011011011110000010
+11100100001111000100
+11100100001111000110
+11101101111001000111
+11101110101100110110
+11101110110010001100
+11101111001010100110
+11110000110001010001
+11110010001111100000
+11110100101111011000
+11110110010100100110
+11111000100111010001
+11111101001011101011
+Started at Sat Apr 26 00:35:15 +0100 2008
+Took 1834.799951 seconds
+Generation number 6
+00000000100111111100
+00000000110100000110
+00000000110101111011
+00000001110100100111
+00000010011100100010
+00000010011100100011
+00000100001011100001
+00000100010101111011
+00000101010100001100
+00000101111010000110
+00000101111010001110
+00000110011100001000
+00001000101010100000
+00001011011001010011
+00001100001011000011
+00001100001011001010
+00001100101001100101
+00001100101010000101
+00001110001110001100
+00010000011101010111
+00010011001100010100
+00010100001101111001
+00010100011011111011
+00010101000110000110
+00010101000110111001
+00010101010100100100
+00010110000011101011
+00010110001110101001
+00010110010001010011
+00010111010110111110
+00010111110111111111
+00011000001100010111
+00011000110100010110
+00011001100111111100
+00011001110110100100
+00011010100100011001
+00011100001111000100
+00011100101010111100
+00011101101010100100
+00011110111111000000
+00100010111000000010
+00100010111010111100
+00100011101111100101
+00100100000100110110
+00100100001101001101
+00100100110101011110
+00100101011010000110
+00100101101010000100
+00100110000100110110
+00101000110001110110
+00101000111110110000
+00101001010000000110
+00101010011110000101
+00101010011110001001
+00101011011101010001
+00101100011011000011
+00101100011111110110
+00101100101011011001
+00110001010110111100
+00110001111100101000
+00110001111100101000
+00110001111110100110
+00110010011010010101
+00110011001100001100
+00110100100101100000
+00110101000110101011
+00110101100100010010
+00110101101100010011
+00110110010101101011
+00110111001100010000
+00110111011010010110
+00110111011011000001
+00110111101110110000
+00110111111110010010
+00111001011100101000
+00111001100100000010
+00111001100111111100
+00111001101010010110
+00111010010111010110
+00111100001010111100
+00111100010101111011
+00111100011101011000
+00111101001011110111
+00111101011010000100
+00111110000001001000
+00111110000010101011
+00111110001110110111
+00111110010010101110
+00111110011111110100
+00111111100011001010
+00111111101100010001
+00111111101111111000
+01000000100001101010
+01000001101101011100
+01000001110101010000
+01000001110101011000
+01000001110101111010
+01000010000011111111
+01000100011100000011
+01000100011100001010
+01000100100101011110
+01000100100111111110
+01000100111101001000
+01000101001111100110
+01000101100100010000
+01000110010000011010
+01000110111100101000
+01000111010110101111
+01000111011110001111
+01001000001010011010
+01001000010001000000
+01001000010001111000
+01001010010001000011
+01001010111000010100
+01001100001001111110
+01001101011100100000
+01001101011111010101
+01001101011111110101
+01001110000101001101
+01001110111010000101
+01001110111110000101
+01001111110100110101
+01010000101010101101
+01010011001100010101
+01010011101111101011
+01010101010010101001
+01010101110011011111
+01010101111011001011
+01010101111011011110
+01010110001010011111
+01010111010101111001
+01011010101000111011
+01011111011011001001
+01100001110000100010
+01100010111101011101
+01100011001101101111
+01100101011100100000
+01101000010001111001
+01101111001010100111
+01110000100111111000
+01110010100101101000
+01110010101110111011
+01111000110111110111
+01111100000010101110
+01111100001010101110
+01111100101111011011
+01111101011010110001
+10000100010101111011
+10000100111100000100
+10000101000100101100
+10000101010110000111
+10001010011100010010
+10001010011100101000
+10001011001111001010
+10001111100010000100
+10010000010101111101
+10010001010010101101
+10010100010101111111
+10010110111100000110
+10010111011110000001
+10100110011110010010
+10101100011111010010
+10101101101110010010
+10101111011110111101
+10110000010001111111
+10110010111100011000
+10110100101110101101
+10110100111100111011
+10110110000101010101
+10110110101111011000
+11000000101010011110
+11000001110101011110
+11000010011001000000
+11000010101001100100
+11000100001000110001
+11000101001010001101
+11001000101010011001
+11001001111101011000
+11001100110100000010
+11001101011111010001
+11001101100101011101
+11001110110010111011
+11001111101001001101
+11001111101110101011
+11010000001000110110
+11010011001100000000
+11010101100010001100
+11100100001111000100
+11100100001111010110
+11101010110010000100
+11101111000010100110
+11110000011010000110
+11110100010011101001
+11110100111111011010
+11110111000111000001
+11111000100111010000
+11111000100111010001
+11111000100111010001
+11111001101000011100
+11111010000111000011
+Started at Sat Apr 26 01:05:49 +0100 2008
+Took 1806.325558 seconds
+Generation number 7
+00000000100111100000
+00000001110100100111
+00000010011101100011
+00000100000101111010
+00000100100011111110
+00000100110100111100
+00000100110101111001
+00000101010110000111
+00000110001100001000
+00000110010101101000
+00000110011101001000
+00000110110011011111
+00001000011110001000
+00001000100100110110
+00001010011110000101
+00001011011101010011
+00001100001011000011
+00001100011010011010
+00001100100010001100
+00001100100101111110
+00001100101001100101
+00001100101010001000
+00001101101001100101
+00001110001100100100
+00010000011101010110
+00010001100100001010
+00010010001101000000
+00010010101010101101
+00010100011011111011
+00010101010110001100
+00010101011100100100
+00010110010011101011
+00010111010101101000
+00011000010100010110
+00011001110110100100
+00011010100100011001
+00011010101010100111
+00011100101010110100
+00011101101010000100
+00011101101010011000
+00011110111111000000
+00100001011010000110
+00100100001101001101
+00100100101010000101
+00100100101010111011
+00100101111010011010
+00100110000100110111
+00100110001010110000
+00100110111011010110
+00101000111010110000
+00101010011110101101
+00101011011001010011
+00101100011010000010
+00101110111100011000
+00110000001000010110
+00110000010001111001
+00110001010110111010
+00110001101110101011
+00110001111110111001
+00110010011010010101
+00110011001100010101
+00110011001111110001
+00110101000111101011
+00110101010110000111
+00110101100000010010
+00110110010101101011
+00110111001001111011
+00110111011010000110
+00110111101110110000
+00111000001010111100
+00111000010100101100
+00111000010101111011
+00111001000010100110
+00111001010001111001
+00111001101010000100
+00111001101010010110
+00111001101010010110
+00111100010100001100
+00111100010101111011
+00111100011001100100
+00111100011101011000
+00111100011101111001
+00111101101111000100
+00111101101111111000
+00111110000010101011
+00111110011111111100
+00111111100011001010
+00111111101000011101
+00111111101111111001
+01000000100001101010
+01000001101101011100
+01000001110111011000
+01000100100101011101
+01000100100101011110
+01000100101010000101
+01000100110111111110
+01000100111101001000
+01000101111010000110
+01000101111010111100
+01000110011000010011
+01000110101111011011
+01000110111000010100
+01000111011110001111
+01001000001010101010
+01001000111101001010
+01001010111000010100
+01001100101010000101
+01001101010111110101
+01001101011111110111
+01001110000101001101
+01001110011110000100
+01001110111010000101
+01001110111100000001
+01001111001010100111
+01001111110100110101
+01010000010001111111
+01010000101000100101
+01010001010110101101
+01010001110101111010
+01010100000110000110
+01010100100101100000
+01010101010000101110
+01010101010010100010
+01010101010010111010
+01010101110101011000
+01010110011110001101
+01011010000100110110
+01100001110000100011
+01100010111000010000
+01100011101100010101
+01100100000111111110
+01100101001111100011
+01100111001000011111
+01101000010001110000
+01101101000110101011
+01101111000100011001
+01101111001010100111
+01101111001010100111
+01110001100111111100
+01110010101100001000
+01110010101110000001
+01110011001101111111
+01110011101111111011
+01110100110011011111
+01110110111010011101
+01111000000010111011
+01111000010001111001
+01111000010101101000
+01111000110111010010
+01111100001010001110
+01111100100111111110
+01111110001110101011
+01111110101111011011
+10000001010110111100
+10000101000101110011
+10000111100011010000
+10001010011100010001
+10001010011100100100
+10001110111110000101
+10001111010110001111
+10001111100010000100
+10010001010010101101
+10010101111011011110
+10010110010000010001
+10010110111100011101
+10010111011110000000
+10011001110100100111
+10101101101110110110
+10110001010110111100
+10110010001101010101
+10110010010100110000
+10110011001111111000
+10110100101110001001
+10110100101110101101
+10110110000000011100
+10110110111100101100
+10111000101001101101
+10111100001010001100
+11000100010101101011
+11000101001000110101
+11000101010000001100
+11000101010110000111
+11001000101110010110
+11001001111101111000
+11001011011100101000
+11001100100001011110
+11001111101010101110
+11010000001100010110
+11010111011000010110
+11011000010001111000
+11100100000000000010
+11100100001001010110
+11100101011100100000
+11101000100111010000
+11101001101110110000
+11101010110010010110
+11101100001011000010
+11101111100111111100
+11110110111111001010
+11111001101101010101
+Started at Sat Apr 26 01:35:56 +0100 2008
+Took 1893.750235 seconds
+Generation number 8
+00000010001101100011
+00000100000110000110
+00000100010110011101
+00000100100011111110
+00000100100101101110
+00000100110000111111
+00000101010110011110
+00000110000010101010
+00000110001100001110
+00000110011001001010
+00000110110011011111
+00001010011010101101
+00001011011101010011
+00001100011101101001
+00001100100001100101
+00001100100101011101
+00001100101000100101
+00001101010110000011
+00001101011111110111
+00001101101001100101
+00001110001000010101
+00001110111010000101
+00001110111010011101
+00001111001010110111
+00010000011101011000
+00010000110101111000
+00010010101010101101
+00010010101011100101
+00010100011101000010
+00010100100001101010
+00010100100110100110
+00010101011100101100
+00010101011100111000
+00010101111011010010
+00010101111011011110
+00010110011100001000
+00010111001000010111
+00010111010000010110
+00011010011100011011
+00011010101100001000
+00011100011111011011
+00011110111101111001
+00011110111111000000
+00011110111111000111
+00011111101111111001
+00100010011111111100
+00100100101001100101
+00100101011101100000
+00100101111010010000
+00100110000100110111
+00100111010101101000
+00101000010001111001
+00101010011110100000
+00101011011001010011
+00101100011010000010
+00101100011010110110
+00101101000110101011
+00101101101000000100
+00110000010010111001
+00110000110001111110
+00110001001111110001
+00110001110010001110
+00110010001001010101
+00110011001100000100
+00110101000111101011
+00110101010110000000
+00110101011010100111
+00110101100000010111
+00110101100001010010
+00110101101000010010
+00110110110011011110
+00110111001001110010
+00110111001001111011
+00110111011010011001
+00111000000010111101
+00111000000110100000
+00111000010100101100
+00111000010101101011
+00111000110111010010
+00111000111000111100
+00111001000010111011
+00111100011101011011
+00111100011111000000
+00111100100101100010
+00111101101111111000
+00111110000011101011
+00111110001101000000
+00111110010010011010
+00111110011010010101
+00111110011111111100
+00111111101010000111
+01000000011011101011
+01000000011101100011
+01000000100001101010
+01000001110000100010
+01000010011101100011
+01000100010101111011
+01000100101010000101
+01000100111010100111
+01000101110110111110
+01000101111010000110
+01000110010101101000
+01001000101011111011
+01001000101101101010
+01001000111101001100
+01001001011111110010
+01001010011000010100
+01001010011110000100
+01001011011100101000
+01001100100101011110
+01001100101010001000
+01001101010100111010
+01001101111010000110
+01001110000101001101
+01001110001010000101
+01001110011010000100
+01001110011110000000
+01001111001111111010
+01001111110100110100
+01010001001110101010
+01010100100101100000
+01010101110001110000
+01010110100101011101
+01010110100101100000
+01011000001100110110
+01011100100111111110
+01011101101000011100
+01011101110110100000
+01011110001010100111
+01100000110111111110
+01100001101111101100
+01100001110001100011
+01100011001100010101
+01100100000010111110
+01100100001010000100
+01100100001101111001
+01100110000100101011
+01100111001010001011
+01101000010001011000
+01101001001010010110
+01101101000100011111
+01101101100110101011
+01101111001010000101
+01101111001010101010
+01110000010100010110
+01110001100101111100
+01110001111111101010
+01110011001001111100
+01110100000111101011
+01110100001000001100
+01110100111010000111
+01110101101110101111
+01110101110011011111
+01110110111010011101
+01111000000001111001
+01111000010001100110
+01111000010001111001
+01111000110111010010
+01111000110111111111
+01111010000101101011
+01111011101010010110
+01111100100111111110
+01111100100111111111
+01111110101101011000
+10000001111110000101
+10000010000011001110
+10001100101010011011
+10001110010110110100
+10010010001100000010
+10010101111011011111
+10010110010000010001
+10010111010111011010
+10010111011110000101
+10011001110100100100
+10110001010110111100
+10110001010110111100
+10110001110110101101
+10110011001010100111
+10110011010110111110
+10110011101111100100
+10110101000111101011
+10110110010101101011
+10111100001010001110
+10111111111100010001
+11000100010100110110
+11000100100111011101
+11000101000010100110
+11001011011100101011
+11001111100011101101
+11010001001100010110
+11010100000101111010
+11010100111011111011
+11010111011000010110
+11101100001011000111
+11101101101110000010
+11110100011000011010
+11110110111110001000
+11111000010001110000
+11111001101101010101
+11111100010101101011
+Started at Sat Apr 26 02:07:30 +0100 2008
+Took 1722.345688 seconds
+Generation number 9
+00000100000110000110
+00000100010110000110
+00000100100011101101
+00000100101000100101
+00000101000010111101
+00000101010100000000
+00000101100011111100
+00000110110011011110
+00001000000100111011
+00001010011010111010
+00001011000100101011
+00001011011010011001
+00001011011100000100
+00001100001101101001
+00001100011010000010
+00001100101111011110
+00001101000100000011
+00001101011111111000
+00001101100001100101
+00001110001000010101
+00001110010011011111
+00001110011010111011
+00001110101010000101
+00001110111010000101
+00001111001010110111
+00001111001010111110
+00001111010101010111
+00001111011001111011
+00001111111101111000
+00010000100101100000
+00010001001111110001
+00010001110001100011
+00010010101011000101
+00010010101011100101
+00010010101110101111
+00010100100111001101
+00010100101010011011
+00010100111010000111
+00010101011100101100
+00010101011100111000
+00010101011110101110
+00010111010000010010
+00010111011000010000
+00011010011100011011
+00011100001111011011
+00011100010110100100
+00011110010010001001
+00011110011100000111
+00011110111011000111
+00011110111111000111
+00011110111111011011
+00100011010101101000
+00100100000100000110
+00100101000111101011
+00100101011100100000
+00100101111101100110
+00100111100101111000
+00101000010000111011
+00101000010101111001
+00101000101011111001
+00101001101000010010
+00101100111010011101
+00101101001000111001
+00101101001110101011
+00101111011101010011
+00110000001011110001
+00110000110001111010
+00110001001110110100
+00110001001111110001
+00110001110010001110
+00110011001100000100
+00110100010001110001
+00110100010110011101
+00110100010111000000
+00110100011000011010
+00110101010010111110
+00110101011101111011
+00110110001001010101
+00110110011010001101
+00110110111101010101
+00110111000000001011
+00111000010010111001
+00111000010100101100
+00111000010101101010
+00111000100001100010
+00111000100101011110
+00111000110000111101
+00111000110111010010
+00111001010111011011
+00111010000010101010
+00111011001101010011
+00111100000000010111
+00111100001101011011
+00111100010010111001
+00111100010101111011
+00111100011010010101
+00111100011101011011
+00111100011111000000
+00111100011111111100
+00111101101001100101
+00111110000011101010
+00111110010110110100
+00111110011111011101
+00111110011111111100
+00111110101010011011
+00111111100011101101
+01000000010011101000
+01000000011011101011
+01000001110000100110
+01000010000011001110
+01000010011101100011
+01000010011111111011
+01000011010111011010
+01000100010111011010
+01000100101010010110
+01000101111010000000
+01000110011011111100
+01001000011011101011
+01001010010001100110
+01001010011000010100
+01001010011110000100
+01001011011100101111
+01001100011001101001
+01001100101000001000
+01001100110101011110
+01001101000110101011
+01001110000100101101
+01001111001010000101
+01001111010011011011
+01010101000111101011
+01010110100101101100
+01010111001110000101
+01010111011100010110
+01011000110111010010
+01011110011010000101
+01100010101010101101
+01100011000001111100
+01100011010100101011
+01100100001110110111
+01100100100000010111
+01100111011010000000
+01100111101010001011
+01101001001011000001
+01101101000100011111
+01101101000110010110
+01101101010111010010
+01101101100110101001
+01101101111010000111
+01110000010100010110
+01110000010111011110
+01110011001001111100
+01110011011110000000
+01110100010100110100
+01110100111010001111
+01110101101110101101
+01110101110100111010
+01110111011010011001
+01111000000001111001
+01111000010001111001
+01111000101010101010
+01111000110111111000
+01111000111011101011
+01111000111111010010
+01111011100010010111
+01111011101001010110
+01111100000001111001
+01111100100111110100
+01111110100111111110
+01111111111111000011
+10000001010010100111
+10000101111110000100
+10001001011111110110
+10001100100001100101
+10001100110010011010
+10001101010110000011
+10001110010111110001
+10001111001010010111
+10010011101011100111
+10010100100001001000
+10010111011110000110
+10011001111111011011
+10101101000110111101
+10101110000100110111
+10110101000101101010
+10111000010001100110
+10111011101111100100
+11000100101010000101
+11001000000001111001
+11001000010001101001
+11001011011100101011
+11001110000011101011
+11001111110011101101
+11001111110100110100
+11010100000100010101
+11011100010101101010
+11011101001100101011
+11100110101100010101
+11110101010110000000
+11110101101000010010
+11111001100011001111
+Started at Sat Apr 26 02:36:12 +0100 2008
+Took 1926.564649 seconds
+Generation number 10
+00000001101010101100
+00000100000011101101
+00000100000110011101
+00000100100011101100
+00000101000010111101
+00000101010100000000
+00000101101100010111
+00001000000000111011
+00001000000111111100
+00001000011011101011
+00001011001100000100
+00001011011111100011
+00001011101010110111
+00001100010011011111
+00001100010110100100
+00001100011010000000
+00001100100101100000
+00001101000110000010
+00001101011111011000
+00001110001011111001
+00001110001111101001
+00001110010011011001
+00001110010011011111
+00001111000100101011
+00001111001010011010
+00001111001010111100
+00001111010100101011
+00001111011001111110
+00001111110100110100
+00001111111101110100
+00001111111101111000
+00010001001001111011
+00010100000000111100
+00010100100011100110
+00010101010000100100
+00010101010110100011
+00010101111010000100
+00010110010010001101
+00010111011000010010
+00011000010110111110
+00011000010111011110
+00011001101111001011
+00011010011100010011
+00011100001101101001
+00011100010110100100
+00011100011010010101
+00011110010001111010
+00011110111100010110
+00011110111111011011
+00100000001100000110
+00100000010101111010
+00100100000100010101
+00100100001110110111
+00100100011100001011
+00100101011100100000
+00101000010001100110
+00101000010100110111
+00101000011000010010
+00101000011011010101
+00101000110100111011
+00101000110101010010
+00101001101000011010
+00101011101111100100
+00101100001111011011
+00101100011010111011
+00101100111010011101
+00101101001000011001
+00101101001110001011
+00101101001111111000
+00110000010111011110
+00110000110001111011
+00110000110010001110
+00110000111000011010
+00110001001110100100
+00110001111100001111
+00110010000011101010
+00110010101011100101
+00110011001101111001
+00110100000100010101
+00110100010000111011
+00110100010011111010
+00110100011000010010
+00110100011000011010
+00110100011000011010
+00110101010010111011
+00110101110010101110
+00110110001001010101
+00110110001001010101
+00110111000000001011
+00110111000011101101
+00111000010101101001
+00111000010101101010
+00111000011101100010
+00111000100101011110
+00111000110000111101
+00111000111110000111
+00111010010010111001
+00111010010110110100
+00111011001100000101
+00111011110001111010
+00111100001001011011
+00111100001011000101
+00111100010100111001
+00111100011010010101
+00111100011010011101
+00111100011100111011
+00111101010111110010
+00111101101001100101
+00111101111101101010
+00111110000100110111
+00111110011101011101
+00111110011111010101
+00111110111100000111
+00111111001010111110
+01000000011011101011
+01000000011011101011
+01000100010111111000
+01000100010111111110
+01000100101110010110
+01000101100000111011
+01000110000011001101
+01001000100111111110
+01001010000000101101
+01001010010110010100
+01001010101010000101
+01001111010011011011
+01010000100101110000
+01010101000111101011
+01010101001110111111
+01010111000111101011
+01011001010111011011
+01011010110111010010
+01011100000011110011
+01100001000111011011
+01100011010111011010
+01100100000100000110
+01100100000111101011
+01100100011110110111
+01101000111010111011
+01101001001011101011
+01101011101001011011
+01101100010111000000
+01101101010100111010
+01101101010111000110
+01101101111010000011
+01101101111111010010
+01110000010111111101
+01110010011101100011
+01110101000100011111
+01110101101110101101
+01110101110100111010
+01110101110111010010
+01110110000011000111
+01111000010100101110
+01111000101001111011
+01111000111010011010
+01111000111011000001
+01111000111110101010
+01111010101011000101
+01111011100011101101
+01111100000000010111
+01111100001101000000
+01111101000100011111
+01111110011001111011
+01111110100111111111
+01111111011010001001
+10000101010000000001
+10000101010100000000
+10001001010010010010
+10001011110010010111
+10001100010110011010
+10001100100001100101
+10001100100001100110
+10001100100011101101
+10001100110011011010
+10001111011111001101
+10010000111111010010
+10010010110101101100
+10010011110111101000
+10011001111111011001
+10011010011100011011
+10011010110111010010
+10011100100111000001
+10011101010110001110
+10110101111101100110
+10110110011010001100
+11000101010010111110
+11000101011111110110
+11001000000000000100
+11001001010001001110
+11001001010001101001
+11001001111010000000
+11010100000100010101
+11010101011100100000
+11011100001011100111
+11100110101100010101
+11100111101110101011
+11101011100011001111
+11111000100101011110
+11111000101010101010
+Started at Sat Apr 26 03:08:19 +0100 2008
+Took 2014.162627 seconds
+Generation number 11
+00000010110101101000
+00000100000001101101
+00000100000011101101
+00000100011100110111
+00000100110110111010
+00000101011000010011
+00001000001101011011
+00001000010100101110
+00001000010111011100
+00001000011011101011
+00001000100001011111
+00001001011011101111
+00001001111010000010
+00001011001100000010
+00001011011111000011
+00001011101110100100
+00001100000100000110
+00001100010011011110
+00001100010011011111
+00001101010010011111
+00001101100101000000
+00001110010011011001
+00001110010011011010
+00001110010011011110
+00001111000011101101
+00001111010011011010
+00001111010100101011
+00010001000110101011
+00010100000000111100
+00010100100011100110
+00010100100100010011
+00010101010000100100
+00010101010110000110
+00010101111100010110
+00010110111110000111
+00010111111100000010
+00011000000011001010
+00011000101001100101
+00011000101010101010
+00011001010110111111
+00011010011011100110
+00011010011100010011
+00011010100111010010
+00011101110101101010
+00011110100000111011
+00011110111111011011
+00011111111111011011
+00011111111111011011
+00100000010101111000
+00100000011000011010
+00100010000001010101
+00100100011100001011
+00100101111111110010
+00100111001110111101
+00101000000011001101
+00101000010100110111
+00101000011000010010
+00101000011011000111
+00101000110100101011
+00101000110100110110
+00101000110101010110
+00101000111010111011
+00101000111110101010
+00101001101000011110
+00101010010011100011
+00101100011010111101
+00101100111010011101
+00101100111011011100
+00101101001110001011
+00101101001111000111
+00101101010110110101
+00101101010111011001
+00101101011010111011
+00101110001011111001
+00110000111000101111
+00110000111001011010
+00110001111110001111
+00110010000011101010
+00110010010010111110
+00110010111111010101
+00110100010011111010
+00110100010111111011
+00110100011000010010
+00110100011000010100
+00110100011011011010
+00110101101111001011
+00110101110010011011
+00110110010110010100
+00110111000000001011
+00110111000100101111
+00111000000010001101
+00111000110001001110
+00111000111110000111
+00111001010100111010
+00111001011100000001
+00111010011111011001
+00111011001100011001
+00111100000011001111
+00111100010101100110
+00111100010110111001
+00111100011001011011
+00111100011111101011
+00111100100111000001
+00111101101001000111
+00111110001100000101
+00111110111100010110
+00111111001110111110
+00111111010110010100
+00111111101001100101
+01000000011011010101
+01000000011011101011
+01000000011101101001
+01000100000111111100
+01000100010111111111
+01000100101110010110
+01000101100000111011
+01000110010111111110
+01000111111110101001
+01001000011011101011
+01001010010110010101
+01001010111011000000
+01001100100011101101
+01001111001010111101
+01010000011110101011
+01010101000111101011
+01010101010010110110
+01010111000111101011
+01010111000111101011
+01011001001110000100
+01011001010111011011
+01011001111010011011
+01011011010000001011
+01011110000011110011
+01011110101111111011
+01100100000010000100
+01100100000101100000
+01100100000110101011
+01100100000111101011
+01100100010111111000
+01100100100011101110
+01100111101110101011
+01101000010100110111
+01101000011000010010
+01101000111010101011
+01101011110011001111
+01101101001110001011
+01101101010010111010
+01101101010110000110
+01101101010111000110
+01101111010100101011
+01110000101011000001
+01110011010111011010
+01110011011101100001
+01110101110110111110
+01110101110111011110
+01110101111110100100
+01110110000011010101
+01111000010011101011
+01111000111110111001
+01111010011111000101
+01111010101011000101
+01111011100011101011
+01111100001101100010
+01111101000110111111
+01111101010100010101
+01111110011010011101
+01111110101000011010
+01111111011001111110
+10000101000000001111
+10001000001001000000
+10001001010000111101
+10001011110011010011
+10001100010100011010
+10001100010110011010
+10001100010110011010
+10001100110011011010
+10001111110100110100
+10010010110101101100
+10010100000110011101
+10010101011000010010
+10011001110110110100
+10011110010001111010
+10011110011010001100
+10100111101110101011
+10101011100011011111
+10110101000100010101
+10111001000111011001
+11000101011110111111
+11001001010000111001
+11001100100111111100
+11011011010111110010
+11011110111100010110
+11100100011100001011
+11100100011110110111
+11100101011110011011
+11101011101011101011
+11101011111011000101
+11101100010110000100
+11110101001111111011
+11110101111010000100
+Started at Sat Apr 26 03:41:53 +0100 2008
+Took 2051.893687 seconds
+Generation number 12
+00000001011000010011
+00000010010100111010
+00000100000110101011
+00000100010111111011
+00000100011100110101
+00000100011100110111
+00000100100110111010
+00000100110110111010
+00000101001110011011
+00001000011000010010
+00001000011011000111
+00001000011011110100
+00001000111111111011
+00001001010001101011
+00001001011011101101
+00001001111010001010
+00001010000001010101
+00001010001101011111
+00001011010100101011
+00001011011111000001
+00001011101110100101
+00001100010011011011
+00001110010010001011
+00001110010010101111
+00001110010011011001
+00001110010011111010
+00001110101000011010
+00010001000110101011
+00010001000110101011
+00010001010000100100
+00010010100111000010
+00010011010111110010
+00010100010100010101
+00010100100011100110
+00010100110100010011
+00011000101001100101
+00011001010110111111
+00011001110111001011
+00011010011100010011
+00011011101110110110
+00011011110001001111
+00011100011000011010
+00011110010011011001
+00011110010110111010
+00011110111111111011
+00011111010100100110
+00011111010110010100
+00011111111111001011
+00100000000101111000
+00100000011011101011
+00100000111000101101
+00100001011000011010
+00100010000001010100
+00100010110101101100
+00100100000100111100
+00100100010011101011
+00100100011100011010
+00100101011010110100
+00100111101000011110
+00101000001011011010
+00101000011011001011
+00101000011011101011
+00101000111010111011
+00101000111110110110
+00101100000011001101
+00101100011001010110
+00101100111011011110
+00101101001111000111
+00101101010011011011
+00101101011000011111
+00101111010100101011
+00110000111010011010
+00110000111111011111
+00110001101110001111
+00110001111110001111
+00110011011000010011
+00110100000111101011
+00110100010111111011
+00110100011000010111
+00110100011011010010
+00110100111110101010
+00110101101111001001
+00110110001000011100
+00110111000100101010
+00111000000000111111
+00111000010101100111
+00111000011111000111
+00111000100001001110
+00111000110011011110
+00111000111010100001
+00111001000000001100
+00111001001000100001
+00111001011100000001
+00111001110001101000
+00111010001111011010
+00111100010101100110
+00111100010101101011
+00111100010101111011
+00111100011011001011
+00111100011111101111
+00111101000010011111
+00111101010010110110
+00111101010010110111
+00111101010111011001
+00111101110010011011
+00111110001110111110
+00111110011010011101
+00111110011111011010
+00111111101001111011
+01000000010101100110
+01000000011011010101
+01000000011011101111
+01000100000101100001
+01000100011010110100
+01000101100010001101
+01000110010101111011
+01000110010111111110
+01001000011011101011
+01001111001010101111
+01010000011000000010
+01010001111100001111
+01010100100011100110
+01010100111001011011
+01010111000111100011
+01011001010110111101
+01011100010110011010
+01011110011100011010
+01011110101110101010
+01011110101111111110
+01100100000110101011
+01100100100011101110
+01100100101110010110
+01100101000110000110
+01100101101111001011
+01100101111110011011
+01101000011000001011
+01101000011000010010
+01101000011101100001
+01101000101000011010
+01101000111010101010
+01101001010100110111
+01101001111011000101
+01101010010011011010
+01101011100011001011
+01101101010000111000
+01101101010110000110
+01101101010110000110
+01101111101110101011
+01110000010011101011
+01110000101011010000
+01110010111110111001
+01110100011000010010
+01110100110111011110
+01110101110110011111
+01110101110110111110
+01110110000011010101
+01110110000011110100
+01110110000110011010
+01110110010110000100
+01110111001110011111
+01111000010001000101
+01111000110011101011
+01111001110110000111
+01111010011110000111
+01111010101011101111
+01111101010010011111
+01111101010011111010
+01111101010100010101
+01111110011010011101
+01111110101101111011
+01111110101111001110
+01111110111010101010
+10000100000011100111
+10000101000000000001
+10001100010011011100
+10001100010111010101
+10001100100111111100
+10001111110111010101
+10010001000110011001
+10010001110110101011
+10011010001010100110
+10011110001111111011
+10101000011000010011
+10101000011100001011
+10101011011100100011
+10110011000000000101
+10111000101111111100
+10111011010100001110
+11001001010000111001
+11001010011100001011
+11001100110011011010
+11010101011110001011
+11011010111111010111
+11100100100011101110
+11100101010010110000
+11100101010011110110
+11100101010111011110
+11101011101011101011
+11101100100111111100
+11111101000110111101
+Started at Sat Apr 26 04:16:05 +0100 2008
+Took 2131.171748 seconds
+Generation number 13
+00000000000110101011
+00000000010111010110
+00000000011011101001
+00000001011000010011
+00000010010110111110
+00000100010111111011
+00000100100011100110
+00000100100111101110
+00000100111000001011
+00000101011100110001
+00000101101110011011
+00000110010110111110
+00001000011000010011
+00001000111001001111
+00001001010001100011
+00001001010001101011
+00001001010110111111
+00001001011011101100
+00001001101010001011
+00001001110010001010
+00001001110110000101
+00001010000001010100
+00001010010111111110
+00001010011111000001
+00001011011110111110
+00001011101110100101
+00001011111101100101
+00001100000011011011
+00001100100011101110
+00001101010011011011
+00001110010010000011
+00001110010111111011
+00001111011010111111
+00010000000110101101
+00010001010000100101
+00010001110000100100
+00010011010000100101
+00010100110100010101
+00010100110110111010
+00010110101111001110
+00011000111111111011
+00011001011011100110
+00011011100101100110
+00011011101010110110
+00011011101110110110
+00011011101110111110
+00011011110001001101
+00011011110110001010
+00011110001110101011
+00011110010110111010
+00011110010110111011
+00011110110011101011
+00011111010110010100
+00011111011100011010
+00100000111000011010
+00100001011000010011
+00100011011000000111
+00100011101010011110
+00100100011000111011
+00100100011010010100
+00100100101111111110
+00100111101100011111
+00101000011011101011
+00101000111110110100
+00101001011001011010
+00101001011011001011
+00101010101011101111
+00101011010100001100
+00101011111100001011
+00101100000111111011
+00101101001111011010
+00101101011001010111
+00101101011111001011
+00101110001000011100
+00110000001011101101
+00110001000111101001
+00110001111111111011
+00110010111010011010
+00110011000100001010
+00110011001001011011
+00110110001000011100
+00110110001010011110
+00110110011100001011
+00110111000100100111
+00111000001011011010
+00111000010000111111
+00111000011010110110
+00111000011101000001
+00111000011111000111
+00111000110111010101
+00111000111010100011
+00111000111110001111
+00111001001001110111
+00111001010111011111
+00111001011100000001
+00111010011010100001
+00111100010101011011
+00111100010111000111
+00111100011000010111
+00111100011011001011
+00111100110010011010
+00111100111110101010
+00111101000010011110
+00111101010010100001
+00111101110010011011
+00111110011110101111
+00111110101011101011
+00111110110010110000
+00111111010011110110
+00111111101101111011
+01000010010000111000
+01000101010001101111
+01000101100010001101
+01001000111111111011
+01001001111011000101
+01001010001101011111
+01001011010100101011
+01010001000111101011
+01010110000011110100
+01011000111000100011
+01011010011110000101
+01011010101111111110
+01011100010110011011
+01011100101111000001
+01011110010011001011
+01100000011111100001
+01100100101110001110
+01100101010111110110
+01100101011110001011
+01100101111110010011
+01100110000011110110
+01101000011100110101
+01101001010111000100
+01101001011111001011
+01101001101000011010
+01101011101110100011
+01101011111011000101
+01101100000011111011
+01101101010000111110
+01101101010100110101
+01101101010110011101
+01101101010111010110
+01101111111011000101
+01110000010001101011
+01110000011011101011
+01110100010101100110
+01110100011011010001
+01110100110111011101
+01110101010011111110
+01110101110110011011
+01110110000110111010
+01110110110110000101
+01111000010011001101
+01111000011111101011
+01111000111111111011
+01111001101110111111
+01111010011110001010
+01111100010100010101
+01111100101111100010
+01111101000101001011
+01111101010010011101
+01111101010100010101
+01111110101101111011
+01111110101111001010
+01111110111010101010
+01111110111011000110
+10000001011000011010
+10000101011000010011
+10001001111011001011
+10001100000101000001
+10001100010011010101
+10001100010111010101
+10001100010111011100
+10001100011011110000
+10010001110110101010
+10011000101001000001
+10011001010001010110
+10011110111010100001
+10011111111110010101
+10101011001001100101
+10101100101110100101
+10101101011110000110
+10110011000000000111
+10111100010001100110
+10111101010010110110
+11000000010101100000
+11001000011011000010
+11001000011100001111
+11001001010000111000
+11001010011100001010
+11010100011000001011
+11010110000110111010
+11100100101010011101
+11100100110011011001
+11100101010010110000
+11100101011010110001
+11100111010011011110
+11101000011000001111
+11110101010111011110
+11111101000110111111
+Started at Sat Apr 26 04:51:36 +0100 2008
+Took 2193.372392 seconds
+Generation number 14
+00000000010111010110
+00000000011010101000
+00000001011011011001
+00000010000110111010
+00000010010110110110
+00000011010000100101
+00000100100110101110
+00000100111000001011
+00000101011100110001
+00000101101100011011
+00000101111100110011
+00000110010110111100
+00000110010110111110
+00000110011010101011
+00001000010001101011
+00001000111001001110
+00001001010001010110
+00001001010001100010
+00001001010001101011
+00001001010001111110
+00001001010010011011
+00001001010010110110
+00001001010101001010
+00001001010110111110
+00001001011011101100
+00001011010110111111
+00001011011101001101
+00001011011111000010
+00001011100101100110
+00001011101110100101
+00001011101110100101
+00001011101110110000
+00001011110110000101
+00001011111100000011
+00001011111100001011
+00001100000011011011
+00001100000110101011
+00001100000111111011
+00001100010111101001
+00001101010011011011
+00001110000011011011
+00001110010111111101
+00001110101010011100
+00001110101111001110
+00001110111011000110
+00001111011010111010
+00010000101010101010
+00010001000111101011
+00010001010000001011
+00010001010000100101
+00010100000011011011
+00010100011111100110
+00010100100011000110
+00010100110111000111
+00011000011100010011
+00011000111010100011
+00011001010011100110
+00011001110100010101
+00011001110110101111
+00011011100101101010
+00011011101101100110
+00011011101110000101
+00011011101110111111
+00011100010111111011
+00011100110011101011
+00011101011100110101
+00011110001100011010
+00011110001110101010
+00011110011100011010
+00011110111010110001
+00011111111110010101
+00100100011011011111
+00100110011101001011
+00101000110000001011
+00101000111111111011
+00101001010001111010
+00101001011001011010
+00101010011010100001
+00101101011001010111
+00101110001000011100
+00110000011000011011
+00110001011011001011
+00110010111010011010
+00110100101110001110
+00110100110110111010
+00110110011000010011
+00110111000100100111
+00111000010010001010
+00111000110110100001
+00111000110111010101
+00111000110111010101
+00111001010111010110
+00111001011100010111
+00111010011110000101
+00111011100011101111
+00111011100101100110
+00111100010110110010
+00111100010111010101
+00111100011000000101
+00111100011011001001
+00111100011011001011
+00111100110000011011
+00111100111011001011
+00111100111110101010
+00111100111110101011
+00111101010010011101
+00111101010011010101
+00111101100101001011
+00111110010111101111
+00111110011000001011
+00111110011110101111
+00111110101010101111
+00111110110000110011
+00111110110010110000
+00111110111111101011
+00111111010011110110
+00111111110010100101
+01000001100010001101
+01000101010010000011
+01001000011110111110
+01001000111110110100
+01001001011111000111
+01001010001101010100
+01001010010111010110
+01001011010100101011
+01001101110110000101
+01011010011110111110
+01011011110000110100
+01011100010011100101
+01011100101111000001
+01011110010011011110
+01100000010001101011
+01100101010111111110
+01100101011111110110
+01100110110110000101
+01101001111111001111
+01101100000011111011
+01101101000100110101
+01101101010000111110
+01101101010010011101
+01101110000110101011
+01101111010011101011
+01101111111011000101
+01110000011110110100
+01110100010101100111
+01110100011011010001
+01110101010111101011
+01110101111011101011
+01111000010011001101
+01111000011011101011
+01111000011111101011
+01111000011111101011
+01111001001110111110
+01111001101110111111
+01111011010100001100
+01111100101111100011
+01111100111101100010
+01111101000110111111
+01111101010011110110
+01111110100110010001
+01111110101111001110
+01111111111010101010
+01111111111010101101
+01111111111101100101
+10000001001010010011
+10000001101110111110
+10000101101110011000
+10001001011100000001
+10001010111100001010
+10001101001101111011
+10001101010010110001
+10011001010001010100
+10011001010001100001
+10011011000001101101
+10011111110110010100
+10101000010110011011
+10101011010100001100
+10101100111101000000
+10110001000111110111
+10110011000100001000
+10110110010110111100
+10111000111111001011
+10111101010010111110
+10111101010011110110
+11000100101010011101
+11000101010001101111
+11001000011100001111
+11001010011100001010
+11001010011110111110
+11001011010101100110
+11010100011000001011
+11011000010000111110
+11011110000110111010
+11100100101010011010
+11100100110000010011
+11100100110011011001
+11101100000011111011
+11101100011100110101
+11110100110111011101
+11111101000110111110
+Started at Sat Apr 26 05:28:09 +0100 2008
+Took 2335.23266 seconds
+Generation number 15
+00000000010011011011
+00000000011000101000
+00000001010000001011
+00000001011011000101
+00000001011011011001
+00000011010000100101
+00000011010000111001
+00000100101101100101
+00000101111101100111
+00000111110010100101
+00001000010011010101
+00001000010100100011
+00001000010101101011
+00001000010110110110
+00001000100110101001
+00001000111001001110
+00001001001001010110
+00001001010000001011
+00001001010000010110
+00001001010001010110
+00001001010001010111
+00001001010010110110
+00001001010010110110
+00001001011011101100
+00001001110111000110
+00001010111011101011
+00001011011110001011
+00001011100101100101
+00001011101010010101
+00001011101011110001
+00001011101110100110
+00001011110110000101
+00001011111010001011
+00001011111100001011
+00001011111110100101
+00001100000011011011
+00001100000011111011
+00001100000110101011
+00001100110010111010
+00001100111011101011
+00001101010010110001
+00001110000011011011
+00001110000011111011
+00001110001000011100
+00001110010010110000
+00001110010111100111
+00001110010111111001
+00001110110111010101
+00001111000011011011
+00001111001010111110
+00001111011110111010
+00010011101110100000
+00010100011110100110
+00010100101110111111
+00010100110111000111
+00010101000011111011
+00011000011100011111
+00011001101110110110
+00011001110100010101
+00011001110110100010
+00011001111100010011
+00011010011100011110
+00011011101001101110
+00011011101101100110
+00011011101110111111
+00011100000011011011
+00011100010111100101
+00011100101100100101
+00011100111110101011
+00011101010000010011
+00011101011011001000
+00011101110110101111
+00011110001100000101
+00011110001100011011
+00011110001100011011
+00011110001111001101
+00011110011100011010
+00011110111101100110
+00011111110110010100
+00011111110110010111
+00100000010001101011
+00100010010001101011
+00101000111001001110
+00101001010010011010
+00101001010101001000
+00101001010111000010
+00101001011010101000
+00101001110111010111
+00101100001011001011
+00101100010111100110
+00101101010000100010
+00101101010011010101
+00101111011110011010
+00110011010110111111
+00110100011001011010
+00110100011100000101
+00110100011111100110
+00110100100110100110
+00110100110110111010
+00110100110110111110
+00110100110111111010
+00110100110111111010
+00110110001100000010
+00110110010111101110
+00111000100110101110
+00111000110011010101
+00111000110110111110
+00111001010110111111
+00111001011100010001
+00111001011100100111
+00111001110011101111
+00111010011110000101
+00111010011110011010
+00111011010111010000
+00111100011000001010
+00111100110111011010
+00111100111110100010
+00111101010001100010
+00111101111000110101
+00111110010100000111
+00111110010111010110
+00111110011101101111
+00111110011110101111
+00111110110010111000
+00111110111100011010
+01000000010010011011
+01000001100010001101
+01000100101011000110
+01001000111110110100
+01001001011011101000
+01001010001101010100
+01001011010001111011
+01001011010100101011
+01001011010100110100
+01001011110110000101
+01001011111110110100
+01001100010111100001
+01001101110110000101
+01001101110110000101
+01010101111000001011
+01011010011110111010
+01011011010000110100
+01011110000110111011
+01100000010001101011
+01100000010101101011
+01100100110111011001
+01100101011111110110
+01100110110010001011
+01100110110100000110
+01101000010101000110
+01101001011111000111
+01101011111111001111
+01101100000011111011
+01101110101010011100
+01101110111101000000
+01101111111011000100
+01110000011110101001
+01110000011110110100
+01110010011001101011
+01110011010000001100
+01111000010010100010
+01111000110011010101
+01111001011011100010
+01111010101110101110
+01111100111101101101
+01111100111101110010
+01111101000110010011
+01111101010011110111
+01111101110011110010
+01111110101110001111
+01111111011101100101
+01111111110110101010
+10000100010110111100
+10000101101110011001
+10000101111110110011
+10001100000111101011
+10001101001101111010
+10011000010001101110
+10011100110011100101
+10011101001101110011
+10011110010011100010
+10011111110111111101
+10100000011000010011
+10101100110101010000
+10101111010000111110
+10110010110110111100
+10110101010001011011
+10111110101111001110
+11000100100101100110
+11001001010010011011
+11001010011001011011
+11001010011110111010
+11011000000000111101
+11011000010000010101
+11011110000110110101
+11100100101010011110
+11100100101010011110
+11100100110000010101
+11101100000011011011
+11111101000110111110
+Started at Sat Apr 26 06:07:05 +0100 2008
+Took 2289.021254 seconds
+Generation number 16
+00000000010011011011
+00000001010000010111
+00000010111011110111
+00000011000000111001
+00000011110110000010
+00000100100101100110
+00000100101011000110
+00000100110000010101
+00000101000110111110
+00000101111011001101
+00000111011011001000
+00000111100010100100
+00000111100010100101
+00000111110010001011
+00001000010010110000
+00001000010100100110
+00001000110001001110
+00001000110100010101
+00001000110110100101
+00001001000110100111
+00001001010000010110
+00001001010001011011
+00001001010101100111
+00001001010110111111
+00001001011011101100
+00001001111110010011
+00001010000001001011
+00001010111101100110
+00001011010010011110
+00001011101011110010
+00001011101011110100
+00001011101110100100
+00001011111100001001
+00001011111100011011
+00001011111110110100
+00001100010010111000
+00001100011001101011
+00001101010001001010
+00001101010010110001
+00001101110110101010
+00001101111011011001
+00001110000011011011
+00001110000111101011
+00001110010000001011
+00001110010010110000
+00001110010011100111
+00001110100110100110
+00001111001010111110
+00001111001010111110
+00001111001010111110
+00001111100101100101
+00001111110110000100
+00010000011000101000
+00010011101110101111
+00010100011001011011
+00010100011110100010
+00010101000011110101
+00011000011100011111
+00011000110110111110
+00011001010001010101
+00011001110100010101
+00011001110100101110
+00011010010000011011
+00011011010100110100
+00011011101011101011
+00011011101101101110
+00011011101111011101
+00011100000011111110
+00011100001100001011
+00011100010100001111
+00011100101100100101
+00011100101101000101
+00011101000000111111
+00011101110010101011
+00011101110110101010
+00011110001100000101
+00011110111101100110
+00011111000010010000
+00011111011100011110
+00011111110110010101
+00011111111100001010
+00100000010001100010
+00100010010001101111
+00100010010011000010
+00100011010001101011
+00100011010010100101
+00100101010010100001
+00101001010010011010
+00101001010110000101
+00101001110111010111
+00101010111011000011
+00101011111100100101
+00101100001011001011
+00101100001011010100
+00101100010001011001
+00101101010111001011
+00101101110111010000
+00101110111101000000
+00110000010110101010
+00110000110000001010
+00110011010010110110
+00110011011110110111
+00110011110110100000
+00110100010110111110
+00110100011011101100
+00110100011100000101
+00110100110110111010
+00110110001100010010
+00110110110111101010
+00111000100110101110
+00111000101110101010
+00111001000011011011
+00111001010010011010
+00111001011100110110
+00111010001110000101
+00111010010111100111
+00111010011110000101
+00111011010000110100
+00111011010011010000
+00111011010111100110
+00111100011110111010
+00111100110111011000
+00111100111110000010
+00111101110111111010
+00111110010100000110
+00111110011011111010
+00111110011101101111
+00111110011110000101
+01000100101010000110
+01000100101011000110
+01001001010001110111
+01001001110111111010
+01001010011100101011
+01001011011110111010
+01001011100110010101
+01001100101011000110
+01001110101110101011
+01001110110110101111
+01010001011001101011
+01011000001010111010
+01011000011100011111
+01011000110011010101
+01011000110011110101
+01011011100011110001
+01011011110101000000
+01011100001001011110
+01011111110110000101
+01100000010100100011
+01100100110001100110
+01100100110111111001
+01100110110010011011
+01101000010000001011
+01101101010000100011
+01110001011110101001
+01110011010110011110
+01111000010010100010
+01111000100011010101
+01111000100110101100
+01111000110011110101
+01111010111110101110
+01111100111101101101
+01111101100011111111
+01111111011011001100
+01111111110110101111
+10000000001000100101
+10000100010110111100
+10001000110100101011
+10001001011011101100
+10001001110111000110
+10001011011110001011
+10001110000111101011
+10001111010110111111
+10010101110110101111
+10011000010001010101
+10011010010011100010
+10011010011110011010
+10011101101100100101
+10011101110101010111
+10011110000010100101
+10101001011000101000
+10101111010011111011
+10110101010001010110
+10111001111001001110
+11000001011011000101
+11000100101011000110
+11001001010010011011
+11001010011001011010
+11001011010010100101
+11001101001101011010
+11001101010010110001
+11010000010000010101
+11011000000000111001
+11011000010000010100
+11011000010001001111
+11011000010010010101
+11011001010011011011
+11100000010001101011
+11100100101010011011
+11111000111101101101
+11111001100010001111
+Started at Sat Apr 26 06:45:14 +0100 2008
+Took 2222.522446 seconds
+Generation number 17
+00000000000000010010
+00000000001010101000
+00000000010000101011
+00000010000000111001
+00000010011011100011
+00000011000000000101
+00000011000000111001
+00000011101110110100
+00000011110110000010
+00000100100000010101
+00000100101101111010
+00000100110000010101
+00000101000110111110
+00000101110100010101
+00000101111011001101
+00000110001001011010
+00000111010001110111
+00000111011011001001
+00000111110010100100
+00001000010010110100
+00001000010100100111
+00001000110110100101
+00001000110110100101
+00001001010000010110
+00001001010001001010
+00001001010011011111
+00001001010110101001
+00001001011011101100
+00001001100010100101
+00001001110011011011
+00001001111100000001
+00001001111110010011
+00001010000001001011
+00001010111100011011
+00001010111101100011
+00001011001110100100
+00001011010110111111
+00001011101011110001
+00001011101011110011
+00001011110110101010
+00001011111100001001
+00001100010011110001
+00001100101111100110
+00001100110001101110
+00001101001101011010
+00001101010001101010
+00001101010111100110
+00001101010111101011
+00001
\ No newline at end of file
--- /dev/null
+#!/usr/bin/ruby -w
+
+require 'src/play'
+require 'src/selection'
+
+pop1 = Population.new(100, 20)
+
+start = Time.now
+puts "Started at #{start}"
+pop1.tournament_select_population(0.8, 1000, true)
+finish = Time.now
+puts "Took #{finish - start}"
+
--- /dev/null
+#!/usr/bin/ruby -w
+
+require 'src/play'
+require 'src/selection'
+
+winner_success_chance = 0.8
+
+player_bitstrings = readlines.collect {|l| l.chomp.split(//).collect {|x| x.to_i}}
+
+# File.open('player.log', 'a') do |f|
+# player_bitstrings.each {|b| f.puts "Process #{Process.pid}: Received #{b}"}
+# end
+
+players = player_bitstrings.collect {|b| Genome.new(b).to_potential_player}
+
+handler = GameHandler.new(players, 1000)
+winner, moves = handler.play
+
+if winner == :draw or rand > winner_success_chance
+ successful_player = players[rand(players.length)]
+else
+ successful_player = winner
+end
+
+# File.open('player.log', 'a') do |f|
+# f.puts "Process #{Process.pid}: winner is #{successful_player.to_bitstring}"
+# end
+
+puts "#{successful_player.to_bitstring}"
\ No newline at end of file
--- /dev/null
+Process 3043: Received 01100011011100000100
+Process 3043: Received 01100111111110010111
+Process 3043: Received 01100111111110010111
+Process 3043: Received 01100111111110010111
+Process 3043: winner is 01100111111110010111
+Process 3044: Received 01100111111110010111
+Process 3044: Received 10111110010001000111
+Process 3044: Received 01100011011100000100
+Process 3044: winner is 01100111111110010111
+Process 3045: Received 01100011011100000100
+Process 3045: Received 10000111110000010000
+Process 3045: Received 10111110010001000111
+Process 3045: winner is 01100011011100000100
+Process 3046: Received 01100011011100000100
+Process 3046: Received 01100111111110010111
+Process 3046: Received 01100111111110010111
+Process 3046: Received 01100111111110010111
+Process 3046: winner is 01100111111110010111
+Process 3047: Received 01100111111110010111
+Process 3047: Received 11110110100101101110
+Process 3047: Received 10111110010001000111
+Process 3047: Received 10111110010001000111
+Process 3047: Received 10000111110000010000
+Process 3047: winner is 10000111110000010000
+Process 3048: Received 01101111111110011111
+Process 3048: Received 01101111111110011111
+Process 3048: Received 10000111110000010111
+Process 3048: Received 01100011011100000100
+Process 3048: Received 01100111011110010000
+Process 3048: Received 01100111111010011111
+Process 3048: winner is 01101111111110011111
+Process 3049: Received 10000111110000010111
+Process 3049: Received 01100111011110010000
+Process 3049: Received 01100111011110010000
+Process 3049: Received 01101111111110011111
+Process 3049: Received 01100011011100000100
+Process 3049: winner is 01100111011110010000
+Process 3051: Received 10000111110000010111
+Process 3051: Received 01100111111010011111
+Process 3051: winner is 01100111111010011111
+Process 3054: Received 01100111111010011111
+Process 3054: Received 01100111111010011111
+Process 3054: Received 01101111111110011111
+Process 3054: Received 01100011011100000100
+Process 3054: Received 01100011011100000100
+Process 3054: Received 01100011011100000100
+Process 3054: winner is 01100011011100000100
+Process 3057: Received 10000111110000010111
+Process 3057: Received 01100111111010011111
+Process 3057: Received 10000111110000010111
+Process 3057: Received 01100111011110010000
+Process 3057: Received 10000111110000010111
+Process 3057: Received 01101111111110011111
+Process 3057: winner is 10000111110000010111
+Process 3061: Received 01100111111010011101
+Process 3061: Received 10000111110000000111
+Process 3061: Received 00011111111110100100
+Process 3061: Received 01100111111010011101
+Process 3061: winner is 01100111111010011101
+Process 3068: Received 01100111111010011101
+Process 3068: Received 00100110011110010000
+Process 3068: Received 00011111111110100100
+Process 3068: Received 00100110011110010000
+Process 3068: Received 00100110011110010000
+Process 3068: Received 00011111111110100100
+Process 3068: winner is 00011111111110100100
+Process 3071: Received 00100110011110010000
+Process 3071: Received 10000111110000000111
+Process 3071: Received 01100011011100011111
+Process 3071: winner is 00100110011110010000
+Process 3072: Received 10000111110000000111
+Process 3072: Received 01100011011100011111
+Process 3072: Received 01100011011100011111
+Process 3072: Received 01100111111010011101
+Process 3072: winner is 01100011011100011111
+Process 3077: Received 00100110011110010000
+Process 3077: Received 01100011011100011111
+Process 3077: Received 01100111111010011101
+Process 3077: Received 10000111110000000111
+Process 3077: winner is 01100011011100011111
+Process 3090: Received 01100111111010011101
+Process 3090: Received 01100011011100011011
+Process 3090: winner is 01100111111010011101
+Process 3093: Received 00100110011110010000
+Process 3093: Received 01100011011100011011
+Process 3093: Received 11100011011100011111
+Process 3093: Received 00011111111110100100
+Process 3093: Received 11100011011100011111
+Process 3093: winner is 01100011011100011011
+Process 3094: Received 01100111111010011101
+Process 3094: Received 00100110011110010000
+Process 3094: Received 11100011011100011111
+Process 3094: Received 00100110011110010000
+Process 3094: Received 00011111111110100100
+Process 3094: winner is 11100011011100011111
+Process 3095: Received 00100110011110010000
+Process 3095: Received 01100111111010011101
+Process 3095: Received 00100110011110010000
+Process 3095: Received 01100011011100011011
+Process 3095: winner is 01100011011100011011
+Process 3096: Received 00100110011110010000
+Process 3096: Received 00100110011110010000
+Process 3096: Received 01100111111010011101
+Process 3096: winner is 00100110011110010000
+Process 3101: Received 00100110011110010000
+Process 3101: Received 01100010011100011011
+Process 3101: Received 00100110011110010000
+Process 3101: Received 00100110011110010000
+Process 3101: Received 01101110111010011101
+Process 3101: Received 01100010011100011011
+Process 3101: winner is 00100110011110010000
+Process 3104: Received 01101110111010011101
+Process 3104: Received 00100110011110010000
+Process 3104: Received 01101110111010011101
+Process 3104: Received 01101110111010011101
+Process 3104: Received 01100011011101011011
+Process 3104: winner is 00100110011110010000
+Process 3106: Received 00100110011110010000
+Process 3106: Received 01100011011101011011
+Process 3106: winner is 01100011011101011011
+Process 3107: Received 11100011010100011111
+Process 3107: Received 01101110111010011101
+Process 3107: Received 01100010011100011011
+Process 3107: winner is 01100010011100011011
+Process 3110: Received 01100010011100011011
+Process 3110: Received 00100110011110010000
+Process 3110: Received 00100110011110010000
+Process 3110: Received 00100110011110010000
+Process 3110: Received 01100011011101011011
+Process 3110: Received 01101110111010011101
+Process 3110: winner is 00100110011110010000
+Process 3125: Received 01100000011100011011
+Process 3125: Received 00100110011110010001
+Process 3125: Received 01100011011101011010
+Process 3125: Received 01100000011100011011
+Process 3125: Received 01100000011100011011
+Process 3125: winner is 01100000011100011011
+Process 3126: Received 01100011011101011010
+Process 3126: Received 00100110011110010001
+Process 3126: winner is 00100110011110010001
+Process 3127: Received 00100100011110110000
+Process 3127: Received 01100000011100011011
+Process 3127: winner is 01100000011100011011
+Process 3128: Received 10100110011110010100
+Process 3128: Received 10100110011110010100
+Process 3128: Received 00100100011110110000
+Process 3128: winner is 00100100011110110000
+Process 3131: Received 01100011011101011010
+Process 3131: Received 00100100011110110000
+Process 3131: Received 01100000011100011011
+Process 3131: Received 01100011011101011010
+Process 3131: winner is 00100100011110110000
+Process 3132: Received 00100110011111011001
+Process 3132: Received 00100100011110110000
+Process 3132: Received 00100100011110110000
+Process 3132: Received 10100000011100011011
+Process 3132: winner is 00100110011111011001
+Process 3135: Received 00100110011111011001
+Process 3135: Received 01001000011100011111
+Process 3135: Received 00100110011111011001
+Process 3135: winner is 00100110011111011001
+Process 3138: Received 10100000011100011011
+Process 3138: Received 00100101111100110000
+Process 3138: Received 00100100011110110000
+Process 3138: Received 00100110011111011001
+Process 3138: Received 10100000011100011011
+Process 3138: Received 00100101111100110000
+Process 3138: winner is 00100100011110110000
+Process 3145: Received 00100101111100110000
+Process 3145: Received 00100101111100110000
+Process 3145: Received 00100110011111011001
+Process 3145: Received 00100100011110110000
+Process 3145: winner is 00100100011110110000
+Process 3146: Received 01001000011100011111
+Process 3146: Received 00100101111100110000
+Process 3146: Received 00100101111100110000
+Process 3146: Received 00100110011111011001
+Process 3146: Received 00100110011111011001
+Process 3146: winner is 00100101111100110000
+Process 3147: Received 00100100011110111010
+Process 3147: Received 00100110011110011000
+Process 3147: Received 00100110011110011000
+Process 3147: Received 00000101111100110000
+Process 3147: winner is 00100100011110111010
+Process 3148: Received 00000101111100110000
+Process 3148: Received 00100100011110111010
+Process 3148: Received 00100110011110011000
+Process 3148: Received 00100010011101010000
+Process 3148: Received 00100100011110111001
+Process 3148: winner is 00100100011110111010
+Process 3149: Received 00100100011110111010
+Process 3149: Received 00000101111100110000
+Process 3149: Received 00100100011110111001
+Process 3149: winner is 00100100011110111010
+Process 3152: Received 00100100011110111001
+Process 3152: Received 00100100011110111001
+Process 3152: Received 00100010011101010000
+Process 3152: winner is 00100010011101010000
+Process 3153: Received 00000101111100110000
+Process 3153: Received 00100010011101010000
+Process 3153: winner is 00100010011101010000
+Process 3154: Received 00100100011110111010
+Process 3154: Received 00101010011101010000
+Process 3154: Received 00100010011111010000
+Process 3154: Received 00100100011110111010
--- /dev/null
+#!/usr/bin/ruby -w
+
+require 'src/play'
+require 'src/selection'
+# require 'systemu'
+
+pop = Population.new(5, 20)
+generation_count = 1
+max_generations = 3
+
+if File.file? 'player.log'
+ File.delete 'player.log'
+end
+
+puts "Generation number #{generation_count}"
+pop.individuals.sort {|x, y| x.genome <=> y.genome}.each {|i| puts "#{i.genome}"}
+
+while generation_count <= max_generations
+ start = Time.now
+ puts "Started at #{start}"
+
+ new_population = []
+ threads = []
+ 1.upto(pop.individuals.length) do |i|
+ threads << Thread.new do
+ puts "Starting thread #{i}"
+ sleep 2
+ player_count = rand(5) + 2
+ pool_size = pop.individuals.length
+ players = []
+ 1.upto(player_count) { players << pop.individuals[rand(pool_size)] }
+ IO.popen('ruby play-one-game.rb', 'r+') do |pipe|
+ players.each {|p| pipe << "#{p.genome}\n" ; puts "Game #{i}: putting player #{p.genome}"}
+# players.each {|p| pipe << "#{p.genome}\n"}
+ pipe.close_write
+ new_population << Genome.new(pipe.readline.chomp.split(//).collect {|x| x.to_i})
+ puts "Got result #{new_population[-1].genome}"
+ end
+# game_input = (players.collect {|p| p.genome.to_s}).join("\n")
+# game_result = ''
+# puts "Calling game #{i} with input #{game_input}"
+# status, game_result, stderr = systemu 'ruby play-one-game.rb', 'stdin' => game_input
+# puts "Game #{i} returned #{game_result}"
+# new_population << Genome.new(game_result.chomp.split(//).collect {|x| x.to_i})
+ end
+ threads.each {|t| t.join}
+ end
+
+ pop.individuals = new_population
+
+ finish = Time.now
+ puts "Took #{finish - start} seconds"
+ pop1 = pop.crossover(0.7)
+ pop = pop1.mutation(0.05)
+ generation_count += 1
+ puts "Generation number #{generation_count}"
+ pop.individuals.sort {|x, y| x.genome <=> y.genome}.each {|i| puts "#{i.genome}"}
+ $stdout.flush
+end
\ No newline at end of file
--- /dev/null
+# vim: ts=2:sw=2:sts=2:et:fdm=marker
+require 'tmpdir'
+require 'socket'
+require 'fileutils'
+require 'rbconfig'
+require 'thread'
+require 'yaml'
+
+class Object
+ def systemu(*a, &b) SystemUniversal.new(*a, &b).systemu end
+end
+
+class SystemUniversal
+#
+# constants
+#
+ SystemUniversal::VERSION = '1.2.0' unless defined? SystemUniversal::VERSION
+ def version() SystemUniversal::VERSION end
+#
+# class methods
+#
+
+ @host = Socket.gethostname
+ @ppid = Process.ppid
+ @pid = Process.pid
+ @turd = ENV['SYSTEMU_TURD']
+
+ c = ::Config::CONFIG
+ ruby = File.join(c['bindir'], c['ruby_install_name']) << c['EXEEXT']
+ @ruby = if system('%s -e 42' % ruby)
+ ruby
+ else
+ system('%s -e 42' % 'ruby') ? 'ruby' : warn('no ruby in PATH/CONFIG')
+ end
+
+ class << self
+ %w( host ppid pid ruby turd ).each{|a| attr_accessor a}
+ end
+
+#
+# instance methods
+#
+
+ def initialize argv, opts = {}, &block
+ getopt = getopts opts
+
+ @argv = argv
+ @block = block
+
+ @stdin = getopt[ ['stdin', 'in', '0', 0] ]
+ @stdout = getopt[ ['stdout', 'out', '1', 1] ]
+ @stderr = getopt[ ['stderr', 'err', '2', 2] ]
+ @env = getopt[ 'env' ]
+ @cwd = getopt[ 'cwd' ]
+
+ @host = getopt[ 'host', self.class.host ]
+ @ppid = getopt[ 'ppid', self.class.ppid ]
+ @pid = getopt[ 'pid', self.class.pid ]
+ @ruby = getopt[ 'ruby', self.class.ruby ]
+ end
+
+ def systemu
+ tmpdir do |tmp|
+ c = child_setup tmp
+ status = nil
+
+ begin
+ thread = nil
+
+ quietly{
+ IO.popen "#{ @ruby } #{ c['program'] }", 'r+' do |pipe|
+ line = pipe.gets
+ case line
+ when %r/^pid: \d+$/
+ cid = Integer line[%r/\d+/]
+ else
+ begin
+ buf = pipe.read
+ buf = "#{ line }#{ buf }"
+ e = Marshal.load buf
+ raise unless Exception === e
+ raise e
+ rescue
+ raise "wtf?\n#{ buf }\n"
+ end
+ end
+ thread = new_thread cid, @block if @block
+ pipe.read rescue nil
+ end
+ }
+ status = $?
+ ensure
+ if thread
+ begin
+ class << status
+ attr 'thread'
+ end
+ status.instance_eval{ @thread = thread }
+ rescue
+ 42
+ end
+ end
+ end
+
+ if @stdout or @stderr
+ open(c['stdout']){|f| relay f => @stdout} if @stdout
+ open(c['stderr']){|f| relay f => @stderr} if @stderr
+ status
+ else
+ [status, IO.read(c['stdout']), IO.read(c['stderr'])]
+ end
+ end
+ end
+
+ def new_thread cid, block
+ q = Queue.new
+ Thread.new(cid) do |cid|
+ current = Thread.current
+ current.abort_on_exception = true
+ q.push current
+ block.call cid
+ end
+ q.pop
+ end
+
+ def child_setup tmp
+ stdin = File.expand_path(File.join(tmp, 'stdin'))
+ stdout = File.expand_path(File.join(tmp, 'stdout'))
+ stderr = File.expand_path(File.join(tmp, 'stderr'))
+ program = File.expand_path(File.join(tmp, 'program'))
+ config = File.expand_path(File.join(tmp, 'config'))
+
+ if @stdin
+ open(stdin, 'w'){|f| relay @stdin => f}
+ else
+ FileUtils.touch stdin
+ end
+ FileUtils.touch stdout
+ FileUtils.touch stderr
+
+ c = {}
+ c['argv'] = @argv
+ c['env'] = @env
+ c['cwd'] = @cwd
+ c['stdin'] = stdin
+ c['stdout'] = stdout
+ c['stderr'] = stderr
+ c['program'] = program
+ open(config, 'w'){|f| YAML.dump c, f}
+
+ open(program, 'w'){|f| f.write child_program(config)}
+
+ c
+ end
+
+ def quietly
+ v = $VERBOSE
+ $VERBOSE = nil
+ yield
+ ensure
+ $VERBOSE = v
+ end
+
+ def child_program config
+ <<-program
+ PIPE = STDOUT.dup
+ begin
+ require 'yaml'
+
+ config = YAML.load(IO.read('#{ config }'))
+
+ argv = config['argv']
+ env = config['env']
+ cwd = config['cwd']
+ stdin = config['stdin']
+ stdout = config['stdout']
+ stderr = config['stderr']
+
+ Dir.chdir cwd if cwd
+ env.each{|k,v| ENV[k.to_s] = v.to_s} if env
+
+ STDIN.reopen stdin
+ STDOUT.reopen stdout
+ STDERR.reopen stderr
+
+ PIPE.puts "pid: \#{ Process.pid }"
+ PIPE.flush ### the process is ready yo!
+ PIPE.close
+
+ exec *argv
+ rescue Exception => e
+ PIPE.write Marshal.dump(e) rescue nil
+ exit 42
+ end
+ program
+ end
+
+ def relay srcdst
+ src, dst, ignored = srcdst.to_a.first
+ if src.respond_to? 'read'
+ while((buf = src.read(8192))); dst << buf; end
+ else
+ src.each{|buf| dst << buf}
+ end
+ end
+
+ def tmpdir d = Dir.tmpdir, max = 42, &b
+ i = -1 and loop{
+ i += 1
+
+ tmp = File.join d, "systemu_#{ @host }_#{ @ppid }_#{ @pid }_#{ rand }_#{ i += 1 }"
+
+ begin
+ Dir.mkdir tmp
+ rescue Errno::EEXIST
+ raise if i >= max
+ next
+ end
+
+ break(
+ if b
+ begin
+ b.call tmp
+ ensure
+ FileUtils.rm_rf tmp unless SystemU.turd
+ end
+ else
+ tmp
+ end
+ )
+ }
+ end
+
+ def getopts opts = {}
+ lambda do |*args|
+ keys, default, ignored = args
+ catch('opt') do
+ [keys].flatten.each do |key|
+ [key, key.to_s, key.to_s.intern].each do |key|
+ throw 'opt', opts[key] if opts.has_key?(key)
+ end
+ end
+ default
+ end
+ end
+ end
+end
+
+SystemU = SystemUniversal unless defined? SystemU
+
+
+
+
+
+
+
+
+
+
+
+
+
+if $0 == __FILE__
+#
+# date
+#
+ date = %q( ruby -e" t = Time.now; STDOUT.puts t; STDERR.puts t " )
+
+ status, stdout, stderr = systemu date
+ p [status, stdout, stderr]
+
+ status = systemu date, 1=>(stdout = '')
+ p [status, stdout]
+
+ status = systemu date, 2=>(stderr = '')
+ p [status, stderr]
+#
+# sleep
+#
+ sleep = %q( ruby -e" p(sleep(1)) " )
+ status, stdout, stderr = systemu sleep
+ p [status, stdout, stderr]
+
+ sleep = %q( ruby -e" p(sleep(42)) " )
+ status, stdout, stderr = systemu(sleep){|cid| Process.kill 9, cid}
+ p [status, stdout, stderr]
+#
+# env
+#
+ env = %q( ruby -e" p ENV['A'] " )
+ status, stdout, stderr = systemu env, :env => {'A' => 42}
+ p [status, stdout, stderr]
+#
+# cwd
+#
+ env = %q( ruby -e" p Dir.pwd " )
+ status, stdout, stderr = systemu env, :cwd => Dir.tmpdir
+ p [status, stdout, stderr]
+end
--- /dev/null
+== TrapTheCap
+
+You should document your project here.
--- /dev/null
+#
+# To change this template, choose Tools | Templates
+# and open the template in the editor.
+
+
+require 'rake'
+require 'rake/testtask'
+require 'rake/rdoctask'
--- /dev/null
+K 25
+svn:wc:ra_dav:version-url
+V 42
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc
+END
+fr_file_index.html
+K 25
+svn:wc:ra_dav:version-url
+V 61
+/svn/njae/!svn/ver/27/TrapTheCap/trunk/doc/fr_file_index.html
+END
+fr_method_index.html
+K 25
+svn:wc:ra_dav:version-url
+V 63
+/svn/njae/!svn/ver/27/TrapTheCap/trunk/doc/fr_method_index.html
+END
+created.rid
+K 25
+svn:wc:ra_dav:version-url
+V 54
+/svn/njae/!svn/ver/27/TrapTheCap/trunk/doc/created.rid
+END
+fr_class_index.html
+K 25
+svn:wc:ra_dav:version-url
+V 62
+/svn/njae/!svn/ver/27/TrapTheCap/trunk/doc/fr_class_index.html
+END
+index.html
+K 25
+svn:wc:ra_dav:version-url
+V 53
+/svn/njae/!svn/ver/27/TrapTheCap/trunk/doc/index.html
+END
+rdoc-style.css
+K 25
+svn:wc:ra_dav:version-url
+V 57
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/rdoc-style.css
+END
--- /dev/null
+8
+
+dir
+68
+http://scripts.njae.me.uk/svn/njae/TrapTheCap/trunk/doc
+http://scripts.njae.me.uk/svn/njae
+
+
+
+2008-10-16T14:11:23.436422Z
+41
+neil
+
+
+svn:special svn:externals svn:needs-lock
+
+
+
+
+
+
+
+
+
+
+
+0ada9808-85ab-4924-adda-5bf89eae3818
+\f
+fr_file_index.html
+file
+
+
+
+
+2008-04-23T19:33:08.000000Z
+d9df6971ec6f53c0482a1c8fe43d8436
+2008-04-23T19:36:22.892674Z
+27
+neil
+\f
+fr_method_index.html
+file
+
+
+
+
+2008-04-23T19:33:08.000000Z
+1a085831442a15f6af6f0c2d9c84c3fa
+2008-04-23T19:36:22.892674Z
+27
+neil
+\f
+files
+dir
+\f
+created.rid
+file
+
+
+
+
+2008-04-23T19:33:08.000000Z
+b0cccc2d369ec6e66e8f701185d7fa58
+2008-04-23T19:36:22.892674Z
+27
+neil
+\f
+fr_class_index.html
+file
+
+
+
+
+2008-04-23T19:33:08.000000Z
+83a238a1e55110f86717564e822b3b35
+2008-04-23T19:36:22.892674Z
+27
+neil
+\f
+index.html
+file
+
+
+
+
+2008-04-23T19:33:08.000000Z
+d3e476b2ab35951a8169d146ba68fb3d
+2008-04-23T19:36:22.892674Z
+27
+neil
+\f
+rdoc-style.css
+file
+
+
+
+
+2008-03-25T12:43:37.000000Z
+07cc32aa3b88f9911fe43613a29650a3
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+classes
+dir
+\f
--- /dev/null
+Wed, 23 Apr 2008 20:33:07 +0100
--- /dev/null
+
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<!--
+
+ Classes
+
+ -->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Classes</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="rdoc-style.css" type="text/css" />
+ <base target="docwin" />
+</head>
+<body>
+<div id="index">
+ <h1 class="section-bar">Classes</h1>
+ <div id="index-entries">
+ <a href="classes/Array.html">Array</a><br />
+ <a href="classes/Fixnum.html">Fixnum</a><br />
+ <a href="classes/GameHandler.html">GameHandler</a><br />
+ <a href="classes/Genome.html">Genome</a><br />
+ <a href="classes/Population.html">Population</a><br />
+ <a href="classes/Potential_player.html">Potential_player</a><br />
+ </div>
+</div>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<!--
+
+ Files
+
+ -->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Files</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="rdoc-style.css" type="text/css" />
+ <base target="docwin" />
+</head>
+<body>
+<div id="index">
+ <h1 class="section-bar">Files</h1>
+ <div id="index-entries">
+ <a href="files/lib/libgenetics_rb.html">lib/libgenetics.rb</a><br />
+ <a href="files/lib/libpplayer_rb.html">lib/libpplayer.rb</a><br />
+ <a href="files/src/play_rb.html">src/play.rb</a><br />
+ <a href="files/src/selection_rb.html">src/selection.rb</a><br />
+ </div>
+</div>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<!--
+
+ Methods
+
+ -->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Methods</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="rdoc-style.css" type="text/css" />
+ <base target="docwin" />
+</head>
+<body>
+<div id="index">
+ <h1 class="section-bar">Methods</h1>
+ <div id="index-entries">
+ <a href="classes/Potential_player.html#M000007">best_move (Potential_player)</a><br />
+ <a href="classes/Population.html#M000019">crossover (Population)</a><br />
+ <a href="classes/Genome.html#M000004">crossover (Genome)</a><br />
+ <a href="classes/Array.html#M000015">gray_decode (Array)</a><br />
+ <a href="classes/Array.html#M000014">gray_encode (Array)</a><br />
+ <a href="classes/Population.html#M000021">make_next_generation (Population)</a><br />
+ <a href="classes/Genome.html#M000002">mutate (Genome)</a><br />
+ <a href="classes/Genome.html#M000003">mutate! (Genome)</a><br />
+ <a href="classes/Population.html#M000020">mutation (Population)</a><br />
+ <a href="classes/GameHandler.html#M000011">new (GameHandler)</a><br />
+ <a href="classes/Population.html#M000018">new (Population)</a><br />
+ <a href="classes/Potential_player.html#M000006">new (Potential_player)</a><br />
+ <a href="classes/Genome.html#M000001">new (Genome)</a><br />
+ <a href="classes/GameHandler.html#M000012">play (GameHandler)</a><br />
+ <a href="classes/Potential_player.html#M000008">score_position (Potential_player)</a><br />
+ <a href="classes/Fixnum.html#M000022">to_bitstring (Fixnum)</a><br />
+ <a href="classes/Potential_player.html#M000009">to_bitstring (Potential_player)</a><br />
+ <a href="classes/Array.html#M000013">to_decimal (Array)</a><br />
+ <a href="classes/Potential_player.html#M000010">to_genome (Potential_player)</a><br />
+ <a href="classes/Genome.html#M000005">to_potential_player (Genome)</a><br />
+ <a href="classes/Population.html#M000016">tournament_select_one (Population)</a><br />
+ <a href="classes/Population.html#M000017">tournament_select_population (Population)</a><br />
+ </div>
+</div>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
+
+<!--
+
+ RDoc Documentation
+
+ -->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>RDoc Documentation</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+</head>
+<frameset rows="20%, 80%">
+ <frameset cols="25%,35%,45%">
+ <frame src="fr_file_index.html" title="Files" name="Files" />
+ <frame src="fr_class_index.html" name="Classes" />
+ <frame src="fr_method_index.html" name="Methods" />
+ </frameset>
+ <frame src="files/src/play_rb.html" name="docwin" />
+</frameset>
+</html>
\ No newline at end of file
--- /dev/null
+
+body {
+ font-family: Verdana,Arial,Helvetica,sans-serif;
+ font-size: 90%;
+ margin: 0;
+ margin-left: 40px;
+ padding: 0;
+ background: white;
+}
+
+h1,h2,h3,h4 { margin: 0; color: #efefef; background: transparent; }
+h1 { font-size: 150%; }
+h2,h3,h4 { margin-top: 1em; }
+
+a { background: #eef; color: #039; text-decoration: none; }
+a:hover { background: #039; color: #eef; }
+
+/* Override the base stylesheet's Anchor inside a table cell */
+td > a {
+ background: transparent;
+ color: #039;
+ text-decoration: none;
+}
+
+/* and inside a section title */
+.section-title > a {
+ background: transparent;
+ color: #eee;
+ text-decoration: none;
+}
+
+/* === Structural elements =================================== */
+
+div#index {
+ margin: 0;
+ margin-left: -40px;
+ padding: 0;
+ font-size: 90%;
+}
+
+
+div#index a {
+ margin-left: 0.7em;
+}
+
+div#index .section-bar {
+ margin-left: 0px;
+ padding-left: 0.7em;
+ background: #ccc;
+ font-size: small;
+}
+
+
+div#classHeader, div#fileHeader {
+ width: auto;
+ color: white;
+ padding: 0.5em 1.5em 0.5em 1.5em;
+ margin: 0;
+ margin-left: -40px;
+ border-bottom: 3px solid #006;
+}
+
+div#classHeader a, div#fileHeader a {
+ background: inherit;
+ color: white;
+}
+
+div#classHeader td, div#fileHeader td {
+ background: inherit;
+ color: white;
+}
+
+
+div#fileHeader {
+ background: #057;
+}
+
+div#classHeader {
+ background: #048;
+}
+
+
+.class-name-in-header {
+ font-size: 180%;
+ font-weight: bold;
+}
+
+
+div#bodyContent {
+ padding: 0 1.5em 0 1.5em;
+}
+
+div#description {
+ padding: 0.5em 1.5em;
+ background: #efefef;
+ border: 1px dotted #999;
+}
+
+div#description h1,h2,h3,h4,h5,h6 {
+ color: #125;;
+ background: transparent;
+}
+
+div#validator-badges {
+ text-align: center;
+}
+div#validator-badges img { border: 0; }
+
+div#copyright {
+ color: #333;
+ background: #efefef;
+ font: 0.75em sans-serif;
+ margin-top: 5em;
+ margin-bottom: 0;
+ padding: 0.5em 2em;
+}
+
+
+/* === Classes =================================== */
+
+table.header-table {
+ color: white;
+ font-size: small;
+}
+
+.type-note {
+ font-size: small;
+ color: #DEDEDE;
+}
+
+.xxsection-bar {
+ background: #eee;
+ color: #333;
+ padding: 3px;
+}
+
+.section-bar {
+ color: #333;
+ border-bottom: 1px solid #999;
+ margin-left: -20px;
+}
+
+
+.section-title {
+ background: #79a;
+ color: #eee;
+ padding: 3px;
+ margin-top: 2em;
+ margin-left: -30px;
+ border: 1px solid #999;
+}
+
+.top-aligned-row { vertical-align: top }
+.bottom-aligned-row { vertical-align: bottom }
+
+/* --- Context section classes ----------------------- */
+
+.context-row { }
+.context-item-name { font-family: monospace; font-weight: bold; color: black; }
+.context-item-value { font-size: small; color: #448; }
+.context-item-desc { color: #333; padding-left: 2em; }
+
+/* --- Method classes -------------------------- */
+.method-detail {
+ background: #efefef;
+ padding: 0;
+ margin-top: 0.5em;
+ margin-bottom: 1em;
+ border: 1px dotted #ccc;
+}
+.method-heading {
+ color: black;
+ background: #ccc;
+ border-bottom: 1px solid #666;
+ padding: 0.2em 0.5em 0 0.5em;
+}
+.method-signature { color: black; background: inherit; }
+.method-name { font-weight: bold; }
+.method-args { font-style: italic; }
+.method-description { padding: 0 0.5em 0 0.5em; }
+
+/* --- Source code sections -------------------- */
+
+a.source-toggle { font-size: 90%; }
+div.method-source-code {
+ background: #262626;
+ color: #ffdead;
+ margin: 1em;
+ padding: 0.5em;
+ border: 1px dashed #999;
+ overflow: hidden;
+}
+
+div.method-source-code pre { color: #ffdead; overflow: hidden; }
+
+/* --- Ruby keyword styles --------------------- */
+
+.standalone-code { background: #221111; color: #ffdead; overflow: hidden; }
+
+.ruby-constant { color: #7fffd4; background: transparent; }
+.ruby-keyword { color: #00ffff; background: transparent; }
+.ruby-ivar { color: #eedd82; background: transparent; }
+.ruby-operator { color: #00ffee; background: transparent; }
+.ruby-identifier { color: #ffdead; background: transparent; }
+.ruby-node { color: #ffa07a; background: transparent; }
+.ruby-comment { color: #b22222; font-weight: bold; background: transparent; }
+.ruby-regexp { color: #ffa07a; background: transparent; }
+.ruby-value { color: #7fffd4; background: transparent; }
\ No newline at end of file
--- /dev/null
+K 25
+svn:wc:ra_dav:version-url
+V 50
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes
+END
+Array.html
+K 25
+svn:wc:ra_dav:version-url
+V 61
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Array.html
+END
+GameWonInHistoryError.html
+K 25
+svn:wc:ra_dav:version-url
+V 77
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/classes/GameWonInHistoryError.html
+END
+InvalidCaptureError.html
+K 25
+svn:wc:ra_dav:version-url
+V 75
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/classes/InvalidCaptureError.html
+END
+Piece.html
+K 25
+svn:wc:ra_dav:version-url
+V 61
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Piece.html
+END
+Board.html
+K 25
+svn:wc:ra_dav:version-url
+V 61
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Board.html
+END
+InvalidMoveError.html
+K 25
+svn:wc:ra_dav:version-url
+V 72
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/classes/InvalidMoveError.html
+END
+Population.html
+K 25
+svn:wc:ra_dav:version-url
+V 66
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Population.html
+END
+GameWonNotice.html
+K 25
+svn:wc:ra_dav:version-url
+V 69
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/classes/GameWonNotice.html
+END
+InvalidMoveInHistoryError.html
+K 25
+svn:wc:ra_dav:version-url
+V 81
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/classes/InvalidMoveInHistoryError.html
+END
+Position.html
+K 25
+svn:wc:ra_dav:version-url
+V 64
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Position.html
+END
+Fixnum.html
+K 25
+svn:wc:ra_dav:version-url
+V 62
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Fixnum.html
+END
+String.html
+K 25
+svn:wc:ra_dav:version-url
+V 62
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/String.html
+END
+InvalidRobotError.html
+K 25
+svn:wc:ra_dav:version-url
+V 73
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/classes/InvalidRobotError.html
+END
+Move.html
+K 25
+svn:wc:ra_dav:version-url
+V 60
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Move.html
+END
+NoInputFileError.html
+K 25
+svn:wc:ra_dav:version-url
+V 72
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/classes/NoInputFileError.html
+END
+IO.html
+K 25
+svn:wc:ra_dav:version-url
+V 58
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/IO.html
+END
+GameHandler.html
+K 25
+svn:wc:ra_dav:version-url
+V 67
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/GameHandler.html
+END
+GameTest.html
+K 25
+svn:wc:ra_dav:version-url
+V 64
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/GameTest.html
+END
+Game.html
+K 25
+svn:wc:ra_dav:version-url
+V 60
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Game.html
+END
+GameState.html
+K 25
+svn:wc:ra_dav:version-url
+V 65
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/GameState.html
+END
+Genome.html
+K 25
+svn:wc:ra_dav:version-url
+V 62
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Genome.html
+END
+Potential_player.html
+K 25
+svn:wc:ra_dav:version-url
+V 72
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Potential_player.html
+END
--- /dev/null
+8
+
+dir
+68
+http://scripts.njae.me.uk/svn/njae/TrapTheCap/trunk/doc/classes
+http://scripts.njae.me.uk/svn/njae
+
+
+
+2008-10-16T14:11:23.436422Z
+41
+neil
+
+
+svn:special svn:externals svn:needs-lock
+
+
+
+
+
+
+
+
+
+
+
+0ada9808-85ab-4924-adda-5bf89eae3818
+\f
+Population.src
+dir
+\f
+Array.html
+file
+
+
+
+
+2008-04-23T19:33:08.000000Z
+26b3b2bd12f11b95f54fcce6db73b47a
+2008-10-16T14:11:23.436422Z
+41
+\f
+GameWonInHistoryError.html
+file
+
+
+
+
+2008-03-25T11:48:00.000000Z
+f43593c452c84e51cf4e62d5738d2e08
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+InvalidCaptureError.html
+file
+
+
+
+
+2008-03-25T12:43:37.000000Z
+bbd86f1b1971cfd97ed5b058377a3869
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+Board.html
+file
+
+
+
+
+2008-03-28T15:44:42.000000Z
+72da0a082ed92be30d7e992745a0480d
+2008-10-16T14:11:23.436422Z
+41
+neil
+\f
+Position.src
+dir
+\f
+Fixnum.src
+dir
+\f
+String.src
+dir
+\f
+Genome.src
+dir
+\f
+GameWonNotice.html
+file
+
+
+
+
+2008-03-25T12:43:37.000000Z
+332eba20be7511005e22f5f01ca6faf5
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+Array.src
+dir
+\f
+InvalidRobotError.html
+file
+
+
+
+
+2008-03-25T11:48:00.000000Z
+46d5abef635a1aa02f9c4859ad94b4c3
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+Move.html
+file
+
+
+
+
+2008-03-28T15:44:42.000000Z
+463b73125f1c32b9e6a592818d38890b
+2008-10-16T14:11:23.436422Z
+41
+neil
+\f
+Piece.src
+dir
+\f
+GameState.html
+file
+
+
+
+
+2008-03-28T15:44:42.000000Z
+f14a4e9cabcc1fb062a8cd471b5a6be6
+2008-10-16T14:11:23.436422Z
+41
+neil
+\f
+Piece.html
+file
+
+
+
+
+2008-03-28T15:44:42.000000Z
+6b11191e3b5e3ef0eaf4fe36cad43812
+2008-10-16T14:11:23.436422Z
+41
+neil
+\f
+InvalidMoveError.html
+file
+
+
+
+
+2008-03-25T12:43:37.000000Z
+3c00b961119ca2812c61cafcadc36f67
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+Move.src
+dir
+\f
+IO.src
+dir
+\f
+GameHandler.src
+dir
+\f
+Population.html
+file
+
+
+
+
+2008-04-23T19:33:08.000000Z
+ff38b0da69ec518f6f4022971dd47ac9
+2008-10-16T14:11:23.436422Z
+41
+\f
+Game.src
+dir
+\f
+GameTest.src
+dir
+\f
+GameState.src
+dir
+\f
+Potential_player.src
+dir
+\f
+InvalidMoveInHistoryError.html
+file
+
+
+
+
+2008-03-25T11:48:00.000000Z
+01e22991cb33522bab7219decf57a4cf
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+Position.html
+file
+
+
+
+
+2008-03-28T15:44:42.000000Z
+9b00d1c61cce99489bc88976682e7c0b
+2008-10-16T14:11:23.436422Z
+41
+neil
+\f
+Fixnum.html
+file
+
+
+
+
+2008-04-23T19:33:08.000000Z
+0a520ee31fa6d1653d81cbb1435bfc91
+2008-10-16T14:11:23.436422Z
+41
+\f
+String.html
+file
+
+
+
+
+2008-03-28T15:44:42.000000Z
+4096019548a8f5bd51ff6a68321876f9
+2008-10-16T14:11:23.436422Z
+41
+neil
+\f
+NoInputFileError.html
+file
+
+
+
+
+2008-03-25T11:48:00.000000Z
+66fd610fc6c5b6a79e3f5dd0f6d20fac
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+GameHandler.html
+file
+
+
+
+
+2008-04-23T19:33:08.000000Z
+504212682c4aee8c7d4d557c90dbcd3e
+2008-10-16T14:11:23.436422Z
+41
+\f
+IO.html
+file
+
+
+
+
+2008-03-28T15:44:42.000000Z
+ba16c7a024d72969f3df04c9749a788c
+2008-10-16T14:11:23.436422Z
+41
+neil
+\f
+Game.html
+file
+
+
+
+
+2008-03-28T15:44:42.000000Z
+c9bd061a736b2a16dafe021554d704ce
+2008-10-16T14:11:23.436422Z
+41
+neil
+\f
+GameTest.html
+file
+
+
+
+
+2008-03-28T15:44:42.000000Z
+c7123d7f248384c7db0330ce33e8c2ed
+2008-10-16T14:11:23.436422Z
+41
+neil
+\f
+Board.src
+dir
+\f
+Genome.html
+file
+
+
+
+
+2008-04-23T19:33:08.000000Z
+9055b137b7b63d0304a000d45a5fb49a
+2008-10-16T14:11:23.436422Z
+41
+\f
+Potential_player.html
+file
+
+
+
+
+2008-04-23T19:33:08.000000Z
+709b3f794da92de66d4e59fbeb9d4449
+2008-10-16T14:11:23.436422Z
+41
+\f
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Class: Array</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="classHeader">
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Class</strong></td>
+ <td class="class-name-in-header">Array</td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>In:</strong></td>
+ <td>
+ <a href="../files/lib/libgenetics_rb.html">
+ lib/libgenetics.rb
+ </a>
+ <br />
+ </td>
+ </tr>
+
+ <tr class="top-aligned-row">
+ <td><strong>Parent:</strong></td>
+ <td>
+ Object
+ </td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+
+
+ </div>
+
+ <div id="method-list">
+ <h3 class="section-bar">Methods</h3>
+
+ <div class="name-list">
+ <a href="#M000015">gray_decode</a>
+ <a href="#M000014">gray_encode</a>
+ <a href="#M000013">to_decimal</a>
+ </div>
+ </div>
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+ <div id="methods">
+ <h3 class="section-bar">Public Instance methods</h3>
+
+ <div id="method-M000015" class="method-detail">
+ <a name="M000015"></a>
+
+ <div class="method-heading">
+ <a href="Array.src/M000015.html" target="Code" class="method-signature"
+ onclick="popupCode('Array.src/M000015.html');return false;">
+ <span class="method-name">gray_decode</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <div id="method-M000014" class="method-detail">
+ <a name="M000014"></a>
+
+ <div class="method-heading">
+ <a href="Array.src/M000014.html" target="Code" class="method-signature"
+ onclick="popupCode('Array.src/M000014.html');return false;">
+ <span class="method-name">gray_encode</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <div id="method-M000013" class="method-detail">
+ <a name="M000013"></a>
+
+ <div class="method-heading">
+ <a href="Array.src/M000013.html" target="Code" class="method-signature"
+ onclick="popupCode('Array.src/M000013.html');return false;">
+ <span class="method-name">to_decimal</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Class: Board</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="classHeader">
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Class</strong></td>
+ <td class="class-name-in-header">Board</td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>In:</strong></td>
+ <td>
+ <a href="../files/lib/libttc_rb.html">
+ lib/libttc.rb
+ </a>
+ <br />
+ </td>
+ </tr>
+
+ <tr class="top-aligned-row">
+ <td><strong>Parent:</strong></td>
+ <td>
+ Object
+ </td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <p>
+The game board
+</p>
+
+ </div>
+
+
+ </div>
+
+ <div id="method-list">
+ <h3 class="section-bar">Methods</h3>
+
+ <div class="name-list">
+ <a href="#M000058">cache_valid_moves</a>
+ <a href="#M000057">layout</a>
+ <a href="#M000054">new</a>
+ <a href="#M000055">to_s</a>
+ <a href="#M000056">to_str</a>
+ </div>
+ </div>
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+ <div id="attribute-list">
+ <h3 class="section-bar">Attributes</h3>
+
+ <div class="name-list">
+ <table>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">centre</td>
+ <td class="context-item-value"> [R] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">distance_between</td>
+ <td class="context-item-value"> [R] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">positions</td>
+ <td class="context-item-value"> [R] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">valid_moves</td>
+ <td class="context-item-value"> [R] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ </table>
+ </div>
+ </div>
+
+
+
+ <!-- if method_list -->
+ <div id="methods">
+ <h3 class="section-bar">Public Class methods</h3>
+
+ <div id="method-M000054" class="method-detail">
+ <a name="M000054"></a>
+
+ <div class="method-heading">
+ <a href="Board.src/M000054.html" target="Code" class="method-signature"
+ onclick="popupCode('Board.src/M000054.html');return false;">
+ <span class="method-name">new</span><span class="method-args">(spokes, spoke_length, arc_length)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+A laborious procedure to create all the positions and tie them all together
+</p>
+ </div>
+ </div>
+
+ <h3 class="section-bar">Public Instance methods</h3>
+
+ <div id="method-M000058" class="method-detail">
+ <a name="M000058"></a>
+
+ <div class="method-heading">
+ <a href="Board.src/M000058.html" target="Code" class="method-signature"
+ onclick="popupCode('Board.src/M000058.html');return false;">
+ <span class="method-name">cache_valid_moves</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Precompute the valid moves for this board, and the distances between each
+pair of positions
+</p>
+ </div>
+ </div>
+
+ <div id="method-M000057" class="method-detail">
+ <a name="M000057"></a>
+
+ <div class="method-heading">
+ <a href="Board.src/M000057.html" target="Code" class="method-signature"
+ onclick="popupCode('Board.src/M000057.html');return false;">
+ <span class="method-name">layout</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+For each position, show its name and what it touches
+</p>
+ </div>
+ </div>
+
+ <div id="method-M000055" class="method-detail">
+ <a name="M000055"></a>
+
+ <div class="method-heading">
+ <a href="Board.src/M000055.html" target="Code" class="method-signature"
+ onclick="popupCode('Board.src/M000055.html');return false;">
+ <span class="method-name">to_s</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <div id="method-M000056" class="method-detail">
+ <a name="M000056"></a>
+
+ <div class="method-heading">
+ <a href="Board.src/M000056.html" target="Code" class="method-signature"
+ onclick="popupCode('Board.src/M000056.html');return false;">
+ <span class="method-name">to_str</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Class: Fixnum</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="classHeader">
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Class</strong></td>
+ <td class="class-name-in-header">Fixnum</td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>In:</strong></td>
+ <td>
+ <a href="../files/lib/libgenetics_rb.html">
+ lib/libgenetics.rb
+ </a>
+ <br />
+ </td>
+ </tr>
+
+ <tr class="top-aligned-row">
+ <td><strong>Parent:</strong></td>
+ <td>
+ Object
+ </td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+
+
+ </div>
+
+ <div id="method-list">
+ <h3 class="section-bar">Methods</h3>
+
+ <div class="name-list">
+ <a href="#M000022">to_bitstring</a>
+ </div>
+ </div>
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+ <div id="methods">
+ <h3 class="section-bar">Public Instance methods</h3>
+
+ <div id="method-M000022" class="method-detail">
+ <a name="M000022"></a>
+
+ <div class="method-heading">
+ <a href="Fixnum.src/M000022.html" target="Code" class="method-signature"
+ onclick="popupCode('Fixnum.src/M000022.html');return false;">
+ <span class="method-name">to_bitstring</span><span class="method-args">(min_length = 0)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Class: Game</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="classHeader">
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Class</strong></td>
+ <td class="class-name-in-header">Game</td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>In:</strong></td>
+ <td>
+ <a href="../files/lib/libttc_rb.html">
+ lib/libttc.rb
+ </a>
+ <br />
+ </td>
+ </tr>
+
+ <tr class="top-aligned-row">
+ <td><strong>Parent:</strong></td>
+ <td>
+ Object
+ </td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <p>
+A game of Trap the Cap. It keeps a history of all previous states.
+</p>
+
+ </div>
+
+
+ </div>
+
+ <div id="method-list">
+ <h3 class="section-bar">Methods</h3>
+
+ <div class="name-list">
+ <a href="#M000037">apply_move!</a>
+ <a href="#M000039">apply_moves!</a>
+ <a href="#M000042">build_state_string</a>
+ <a href="#M000036">new</a>
+ <a href="#M000040">next_player!</a>
+ <a href="#M000041">possible_moves</a>
+ <a href="#M000046">read_game</a>
+ <a href="#M000043">show_state</a>
+ <a href="#M000044">to_s</a>
+ <a href="#M000045">to_str</a>
+ <a href="#M000038">undo_move!</a>
+ </div>
+ </div>
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+ <div id="attribute-list">
+ <h3 class="section-bar">Attributes</h3>
+
+ <div class="name-list">
+ <table>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">board</td>
+ <td class="context-item-value"> [R] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">current_player</td>
+ <td class="context-item-value"> [R] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">history</td>
+ <td class="context-item-value"> [R] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">pieces</td>
+ <td class="context-item-value"> [R] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">players</td>
+ <td class="context-item-value"> [R] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ </table>
+ </div>
+ </div>
+
+
+
+ <!-- if method_list -->
+ <div id="methods">
+ <h3 class="section-bar">Public Class methods</h3>
+
+ <div id="method-M000036" class="method-detail">
+ <a name="M000036"></a>
+
+ <div class="method-heading">
+ <a href="Game.src/M000036.html" target="Code" class="method-signature"
+ onclick="popupCode('Game.src/M000036.html');return false;">
+ <span class="method-name">new</span><span class="method-args">(players = 6, spokes = 6, spoke_length = 6, arc_length = 6, pieces_each = 6)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Create a <a href="Game.html#M000036">new</a> game
+</p>
+ </div>
+ </div>
+
+ <div id="method-M000046" class="method-detail">
+ <a name="M000046"></a>
+
+ <div class="method-heading">
+ <a href="Game.src/M000046.html" target="Code" class="method-signature"
+ onclick="popupCode('Game.src/M000046.html');return false;">
+ <span class="method-name">read_game</span><span class="method-args">(gamelines)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Given a set of lines from an input file, turn them into a <a
+href="Game.html">Game</a> object and a set of <a href="Move.html">Move</a>
+objects. Note the multiple return values. Class method
+</p>
+ </div>
+ </div>
+
+ <h3 class="section-bar">Public Instance methods</h3>
+
+ <div id="method-M000037" class="method-detail">
+ <a name="M000037"></a>
+
+ <div class="method-heading">
+ <a href="Game.src/M000037.html" target="Code" class="method-signature"
+ onclick="popupCode('Game.src/M000037.html');return false;">
+ <span class="method-name">apply_move!</span><span class="method-args">(move, player = @current_player)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Apply a single move to a game.
+</p>
+ </div>
+ </div>
+
+ <div id="method-M000039" class="method-detail">
+ <a name="M000039"></a>
+
+ <div class="method-heading">
+ <a href="Game.src/M000039.html" target="Code" class="method-signature"
+ onclick="popupCode('Game.src/M000039.html');return false;">
+ <span class="method-name">apply_moves!</span><span class="method-args">(moves)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Apply a list of moves in order
+</p>
+ </div>
+ </div>
+
+ <div id="method-M000042" class="method-detail">
+ <a name="M000042"></a>
+
+ <div class="method-heading">
+ <a href="Game.src/M000042.html" target="Code" class="method-signature"
+ onclick="popupCode('Game.src/M000042.html');return false;">
+ <span class="method-name">build_state_string</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <div id="method-M000040" class="method-detail">
+ <a name="M000040"></a>
+
+ <div class="method-heading">
+ <a href="Game.src/M000040.html" target="Code" class="method-signature"
+ onclick="popupCode('Game.src/M000040.html');return false;">
+ <span class="method-name">next_player!</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Set the current player to be the next player
+</p>
+ </div>
+ </div>
+
+ <div id="method-M000041" class="method-detail">
+ <a name="M000041"></a>
+
+ <div class="method-heading">
+ <a href="Game.src/M000041.html" target="Code" class="method-signature"
+ onclick="popupCode('Game.src/M000041.html');return false;">
+ <span class="method-name">possible_moves</span><span class="method-args">(die_result, player = @current_player)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Return an array of all possible moves from this state, given the die roll
+and the active player
+</p>
+ </div>
+ </div>
+
+ <div id="method-M000043" class="method-detail">
+ <a name="M000043"></a>
+
+ <div class="method-heading">
+ <a href="Game.src/M000043.html" target="Code" class="method-signature"
+ onclick="popupCode('Game.src/M000043.html');return false;">
+ <span class="method-name">show_state</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Show the state of the board
+</p>
+ </div>
+ </div>
+
+ <div id="method-M000044" class="method-detail">
+ <a name="M000044"></a>
+
+ <div class="method-heading">
+ <a href="Game.src/M000044.html" target="Code" class="method-signature"
+ onclick="popupCode('Game.src/M000044.html');return false;">
+ <span class="method-name">to_s</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <div id="method-M000045" class="method-detail">
+ <a name="M000045"></a>
+
+ <div class="method-heading">
+ <a href="Game.src/M000045.html" target="Code" class="method-signature"
+ onclick="popupCode('Game.src/M000045.html');return false;">
+ <span class="method-name">to_str</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <div id="method-M000038" class="method-detail">
+ <a name="M000038"></a>
+
+ <div class="method-heading">
+ <a href="Game.src/M000038.html" target="Code" class="method-signature"
+ onclick="popupCode('Game.src/M000038.html');return false;">
+ <span class="method-name">undo_move!</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Undo a move
+</p>
+ </div>
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Class: GameHandler</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="classHeader">
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Class</strong></td>
+ <td class="class-name-in-header">GameHandler</td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>In:</strong></td>
+ <td>
+ <a href="../files/src/play_rb.html">
+ src/play.rb
+ </a>
+ <br />
+ </td>
+ </tr>
+
+ <tr class="top-aligned-row">
+ <td><strong>Parent:</strong></td>
+ <td>
+ Object
+ </td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <p>
+Play a game to completion, given a set of player agents.
+</p>
+
+ </div>
+
+
+ </div>
+
+ <div id="method-list">
+ <h3 class="section-bar">Methods</h3>
+
+ <div class="name-list">
+ <a href="#M000011">new</a>
+ <a href="#M000012">play</a>
+ </div>
+ </div>
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+ <div id="attribute-list">
+ <h3 class="section-bar">Attributes</h3>
+
+ <div class="name-list">
+ <table>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">game</td>
+ <td class="context-item-value"> [R] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ </table>
+ </div>
+ </div>
+
+
+
+ <!-- if method_list -->
+ <div id="methods">
+ <h3 class="section-bar">Public Class methods</h3>
+
+ <div id="method-M000011" class="method-detail">
+ <a name="M000011"></a>
+
+ <div class="method-heading">
+ <a href="GameHandler.src/M000011.html" target="Code" class="method-signature"
+ onclick="popupCode('GameHandler.src/M000011.html');return false;">
+ <span class="method-name">new</span><span class="method-args">(players, limit = 5000, verbose = false, very_verbose = false)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Create a game handler that uses a set of players
+</p>
+ </div>
+ </div>
+
+ <h3 class="section-bar">Public Instance methods</h3>
+
+ <div id="method-M000012" class="method-detail">
+ <a name="M000012"></a>
+
+ <div class="method-heading">
+ <a href="GameHandler.src/M000012.html" target="Code" class="method-signature"
+ onclick="popupCode('GameHandler.src/M000012.html');return false;">
+ <span class="method-name">play</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Play a game of Trap the Cap. If players make illegal moves, disqualify them
+and restart the game. Terminate the game if there‘s a winner,
+there‘s only one player left, or the game has gone on too long.
+</p>
+ </div>
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Class: GameState</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="classHeader">
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Class</strong></td>
+ <td class="class-name-in-header">GameState</td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>In:</strong></td>
+ <td>
+ <a href="../files/lib/libttc_rb.html">
+ lib/libttc.rb
+ </a>
+ <br />
+ </td>
+ </tr>
+
+ <tr class="top-aligned-row">
+ <td><strong>Parent:</strong></td>
+ <td>
+ Object
+ </td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <p>
+A class to record each of the states previously found in a game. Note that
+this is a deep copy of the pieces and what they‘ve captured, so
+you‘ll need to convert back
+</p>
+
+ </div>
+
+
+ </div>
+
+ <div id="method-list">
+ <h3 class="section-bar">Methods</h3>
+
+ <div class="name-list">
+ <a href="#M000009">==</a>
+ <a href="#M000008">new</a>
+ </div>
+ </div>
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+ <div id="attribute-list">
+ <h3 class="section-bar">Attributes</h3>
+
+ <div class="name-list">
+ <table>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">move</td>
+ <td class="context-item-value"> [RW] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">pieces_after_move</td>
+ <td class="context-item-value"> [RW] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">player</td>
+ <td class="context-item-value"> [RW] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ </table>
+ </div>
+ </div>
+
+
+
+ <!-- if method_list -->
+ <div id="methods">
+ <h3 class="section-bar">Public Class methods</h3>
+
+ <div id="method-M000008" class="method-detail">
+ <a name="M000008"></a>
+
+ <div class="method-heading">
+ <a href="GameState.src/M000008.html" target="Code" class="method-signature"
+ onclick="popupCode('GameState.src/M000008.html');return false;">
+ <span class="method-name">new</span><span class="method-args">(move, player, pieces)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <h3 class="section-bar">Public Instance methods</h3>
+
+ <div id="method-M000009" class="method-detail">
+ <a name="M000009"></a>
+
+ <div class="method-heading">
+ <a href="GameState.src/M000009.html" target="Code" class="method-signature"
+ onclick="popupCode('GameState.src/M000009.html');return false;">
+ <span class="method-name">==</span><span class="method-args">(other)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Class: GameTest</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="classHeader">
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Class</strong></td>
+ <td class="class-name-in-header">GameTest</td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>In:</strong></td>
+ <td>
+ <a href="../files/test/libttc_test_rb.html">
+ test/libttc_test.rb
+ </a>
+ <br />
+ </td>
+ </tr>
+
+ <tr class="top-aligned-row">
+ <td><strong>Parent:</strong></td>
+ <td>
+ Test::Unit::TestCase
+ </td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+
+
+ </div>
+
+ <div id="method-list">
+ <h3 class="section-bar">Methods</h3>
+
+ <div class="name-list">
+ <a href="#M000025">test_apply_moves!</a>
+ <a href="#M000021">test_captures</a>
+ <a href="#M000026">test_eliminations</a>
+ <a href="#M000024">test_game</a>
+ <a href="#M000018">test_game_init</a>
+ <a href="#M000017">test_init</a>
+ <a href="#M000023">test_move_after_captures</a>
+ <a href="#M000022">test_no_captures_on_safe_spaces</a>
+ <a href="#M000020">test_separate_moves</a>
+ <a href="#M000019">test_single_moves_1</a>
+ <a href="#M000027">test_undo_move!</a>
+ </div>
+ </div>
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+ <div id="methods">
+ <h3 class="section-bar">Public Instance methods</h3>
+
+ <div id="method-M000025" class="method-detail">
+ <a name="M000025"></a>
+
+ <div class="method-heading">
+ <a href="GameTest.src/M000025.html" target="Code" class="method-signature"
+ onclick="popupCode('GameTest.src/M000025.html');return false;">
+ <span class="method-name">test_apply_moves!</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <div id="method-M000021" class="method-detail">
+ <a name="M000021"></a>
+
+ <div class="method-heading">
+ <a href="GameTest.src/M000021.html" target="Code" class="method-signature"
+ onclick="popupCode('GameTest.src/M000021.html');return false;">
+ <span class="method-name">test_captures</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <div id="method-M000026" class="method-detail">
+ <a name="M000026"></a>
+
+ <div class="method-heading">
+ <a href="GameTest.src/M000026.html" target="Code" class="method-signature"
+ onclick="popupCode('GameTest.src/M000026.html');return false;">
+ <span class="method-name">test_eliminations</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <div id="method-M000024" class="method-detail">
+ <a name="M000024"></a>
+
+ <div class="method-heading">
+ <a href="GameTest.src/M000024.html" target="Code" class="method-signature"
+ onclick="popupCode('GameTest.src/M000024.html');return false;">
+ <span class="method-name">test_game</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <div id="method-M000018" class="method-detail">
+ <a name="M000018"></a>
+
+ <div class="method-heading">
+ <a href="GameTest.src/M000018.html" target="Code" class="method-signature"
+ onclick="popupCode('GameTest.src/M000018.html');return false;">
+ <span class="method-name">test_game_init</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <div id="method-M000017" class="method-detail">
+ <a name="M000017"></a>
+
+ <div class="method-heading">
+ <a href="GameTest.src/M000017.html" target="Code" class="method-signature"
+ onclick="popupCode('GameTest.src/M000017.html');return false;">
+ <span class="method-name">test_init</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <div id="method-M000023" class="method-detail">
+ <a name="M000023"></a>
+
+ <div class="method-heading">
+ <a href="GameTest.src/M000023.html" target="Code" class="method-signature"
+ onclick="popupCode('GameTest.src/M000023.html');return false;">
+ <span class="method-name">test_move_after_captures</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <div id="method-M000022" class="method-detail">
+ <a name="M000022"></a>
+
+ <div class="method-heading">
+ <a href="GameTest.src/M000022.html" target="Code" class="method-signature"
+ onclick="popupCode('GameTest.src/M000022.html');return false;">
+ <span class="method-name">test_no_captures_on_safe_spaces</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <div id="method-M000020" class="method-detail">
+ <a name="M000020"></a>
+
+ <div class="method-heading">
+ <a href="GameTest.src/M000020.html" target="Code" class="method-signature"
+ onclick="popupCode('GameTest.src/M000020.html');return false;">
+ <span class="method-name">test_separate_moves</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <div id="method-M000019" class="method-detail">
+ <a name="M000019"></a>
+
+ <div class="method-heading">
+ <a href="GameTest.src/M000019.html" target="Code" class="method-signature"
+ onclick="popupCode('GameTest.src/M000019.html');return false;">
+ <span class="method-name">test_single_moves_1</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <div id="method-M000027" class="method-detail">
+ <a name="M000027"></a>
+
+ <div class="method-heading">
+ <a href="GameTest.src/M000027.html" target="Code" class="method-signature"
+ onclick="popupCode('GameTest.src/M000027.html');return false;">
+ <span class="method-name">test_undo_move!</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Class: GameWonInHistoryError</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="classHeader">
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Class</strong></td>
+ <td class="class-name-in-header">GameWonInHistoryError</td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>In:</strong></td>
+ <td>
+ <a href="../files/src/ttc_rb.html">
+ src/ttc.rb
+ </a>
+ <br />
+ </td>
+ </tr>
+
+ <tr class="top-aligned-row">
+ <td><strong>Parent:</strong></td>
+ <td>
+ StandardError
+ </td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+
+
+ </div>
+
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Class: GameWonNotice</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="classHeader">
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Class</strong></td>
+ <td class="class-name-in-header">GameWonNotice</td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>In:</strong></td>
+ <td>
+ <a href="../files/lib/libttc_rb.html">
+ lib/libttc.rb
+ </a>
+ <br />
+ </td>
+ </tr>
+
+ <tr class="top-aligned-row">
+ <td><strong>Parent:</strong></td>
+ <td>
+ StandardError
+ </td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <p>
+<a href="Game.html">Game</a> is won when only one player has uncaptured
+pieces
+</p>
+
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Class: Genome</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="classHeader">
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Class</strong></td>
+ <td class="class-name-in-header">Genome</td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>In:</strong></td>
+ <td>
+ <a href="../files/lib/libgenetics_rb.html">
+ lib/libgenetics.rb
+ </a>
+ <br />
+ <a href="../files/lib/libpplayer_rb.html">
+ lib/libpplayer.rb
+ </a>
+ <br />
+ </td>
+ </tr>
+
+ <tr class="top-aligned-row">
+ <td><strong>Parent:</strong></td>
+ <td>
+ Object
+ </td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <p>
+A single genome in a population
+</p>
+
+ </div>
+
+
+ </div>
+
+ <div id="method-list">
+ <h3 class="section-bar">Methods</h3>
+
+ <div class="name-list">
+ <a href="#M000004">crossover</a>
+ <a href="#M000002">mutate</a>
+ <a href="#M000003">mutate!</a>
+ <a href="#M000001">new</a>
+ <a href="#M000005">to_potential_player</a>
+ </div>
+ </div>
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+ <div id="attribute-list">
+ <h3 class="section-bar">Attributes</h3>
+
+ <div class="name-list">
+ <table>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">genome</td>
+ <td class="context-item-value"> [RW] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ </table>
+ </div>
+ </div>
+
+
+
+ <!-- if method_list -->
+ <div id="methods">
+ <h3 class="section-bar">Public Class methods</h3>
+
+ <div id="method-M000001" class="method-detail">
+ <a name="M000001"></a>
+
+ <div class="method-heading">
+ <a href="Genome.src/M000001.html" target="Code" class="method-signature"
+ onclick="popupCode('Genome.src/M000001.html');return false;">
+ <span class="method-name">new</span><span class="method-args">(bitstring_or_length)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Create a random genome of the given length
+</p>
+ </div>
+ </div>
+
+ <h3 class="section-bar">Public Instance methods</h3>
+
+ <div id="method-M000004" class="method-detail">
+ <a name="M000004"></a>
+
+ <div class="method-heading">
+ <a href="Genome.src/M000004.html" target="Code" class="method-signature"
+ onclick="popupCode('Genome.src/M000004.html');return false;">
+ <span class="method-name">crossover</span><span class="method-args">(other_genome, crossover_point)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Crossover two genomes at the given point
+</p>
+ </div>
+ </div>
+
+ <div id="method-M000002" class="method-detail">
+ <a name="M000002"></a>
+
+ <div class="method-heading">
+ <a href="Genome.src/M000002.html" target="Code" class="method-signature"
+ onclick="popupCode('Genome.src/M000002.html');return false;">
+ <span class="method-name">mutate</span><span class="method-args">(mutation_probability = 0.05)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Mutate a genome with the given rate per bit
+</p>
+ </div>
+ </div>
+
+ <div id="method-M000003" class="method-detail">
+ <a name="M000003"></a>
+
+ <div class="method-heading">
+ <a href="Genome.src/M000003.html" target="Code" class="method-signature"
+ onclick="popupCode('Genome.src/M000003.html');return false;">
+ <span class="method-name">mutate!</span><span class="method-args">(mutation_probability = 0.05)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Mutate a genome in-place with the given rate per bit
+</p>
+ </div>
+ </div>
+
+ <div id="method-M000005" class="method-detail">
+ <a name="M000005"></a>
+
+ <div class="method-heading">
+ <a href="Genome.src/M000005.html" target="Code" class="method-signature"
+ onclick="popupCode('Genome.src/M000005.html');return false;">
+ <span class="method-name">to_potential_player</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Create a potential player from a genome
+</p>
+ </div>
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Class: IO</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="classHeader">
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Class</strong></td>
+ <td class="class-name-in-header">IO</td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>In:</strong></td>
+ <td>
+ <a href="../files/lib/libttc_rb.html">
+ lib/libttc.rb
+ </a>
+ <br />
+ </td>
+ </tr>
+
+ <tr class="top-aligned-row">
+ <td><strong>Parent:</strong></td>
+ <td>
+ Object
+ </td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <p>
+Read a game description file and convert it into a <a
+href="Game.html">Game</a> object and set of <a href="Move.html">Move</a>
+objects. Note that <a href="Game.html#M000046">Game.read_game</a> method
+returns multiple values, so this one does too.
+</p>
+
+ </div>
+
+
+ </div>
+
+ <div id="method-list">
+ <h3 class="section-bar">Methods</h3>
+
+ <div class="name-list">
+ <a href="#M000031">read_game</a>
+ </div>
+ </div>
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+ <div id="methods">
+ <h3 class="section-bar">Public Class methods</h3>
+
+ <div id="method-M000031" class="method-detail">
+ <a name="M000031"></a>
+
+ <div class="method-heading">
+ <a href="IO.src/M000031.html" target="Code" class="method-signature"
+ onclick="popupCode('IO.src/M000031.html');return false;">
+ <span class="method-name">read_game</span><span class="method-args">(filename)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Class: InvalidCaptureError</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="classHeader">
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Class</strong></td>
+ <td class="class-name-in-header">InvalidCaptureError</td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>In:</strong></td>
+ <td>
+ <a href="../files/lib/libttc_rb.html">
+ lib/libttc.rb
+ </a>
+ <br />
+ </td>
+ </tr>
+
+ <tr class="top-aligned-row">
+ <td><strong>Parent:</strong></td>
+ <td>
+ StandardError
+ </td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <p>
+Pieces can only capture pieces that they‘re on.
+</p>
+
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Class: InvalidMoveError</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="classHeader">
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Class</strong></td>
+ <td class="class-name-in-header">InvalidMoveError</td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>In:</strong></td>
+ <td>
+ <a href="../files/lib/libttc_rb.html">
+ lib/libttc.rb
+ </a>
+ <br />
+ </td>
+ </tr>
+
+ <tr class="top-aligned-row">
+ <td><strong>Parent:</strong></td>
+ <td>
+ StandardError
+ </td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <p>
+Moves can only be [1..6] spaces
+</p>
+
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Class: InvalidMoveInHistoryError</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="classHeader">
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Class</strong></td>
+ <td class="class-name-in-header">InvalidMoveInHistoryError</td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>In:</strong></td>
+ <td>
+ <a href="../files/src/ttc_rb.html">
+ src/ttc.rb
+ </a>
+ <br />
+ </td>
+ </tr>
+
+ <tr class="top-aligned-row">
+ <td><strong>Parent:</strong></td>
+ <td>
+ StandardError
+ </td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+
+
+ </div>
+
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Class: InvalidRobotError</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="classHeader">
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Class</strong></td>
+ <td class="class-name-in-header">InvalidRobotError</td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>In:</strong></td>
+ <td>
+ <a href="../files/src/ttc_rb.html">
+ src/ttc.rb
+ </a>
+ <br />
+ </td>
+ </tr>
+
+ <tr class="top-aligned-row">
+ <td><strong>Parent:</strong></td>
+ <td>
+ StandardError
+ </td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+
+
+ </div>
+
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Class: Move</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="classHeader">
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Class</strong></td>
+ <td class="class-name-in-header">Move</td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>In:</strong></td>
+ <td>
+ <a href="../files/lib/libttc_rb.html">
+ lib/libttc.rb
+ </a>
+ <br />
+ </td>
+ </tr>
+
+ <tr class="top-aligned-row">
+ <td><strong>Parent:</strong></td>
+ <td>
+ Object
+ </td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <p>
+A move in a game
+</p>
+
+ </div>
+
+
+ </div>
+
+ <div id="method-list">
+ <h3 class="section-bar">Methods</h3>
+
+ <div class="name-list">
+ <a href="#M000032">new</a>
+ <a href="#M000034">to_s</a>
+ <a href="#M000035">to_str</a>
+ <a href="#M000033">via_base?</a>
+ </div>
+ </div>
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+ <div id="attribute-list">
+ <h3 class="section-bar">Attributes</h3>
+
+ <div class="name-list">
+ <table>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">destination</td>
+ <td class="context-item-value"> [R] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">piece</td>
+ <td class="context-item-value"> [R] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ </table>
+ </div>
+ </div>
+
+
+
+ <!-- if method_list -->
+ <div id="methods">
+ <h3 class="section-bar">Public Class methods</h3>
+
+ <div id="method-M000032" class="method-detail">
+ <a name="M000032"></a>
+
+ <div class="method-heading">
+ <a href="Move.src/M000032.html" target="Code" class="method-signature"
+ onclick="popupCode('Move.src/M000032.html');return false;">
+ <span class="method-name">new</span><span class="method-args">(piece, destination, via_base = false)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <h3 class="section-bar">Public Instance methods</h3>
+
+ <div id="method-M000034" class="method-detail">
+ <a name="M000034"></a>
+
+ <div class="method-heading">
+ <a href="Move.src/M000034.html" target="Code" class="method-signature"
+ onclick="popupCode('Move.src/M000034.html');return false;">
+ <span class="method-name">to_s</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Write a move to a string Note the inverse, <a
+href="String.html#M000053">String#to_move</a>, is defined below
+</p>
+ </div>
+ </div>
+
+ <div id="method-M000035" class="method-detail">
+ <a name="M000035"></a>
+
+ <div class="method-heading">
+ <a href="Move.src/M000035.html" target="Code" class="method-signature"
+ onclick="popupCode('Move.src/M000035.html');return false;">
+ <span class="method-name">to_str</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <div id="method-M000033" class="method-detail">
+ <a name="M000033"></a>
+
+ <div class="method-heading">
+ <a href="Move.src/M000033.html" target="Code" class="method-signature"
+ onclick="popupCode('Move.src/M000033.html');return false;">
+ <span class="method-name">via_base?</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Class: NoInputFileError</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="classHeader">
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Class</strong></td>
+ <td class="class-name-in-header">NoInputFileError</td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>In:</strong></td>
+ <td>
+ <a href="../files/src/ttc_rb.html">
+ src/ttc.rb
+ </a>
+ <br />
+ </td>
+ </tr>
+
+ <tr class="top-aligned-row">
+ <td><strong>Parent:</strong></td>
+ <td>
+ StandardError
+ </td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+
+
+ </div>
+
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Class: Piece</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="classHeader">
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Class</strong></td>
+ <td class="class-name-in-header">Piece</td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>In:</strong></td>
+ <td>
+ <a href="../files/lib/libttc_rb.html">
+ lib/libttc.rb
+ </a>
+ <br />
+ </td>
+ </tr>
+
+ <tr class="top-aligned-row">
+ <td><strong>Parent:</strong></td>
+ <td>
+ Object
+ </td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <p>
+Each piece on the board is an object
+</p>
+
+ </div>
+
+
+ </div>
+
+ <div id="method-list">
+ <h3 class="section-bar">Methods</h3>
+
+ <div class="name-list">
+ <a href="#M000052">capture</a>
+ <a href="#M000051">move_to</a>
+ <a href="#M000048">name</a>
+ <a href="#M000047">new</a>
+ <a href="#M000049">to_s</a>
+ <a href="#M000050">to_str</a>
+ </div>
+ </div>
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+ <div id="attribute-list">
+ <h3 class="section-bar">Attributes</h3>
+
+ <div class="name-list">
+ <table>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">captured</td>
+ <td class="context-item-value"> [RW] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">colour</td>
+ <td class="context-item-value"> [R] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">contains</td>
+ <td class="context-item-value"> [RW] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">position</td>
+ <td class="context-item-value"> [RW] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ </table>
+ </div>
+ </div>
+
+
+
+ <!-- if method_list -->
+ <div id="methods">
+ <h3 class="section-bar">Public Class methods</h3>
+
+ <div id="method-M000047" class="method-detail">
+ <a name="M000047"></a>
+
+ <div class="method-heading">
+ <a href="Piece.src/M000047.html" target="Code" class="method-signature"
+ onclick="popupCode('Piece.src/M000047.html');return false;">
+ <span class="method-name">new</span><span class="method-args">(number, position, colour)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <h3 class="section-bar">Public Instance methods</h3>
+
+ <div id="method-M000052" class="method-detail">
+ <a name="M000052"></a>
+
+ <div class="method-heading">
+ <a href="Piece.src/M000052.html" target="Code" class="method-signature"
+ onclick="popupCode('Piece.src/M000052.html');return false;">
+ <span class="method-name">capture</span><span class="method-args">(other_piece)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Caputre another piece
+</p>
+ </div>
+ </div>
+
+ <div id="method-M000051" class="method-detail">
+ <a name="M000051"></a>
+
+ <div class="method-heading">
+ <a href="Piece.src/M000051.html" target="Code" class="method-signature"
+ onclick="popupCode('Piece.src/M000051.html');return false;">
+ <span class="method-name">move_to</span><span class="method-args">(new_position)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <div id="method-M000048" class="method-detail">
+ <a name="M000048"></a>
+
+ <div class="method-heading">
+ <a href="Piece.src/M000048.html" target="Code" class="method-signature"
+ onclick="popupCode('Piece.src/M000048.html');return false;">
+ <span class="method-name">name</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <div id="method-M000049" class="method-detail">
+ <a name="M000049"></a>
+
+ <div class="method-heading">
+ <a href="Piece.src/M000049.html" target="Code" class="method-signature"
+ onclick="popupCode('Piece.src/M000049.html');return false;">
+ <span class="method-name">to_s</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <div id="method-M000050" class="method-detail">
+ <a name="M000050"></a>
+
+ <div class="method-heading">
+ <a href="Piece.src/M000050.html" target="Code" class="method-signature"
+ onclick="popupCode('Piece.src/M000050.html');return false;">
+ <span class="method-name">to_str</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Class: Population</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="classHeader">
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Class</strong></td>
+ <td class="class-name-in-header">Population</td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>In:</strong></td>
+ <td>
+ <a href="../files/src/selection_rb.html">
+ src/selection.rb
+ </a>
+ <br />
+ <a href="../files/lib/libgenetics_rb.html">
+ lib/libgenetics.rb
+ </a>
+ <br />
+ </td>
+ </tr>
+
+ <tr class="top-aligned-row">
+ <td><strong>Parent:</strong></td>
+ <td>
+ Object
+ </td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <p>
+A population of genomes
+</p>
+
+ </div>
+
+
+ </div>
+
+ <div id="method-list">
+ <h3 class="section-bar">Methods</h3>
+
+ <div class="name-list">
+ <a href="#M000019">crossover</a>
+ <a href="#M000021">make_next_generation</a>
+ <a href="#M000020">mutation</a>
+ <a href="#M000018">new</a>
+ <a href="#M000016">tournament_select_one</a>
+ <a href="#M000017">tournament_select_population</a>
+ </div>
+ </div>
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+ <div id="attribute-list">
+ <h3 class="section-bar">Attributes</h3>
+
+ <div class="name-list">
+ <table>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">individuals</td>
+ <td class="context-item-value"> [RW] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ </table>
+ </div>
+ </div>
+
+
+
+ <!-- if method_list -->
+ <div id="methods">
+ <h3 class="section-bar">Public Class methods</h3>
+
+ <div id="method-M000018" class="method-detail">
+ <a name="M000018"></a>
+
+ <div class="method-heading">
+ <a href="Population.src/M000018.html" target="Code" class="method-signature"
+ onclick="popupCode('Population.src/M000018.html');return false;">
+ <span class="method-name">new</span><span class="method-args">(population_size, genome_length)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Create a population of a given size
+</p>
+ </div>
+ </div>
+
+ <h3 class="section-bar">Public Instance methods</h3>
+
+ <div id="method-M000019" class="method-detail">
+ <a name="M000019"></a>
+
+ <div class="method-heading">
+ <a href="Population.src/M000019.html" target="Code" class="method-signature"
+ onclick="popupCode('Population.src/M000019.html');return false;">
+ <span class="method-name">crossover</span><span class="method-args">(crossover_rate)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Perform the <a href="Population.html#M000019">crossover</a> step in a
+population, giving a <a href="Population.html#M000018">new</a> population
+</p>
+ </div>
+ </div>
+
+ <div id="method-M000021" class="method-detail">
+ <a name="M000021"></a>
+
+ <div class="method-heading">
+ <a href="Population.src/M000021.html" target="Code" class="method-signature"
+ onclick="popupCode('Population.src/M000021.html');return false;">
+ <span class="method-name">make_next_generation</span><span class="method-args">(tournament_winner_success_rate = 0.8, game_length = 1000, crossover_rate = 0.7, mutation_rate = 0.05)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <div id="method-M000020" class="method-detail">
+ <a name="M000020"></a>
+
+ <div class="method-heading">
+ <a href="Population.src/M000020.html" target="Code" class="method-signature"
+ onclick="popupCode('Population.src/M000020.html');return false;">
+ <span class="method-name">mutation</span><span class="method-args">(mutation_rate)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Perform the <a href="Population.html#M000020">mutation</a> step in a
+population, giving a <a href="Population.html#M000018">new</a> population
+</p>
+ </div>
+ </div>
+
+ <div id="method-M000016" class="method-detail">
+ <a name="M000016"></a>
+
+ <div class="method-heading">
+ <a href="Population.src/M000016.html" target="Code" class="method-signature"
+ onclick="popupCode('Population.src/M000016.html');return false;">
+ <span class="method-name">tournament_select_one</span><span class="method-args">(winner_success_chance = 0.8, max_game_length= 1000, verbose = false)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Use tournament selection to pick an individual for the next generation
+</p>
+ </div>
+ </div>
+
+ <div id="method-M000017" class="method-detail">
+ <a name="M000017"></a>
+
+ <div class="method-heading">
+ <a href="Population.src/M000017.html" target="Code" class="method-signature"
+ onclick="popupCode('Population.src/M000017.html');return false;">
+ <span class="method-name">tournament_select_population</span><span class="method-args">(winner_success_chance = 0.8, max_game_length = 1000, verbose = false)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Select a <a href="Population.html#M000018">new</a> population the same size
+as the current population
+</p>
+ </div>
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Class: Position</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="classHeader">
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Class</strong></td>
+ <td class="class-name-in-header">Position</td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>In:</strong></td>
+ <td>
+ <a href="../files/lib/libttc_rb.html">
+ lib/libttc.rb
+ </a>
+ <br />
+ </td>
+ </tr>
+
+ <tr class="top-aligned-row">
+ <td><strong>Parent:</strong></td>
+ <td>
+ Object
+ </td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <p>
+Each possible position for a piece is an object Each neighbour is another
+position object
+</p>
+
+ </div>
+
+
+ </div>
+
+ <div id="method-list">
+ <h3 class="section-bar">Methods</h3>
+
+ <div class="name-list">
+ <a href="#M000012">base?</a>
+ <a href="#M000010">new</a>
+ <a href="#M000011">safe?</a>
+ <a href="#M000013">to_s</a>
+ <a href="#M000014">to_str</a>
+ </div>
+ </div>
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+ <div id="attribute-list">
+ <h3 class="section-bar">Attributes</h3>
+
+ <div class="name-list">
+ <table>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">contains</td>
+ <td class="context-item-value"> [RW] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">neighbours</td>
+ <td class="context-item-value"> [RW] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">place</td>
+ <td class="context-item-value"> [R] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ </table>
+ </div>
+ </div>
+
+
+
+ <!-- if method_list -->
+ <div id="methods">
+ <h3 class="section-bar">Public Class methods</h3>
+
+ <div id="method-M000010" class="method-detail">
+ <a name="M000010"></a>
+
+ <div class="method-heading">
+ <a href="Position.src/M000010.html" target="Code" class="method-signature"
+ onclick="popupCode('Position.src/M000010.html');return false;">
+ <span class="method-name">new</span><span class="method-args">(place, safety, base)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <h3 class="section-bar">Public Instance methods</h3>
+
+ <div id="method-M000012" class="method-detail">
+ <a name="M000012"></a>
+
+ <div class="method-heading">
+ <a href="Position.src/M000012.html" target="Code" class="method-signature"
+ onclick="popupCode('Position.src/M000012.html');return false;">
+ <span class="method-name">base?</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Is this position a <a href="Position.html#M000012">base?</a>
+</p>
+ </div>
+ </div>
+
+ <div id="method-M000011" class="method-detail">
+ <a name="M000011"></a>
+
+ <div class="method-heading">
+ <a href="Position.src/M000011.html" target="Code" class="method-signature"
+ onclick="popupCode('Position.src/M000011.html');return false;">
+ <span class="method-name">safe?</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+is this position a safety one (i.e. no captures allowed)?
+</p>
+ </div>
+ </div>
+
+ <div id="method-M000013" class="method-detail">
+ <a name="M000013"></a>
+
+ <div class="method-heading">
+ <a href="Position.src/M000013.html" target="Code" class="method-signature"
+ onclick="popupCode('Position.src/M000013.html');return false;">
+ <span class="method-name">to_s</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <div id="method-M000014" class="method-detail">
+ <a name="M000014"></a>
+
+ <div class="method-heading">
+ <a href="Position.src/M000014.html" target="Code" class="method-signature"
+ onclick="popupCode('Position.src/M000014.html');return false;">
+ <span class="method-name">to_str</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Class: Potential_player</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="classHeader">
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Class</strong></td>
+ <td class="class-name-in-header">Potential_player</td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>In:</strong></td>
+ <td>
+ <a href="../files/lib/libpplayer_rb.html">
+ lib/libpplayer.rb
+ </a>
+ <br />
+ </td>
+ </tr>
+
+ <tr class="top-aligned-row">
+ <td><strong>Parent:</strong></td>
+ <td>
+ Object
+ </td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <p>
+Play Trap the Cap by using potential fields. For each possible move,
+calculate the field strength and pick the move with the lowest potential
+</p>
+
+ </div>
+
+
+ </div>
+
+ <div id="method-list">
+ <h3 class="section-bar">Methods</h3>
+
+ <div class="name-list">
+ <a href="#M000007">best_move</a>
+ <a href="#M000006">new</a>
+ <a href="#M000008">score_position</a>
+ <a href="#M000009">to_bitstring</a>
+ <a href="#M000010">to_genome</a>
+ </div>
+ </div>
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+ <div id="attribute-list">
+ <h3 class="section-bar">Attributes</h3>
+
+ <div class="name-list">
+ <table>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">base_pull</td>
+ <td class="context-item-value"> [R] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">capture_bonus</td>
+ <td class="context-item-value"> [R] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">enemy_pull</td>
+ <td class="context-item-value"> [R] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">friend_pull</td>
+ <td class="context-item-value"> [R] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">safe_bonus</td>
+ <td class="context-item-value"> [R] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ </table>
+ </div>
+ </div>
+
+
+
+ <!-- if method_list -->
+ <div id="methods">
+ <h3 class="section-bar">Public Class methods</h3>
+
+ <div id="method-M000006" class="method-detail">
+ <a name="M000006"></a>
+
+ <div class="method-heading">
+ <a href="Potential_player.src/M000006.html" target="Code" class="method-signature"
+ onclick="popupCode('Potential_player.src/M000006.html');return false;">
+ <span class="method-name">new</span><span class="method-args">(args, verbose = false)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <h3 class="section-bar">Public Instance methods</h3>
+
+ <div id="method-M000007" class="method-detail">
+ <a name="M000007"></a>
+
+ <div class="method-heading">
+ <a href="Potential_player.src/M000007.html" target="Code" class="method-signature"
+ onclick="popupCode('Potential_player.src/M000007.html');return false;">
+ <span class="method-name">best_move</span><span class="method-args">(game, die_result)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Find the best move of the possible ones
+</p>
+ </div>
+ </div>
+
+ <div id="method-M000008" class="method-detail">
+ <a name="M000008"></a>
+
+ <div class="method-heading">
+ <a href="Potential_player.src/M000008.html" target="Code" class="method-signature"
+ onclick="popupCode('Potential_player.src/M000008.html');return false;">
+ <span class="method-name">score_position</span><span class="method-args">(game, player)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Calculate the potential score of a position for a given player
+</p>
+ </div>
+ </div>
+
+ <div id="method-M000009" class="method-detail">
+ <a name="M000009"></a>
+
+ <div class="method-heading">
+ <a href="Potential_player.src/M000009.html" target="Code" class="method-signature"
+ onclick="popupCode('Potential_player.src/M000009.html');return false;">
+ <span class="method-name">to_bitstring</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Convert a player to a bitstring
+</p>
+ </div>
+ </div>
+
+ <div id="method-M000010" class="method-detail">
+ <a name="M000010"></a>
+
+ <div class="method-heading">
+ <a href="Potential_player.src/M000010.html" target="Code" class="method-signature"
+ onclick="popupCode('Potential_player.src/M000010.html');return false;">
+ <span class="method-name">to_genome</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Convert a player to a genome
+</p>
+ </div>
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Class: String</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="classHeader">
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Class</strong></td>
+ <td class="class-name-in-header">String</td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>In:</strong></td>
+ <td>
+ <a href="../files/lib/libttc_rb.html">
+ lib/libttc.rb
+ </a>
+ <br />
+ </td>
+ </tr>
+
+ <tr class="top-aligned-row">
+ <td><strong>Parent:</strong></td>
+ <td>
+ Object
+ </td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <p>
+Extension to <a href="String.html">String</a> class to convert a
+move-description string into a <a href="Move.html">Move</a> object. This is
+the inverse of the <a href="Move.html#M000034">Move#to_s</a> method
+</p>
+
+ </div>
+
+
+ </div>
+
+ <div id="method-list">
+ <h3 class="section-bar">Methods</h3>
+
+ <div class="name-list">
+ <a href="#M000053">to_move</a>
+ </div>
+ </div>
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+ <div id="methods">
+ <h3 class="section-bar">Public Instance methods</h3>
+
+ <div id="method-M000053" class="method-detail">
+ <a name="M000053"></a>
+
+ <div class="method-heading">
+ <a href="String.src/M000053.html" target="Code" class="method-signature"
+ onclick="popupCode('String.src/M000053.html');return false;">
+ <span class="method-name">to_move</span><span class="method-args">(game)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Class: Array</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="classHeader">
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Class</strong></td>
+ <td class="class-name-in-header">Array</td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>In:</strong></td>
+ <td>
+ <a href="../files/lib/libgenetics_rb.html">
+ lib/libgenetics.rb
+ </a>
+ <br />
+ </td>
+ </tr>
+
+ <tr class="top-aligned-row">
+ <td><strong>Parent:</strong></td>
+ <td>
+ Object
+ </td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+
+
+ </div>
+
+ <div id="method-list">
+ <h3 class="section-bar">Methods</h3>
+
+ <div class="name-list">
+ <a href="#M000015">gray_decode</a>
+ <a href="#M000014">gray_encode</a>
+ <a href="#M000013">to_decimal</a>
+ </div>
+ </div>
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+ <div id="methods">
+ <h3 class="section-bar">Public Instance methods</h3>
+
+ <div id="method-M000015" class="method-detail">
+ <a name="M000015"></a>
+
+ <div class="method-heading">
+ <a href="Array.src/M000015.html" target="Code" class="method-signature"
+ onclick="popupCode('Array.src/M000015.html');return false;">
+ <span class="method-name">gray_decode</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <div id="method-M000014" class="method-detail">
+ <a name="M000014"></a>
+
+ <div class="method-heading">
+ <a href="Array.src/M000014.html" target="Code" class="method-signature"
+ onclick="popupCode('Array.src/M000014.html');return false;">
+ <span class="method-name">gray_encode</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <div id="method-M000013" class="method-detail">
+ <a name="M000013"></a>
+
+ <div class="method-heading">
+ <a href="Array.src/M000013.html" target="Code" class="method-signature"
+ onclick="popupCode('Array.src/M000013.html');return false;">
+ <span class="method-name">to_decimal</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+K 25
+svn:wc:ra_dav:version-url
+V 60
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Array.src
+END
+M000013.html
+K 25
+svn:wc:ra_dav:version-url
+V 73
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Array.src/M000013.html
+END
+M000005.html
+K 25
+svn:wc:ra_dav:version-url
+V 73
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Array.src/M000005.html
+END
+M000014.html
+K 25
+svn:wc:ra_dav:version-url
+V 73
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Array.src/M000014.html
+END
+M000006.html
+K 25
+svn:wc:ra_dav:version-url
+V 73
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Array.src/M000006.html
+END
+M000015.html
+K 25
+svn:wc:ra_dav:version-url
+V 73
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Array.src/M000015.html
+END
+M000007.html
+K 25
+svn:wc:ra_dav:version-url
+V 73
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Array.src/M000007.html
+END
--- /dev/null
+8
+
+dir
+68
+http://scripts.njae.me.uk/svn/njae/TrapTheCap/trunk/doc/classes/Array.src
+http://scripts.njae.me.uk/svn/njae
+
+
+
+2008-10-16T14:11:23.436422Z
+41
+
+
+
+svn:special svn:externals svn:needs-lock
+\f
+M000013.html
+file
+
+
+
+
+2008-04-23T19:33:07.000000Z
+baa109e01879922b8579d90e8477b359
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000005.html
+file
+
+
+
+
+2008-04-23T19:30:16.000000Z
+54ffa8dd6a5930189670ec82b377a16f
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000014.html
+file
+
+
+
+
+2008-04-23T19:33:07.000000Z
+d5c3211d58ed9c08da6a030da6fffb8c
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000015.html
+file
+
+
+
+
+2008-04-23T19:33:07.000000Z
+86c0658d8f6cc47e238122886f1ea7c6
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000006.html
+file
+
+
+
+
+2008-04-23T19:30:16.000000Z
+377d87bd4a639828465f40da231c77b4
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000007.html
+file
+
+
+
+
+2008-04-23T19:30:16.000000Z
+a9c7f3219152d1a8cf0ea56f8bea6d12
+2008-10-16T14:11:23.436422Z
+41
+\f
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_decimal (Array)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libgenetics.rb, line 71</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_decimal</span>
+ <span class="ruby-identifier">val</span> = <span class="ruby-value">0</span>
+ <span class="ruby-identifier">bits</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span>
+ <span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">bits</span>.<span class="ruby-identifier">empty?</span>
+ <span class="ruby-identifier">val</span> = <span class="ruby-identifier">val</span> <span class="ruby-operator">*</span> <span class="ruby-value">2</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">bits</span>[<span class="ruby-value">0</span>]
+ <span class="ruby-identifier">bits</span> = <span class="ruby-identifier">bits</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-identifier">bits</span>.<span class="ruby-identifier">length</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">val</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>gray_encode (Array)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libgenetics.rb, line 81</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">gray_encode</span>
+ <span class="ruby-identifier">gray</span> = <span class="ruby-keyword kw">self</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">0</span>]
+ (<span class="ruby-value">1</span><span class="ruby-operator">...</span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> (<span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">i</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">1</span>) <span class="ruby-operator">^</span> (<span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">i</span>] <span class="ruby-operator">==</span> <span class="ruby-value">1</span>)
+ <span class="ruby-identifier">gray</span> <span class="ruby-operator"><<</span> <span class="ruby-value">1</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">gray</span> <span class="ruby-operator"><<</span> <span class="ruby-value">0</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">gray</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>gray_decode (Array)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libgenetics.rb, line 93</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">gray_decode</span>
+ <span class="ruby-identifier">binary</span> = <span class="ruby-keyword kw">self</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">0</span>]
+ (<span class="ruby-value">1</span><span class="ruby-operator">...</span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">binary</span>[<span class="ruby-identifier">i</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">1</span>) <span class="ruby-operator">^</span> (<span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">i</span>] <span class="ruby-operator">==</span> <span class="ruby-value">1</span>)
+ <span class="ruby-identifier">binary</span> <span class="ruby-operator"><<</span> <span class="ruby-value">1</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">binary</span> <span class="ruby-operator"><<</span> <span class="ruby-value">0</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">binary</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_decimal (Array)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libgenetics.rb, line 74</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_decimal</span>
+ <span class="ruby-identifier">val</span> = <span class="ruby-value">0</span>
+ <span class="ruby-identifier">bits</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span>
+ <span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">bits</span>.<span class="ruby-identifier">empty?</span>
+ <span class="ruby-identifier">val</span> = <span class="ruby-identifier">val</span> <span class="ruby-operator">*</span> <span class="ruby-value">2</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">bits</span>[<span class="ruby-value">0</span>]
+ <span class="ruby-identifier">bits</span> = <span class="ruby-identifier">bits</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-identifier">bits</span>.<span class="ruby-identifier">length</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">val</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>gray_encode (Array)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libgenetics.rb, line 84</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">gray_encode</span>
+ <span class="ruby-identifier">gray</span> = <span class="ruby-keyword kw">self</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">0</span>]
+ (<span class="ruby-value">1</span><span class="ruby-operator">...</span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> (<span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">i</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">1</span>) <span class="ruby-operator">^</span> (<span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">i</span>] <span class="ruby-operator">==</span> <span class="ruby-value">1</span>)
+ <span class="ruby-identifier">gray</span> <span class="ruby-operator"><<</span> <span class="ruby-value">1</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">gray</span> <span class="ruby-operator"><<</span> <span class="ruby-value">0</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">gray</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>gray_decode (Array)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libgenetics.rb, line 96</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">gray_decode</span>
+ <span class="ruby-identifier">binary</span> = <span class="ruby-keyword kw">self</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">0</span>]
+ (<span class="ruby-value">1</span><span class="ruby-operator">...</span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">binary</span>[<span class="ruby-identifier">i</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">1</span>) <span class="ruby-operator">^</span> (<span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">i</span>] <span class="ruby-operator">==</span> <span class="ruby-value">1</span>)
+ <span class="ruby-identifier">binary</span> <span class="ruby-operator"><<</span> <span class="ruby-value">1</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">binary</span> <span class="ruby-operator"><<</span> <span class="ruby-value">0</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">binary</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_decimal (Array)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libgenetics.rb, line 71</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_decimal</span>
+ <span class="ruby-identifier">val</span> = <span class="ruby-value">0</span>
+ <span class="ruby-identifier">bits</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span>
+ <span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">bits</span>.<span class="ruby-identifier">empty?</span>
+ <span class="ruby-identifier">val</span> = <span class="ruby-identifier">val</span> <span class="ruby-operator">*</span> <span class="ruby-value">2</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">bits</span>[<span class="ruby-value">0</span>]
+ <span class="ruby-identifier">bits</span> = <span class="ruby-identifier">bits</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-identifier">bits</span>.<span class="ruby-identifier">length</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">val</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>gray_encode (Array)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libgenetics.rb, line 81</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">gray_encode</span>
+ <span class="ruby-identifier">gray</span> = <span class="ruby-keyword kw">self</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">0</span>]
+ (<span class="ruby-value">1</span><span class="ruby-operator">...</span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> (<span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">i</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">1</span>) <span class="ruby-operator">^</span> (<span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">i</span>] <span class="ruby-operator">==</span> <span class="ruby-value">1</span>)
+ <span class="ruby-identifier">gray</span> <span class="ruby-operator"><<</span> <span class="ruby-value">1</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">gray</span> <span class="ruby-operator"><<</span> <span class="ruby-value">0</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">gray</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>gray_decode (Array)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libgenetics.rb, line 93</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">gray_decode</span>
+ <span class="ruby-identifier">binary</span> = <span class="ruby-keyword kw">self</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">0</span>]
+ (<span class="ruby-value">1</span><span class="ruby-operator">...</span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">binary</span>[<span class="ruby-identifier">i</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">1</span>) <span class="ruby-operator">^</span> (<span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">i</span>] <span class="ruby-operator">==</span> <span class="ruby-value">1</span>)
+ <span class="ruby-identifier">binary</span> <span class="ruby-operator"><<</span> <span class="ruby-value">1</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">binary</span> <span class="ruby-operator"><<</span> <span class="ruby-value">0</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">binary</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_decimal (Array)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libgenetics.rb, line 74</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_decimal</span>
+ <span class="ruby-identifier">val</span> = <span class="ruby-value">0</span>
+ <span class="ruby-identifier">bits</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span>
+ <span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">bits</span>.<span class="ruby-identifier">empty?</span>
+ <span class="ruby-identifier">val</span> = <span class="ruby-identifier">val</span> <span class="ruby-operator">*</span> <span class="ruby-value">2</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">bits</span>[<span class="ruby-value">0</span>]
+ <span class="ruby-identifier">bits</span> = <span class="ruby-identifier">bits</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-identifier">bits</span>.<span class="ruby-identifier">length</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">val</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>gray_encode (Array)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libgenetics.rb, line 84</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">gray_encode</span>
+ <span class="ruby-identifier">gray</span> = <span class="ruby-keyword kw">self</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">0</span>]
+ (<span class="ruby-value">1</span><span class="ruby-operator">...</span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> (<span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">i</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">1</span>) <span class="ruby-operator">^</span> (<span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">i</span>] <span class="ruby-operator">==</span> <span class="ruby-value">1</span>)
+ <span class="ruby-identifier">gray</span> <span class="ruby-operator"><<</span> <span class="ruby-value">1</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">gray</span> <span class="ruby-operator"><<</span> <span class="ruby-value">0</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">gray</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>gray_decode (Array)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libgenetics.rb, line 96</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">gray_decode</span>
+ <span class="ruby-identifier">binary</span> = <span class="ruby-keyword kw">self</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-value">0</span>]
+ (<span class="ruby-value">1</span><span class="ruby-operator">...</span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">binary</span>[<span class="ruby-identifier">i</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-value">1</span>) <span class="ruby-operator">^</span> (<span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">i</span>] <span class="ruby-operator">==</span> <span class="ruby-value">1</span>)
+ <span class="ruby-identifier">binary</span> <span class="ruby-operator"><<</span> <span class="ruby-value">1</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">binary</span> <span class="ruby-operator"><<</span> <span class="ruby-value">0</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">binary</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Class: Board</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="classHeader">
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Class</strong></td>
+ <td class="class-name-in-header">Board</td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>In:</strong></td>
+ <td>
+ <a href="../files/lib/libttc_rb.html">
+ lib/libttc.rb
+ </a>
+ <br />
+ </td>
+ </tr>
+
+ <tr class="top-aligned-row">
+ <td><strong>Parent:</strong></td>
+ <td>
+ Object
+ </td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <p>
+The game board
+</p>
+
+ </div>
+
+
+ </div>
+
+ <div id="method-list">
+ <h3 class="section-bar">Methods</h3>
+
+ <div class="name-list">
+ <a href="#M000058">cache_valid_moves</a>
+ <a href="#M000057">layout</a>
+ <a href="#M000054">new</a>
+ <a href="#M000055">to_s</a>
+ <a href="#M000056">to_str</a>
+ </div>
+ </div>
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+ <div id="attribute-list">
+ <h3 class="section-bar">Attributes</h3>
+
+ <div class="name-list">
+ <table>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">centre</td>
+ <td class="context-item-value"> [R] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">distance_between</td>
+ <td class="context-item-value"> [R] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">positions</td>
+ <td class="context-item-value"> [R] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">valid_moves</td>
+ <td class="context-item-value"> [R] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ </table>
+ </div>
+ </div>
+
+
+
+ <!-- if method_list -->
+ <div id="methods">
+ <h3 class="section-bar">Public Class methods</h3>
+
+ <div id="method-M000054" class="method-detail">
+ <a name="M000054"></a>
+
+ <div class="method-heading">
+ <a href="Board.src/M000054.html" target="Code" class="method-signature"
+ onclick="popupCode('Board.src/M000054.html');return false;">
+ <span class="method-name">new</span><span class="method-args">(spokes, spoke_length, arc_length)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+A laborious procedure to create all the positions and tie them all together
+</p>
+ </div>
+ </div>
+
+ <h3 class="section-bar">Public Instance methods</h3>
+
+ <div id="method-M000058" class="method-detail">
+ <a name="M000058"></a>
+
+ <div class="method-heading">
+ <a href="Board.src/M000058.html" target="Code" class="method-signature"
+ onclick="popupCode('Board.src/M000058.html');return false;">
+ <span class="method-name">cache_valid_moves</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Precompute the valid moves for this board, and the distances between each
+pair of positions
+</p>
+ </div>
+ </div>
+
+ <div id="method-M000057" class="method-detail">
+ <a name="M000057"></a>
+
+ <div class="method-heading">
+ <a href="Board.src/M000057.html" target="Code" class="method-signature"
+ onclick="popupCode('Board.src/M000057.html');return false;">
+ <span class="method-name">layout</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+For each position, show its name and what it touches
+</p>
+ </div>
+ </div>
+
+ <div id="method-M000055" class="method-detail">
+ <a name="M000055"></a>
+
+ <div class="method-heading">
+ <a href="Board.src/M000055.html" target="Code" class="method-signature"
+ onclick="popupCode('Board.src/M000055.html');return false;">
+ <span class="method-name">to_s</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <div id="method-M000056" class="method-detail">
+ <a name="M000056"></a>
+
+ <div class="method-heading">
+ <a href="Board.src/M000056.html" target="Code" class="method-signature"
+ onclick="popupCode('Board.src/M000056.html');return false;">
+ <span class="method-name">to_str</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+K 25
+svn:wc:ra_dav:version-url
+V 60
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Board.src
+END
+M000024.html
+K 25
+svn:wc:ra_dav:version-url
+V 73
+/svn/njae/!svn/ver/24/TrapTheCap/trunk/doc/classes/Board.src/M000024.html
+END
+M000034.html
+K 25
+svn:wc:ra_dav:version-url
+V 73
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/classes/Board.src/M000034.html
+END
+M000025.html
+K 25
+svn:wc:ra_dav:version-url
+V 73
+/svn/njae/!svn/ver/24/TrapTheCap/trunk/doc/classes/Board.src/M000025.html
+END
+M000035.html
+K 25
+svn:wc:ra_dav:version-url
+V 73
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/classes/Board.src/M000035.html
+END
+M000026.html
+K 25
+svn:wc:ra_dav:version-url
+V 73
+/svn/njae/!svn/ver/24/TrapTheCap/trunk/doc/classes/Board.src/M000026.html
+END
+M000036.html
+K 25
+svn:wc:ra_dav:version-url
+V 73
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/classes/Board.src/M000036.html
+END
+M000027.html
+K 25
+svn:wc:ra_dav:version-url
+V 73
+/svn/njae/!svn/ver/24/TrapTheCap/trunk/doc/classes/Board.src/M000027.html
+END
+M000054.html
+K 25
+svn:wc:ra_dav:version-url
+V 73
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Board.src/M000054.html
+END
+M000037.html
+K 25
+svn:wc:ra_dav:version-url
+V 73
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/classes/Board.src/M000037.html
+END
+M000055.html
+K 25
+svn:wc:ra_dav:version-url
+V 73
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Board.src/M000055.html
+END
+M000056.html
+K 25
+svn:wc:ra_dav:version-url
+V 73
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Board.src/M000056.html
+END
+M000057.html
+K 25
+svn:wc:ra_dav:version-url
+V 73
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Board.src/M000057.html
+END
+M000058.html
+K 25
+svn:wc:ra_dav:version-url
+V 73
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Board.src/M000058.html
+END
--- /dev/null
+8
+
+dir
+68
+http://scripts.njae.me.uk/svn/njae/TrapTheCap/trunk/doc/classes/Board.src
+http://scripts.njae.me.uk/svn/njae
+
+
+
+2008-10-16T14:11:23.436422Z
+41
+neil
+
+
+svn:special svn:externals svn:needs-lock
+
+
+
+
+
+
+
+
+
+
+
+0ada9808-85ab-4924-adda-5bf89eae3818
+\f
+M000024.html
+file
+
+
+
+
+2008-03-25T12:43:37.000000Z
+c73359a71a510ffc4d3cd42c30c91679
+2008-03-28T15:47:09.723420Z
+24
+neil
+\f
+M000034.html
+file
+
+
+
+
+2008-03-25T11:48:00.000000Z
+4cce8fb72c33b1e626b2cd690b035c11
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+M000025.html
+file
+
+
+
+
+2008-03-25T12:43:37.000000Z
+72b3c1baab11f2df5d94ef1c3b6e5a20
+2008-03-28T15:47:09.723420Z
+24
+neil
+\f
+M000035.html
+file
+
+
+
+
+2008-03-25T11:48:00.000000Z
+f9a730ba1d43f01125364803c2fc13f8
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+M000026.html
+file
+
+
+
+
+2008-03-25T12:43:37.000000Z
+6afd410d4c4643f3805a0a6302d5d6c5
+2008-03-28T15:47:09.723420Z
+24
+neil
+\f
+M000036.html
+file
+
+
+
+
+2008-03-25T11:48:00.000000Z
+f48b5b76b4eaf398da6cea4a79ab09e5
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+M000027.html
+file
+
+
+
+
+2008-03-25T12:43:37.000000Z
+8245dd5f67b41834d7dd58cdb91fce10
+2008-03-28T15:47:09.723420Z
+24
+neil
+\f
+M000054.html
+file
+
+
+
+
+2008-03-28T15:44:42.000000Z
+3c4533b3f9fdf56f2f69dfafd8c5f667
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000037.html
+file
+
+
+
+
+2008-03-25T11:48:00.000000Z
+234475e43958a801ba63bb1c424c8715
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+M000055.html
+file
+
+
+
+
+2008-03-28T15:44:42.000000Z
+f920b99c27c792bdac0c054274ba6f44
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000056.html
+file
+
+
+
+
+2008-03-28T15:44:42.000000Z
+92592649e07c5a06ad738a2fe2f0de81
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000057.html
+file
+
+
+
+
+2008-03-28T15:44:42.000000Z
+23114a254a99e70cea32162f401a6426
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000058.html
+file
+
+
+
+
+2008-03-28T15:44:42.000000Z
+9a4fa5bc45f3b738b1245d1eb4c4b68b
+2008-10-16T14:11:23.436422Z
+41
+\f
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (Board)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 90</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">spokes</span>, <span class="ruby-identifier">spoke_length</span>, <span class="ruby-identifier">arc_length</span>)
+ <span class="ruby-comment cmt"># A hash of all positions, indexed by position names</span>
+ <span class="ruby-ivar">@positions</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
+ <span class="ruby-ivar">@centre</span> = <span class="ruby-constant">Position</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'ac'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">spoke_length</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-keyword kw">false</span>, <span class="ruby-keyword kw">false</span>)
+ <span class="ruby-ivar">@positions</span>[<span class="ruby-value str">'ac'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">spoke_length</span>.<span class="ruby-identifier">to_s</span>] = <span class="ruby-identifier">centre</span>
+ <span class="ruby-identifier">a1_corner</span> = <span class="ruby-keyword kw">nil</span>
+ <span class="ruby-identifier">end_of_previous_arc</span> = <span class="ruby-keyword kw">nil</span>
+
+ <span class="ruby-comment cmt"># Do each arc-spoke-base set</span>
+ (<span class="ruby-value">?a</span><span class="ruby-operator">...</span>(<span class="ruby-value">?a</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">spokes</span>)).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">arc_code</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">arc</span> = <span class="ruby-identifier">arc_code</span>.<span class="ruby-identifier">chr</span>
+ <span class="ruby-identifier">base</span> = <span class="ruby-constant">Position</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">arc</span>, <span class="ruby-keyword kw">false</span>, <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-identifier">this_arc</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
+
+ <span class="ruby-comment cmt"># build the arc</span>
+ (<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-identifier">arc_length</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">arc_position</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">position_name</span> = <span class="ruby-identifier">arc</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">arc_position</span>.<span class="ruby-identifier">to_s</span>
+ <span class="ruby-identifier">arc_place</span> = <span class="ruby-constant">Position</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">position_name</span>, <span class="ruby-identifier">arc_position</span> <span class="ruby-operator">==</span> <span class="ruby-value">4</span>, <span class="ruby-keyword kw">false</span>)
+ <span class="ruby-identifier">arc_place</span>.<span class="ruby-identifier">neighbours</span> = []
+ <span class="ruby-ivar">@positions</span>[<span class="ruby-identifier">position_name</span>] = <span class="ruby-identifier">arc_place</span>
+ <span class="ruby-identifier">this_arc</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">arc_place</span>
+ <span class="ruby-identifier">a1_corner</span> = <span class="ruby-identifier">a1_corner</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">arc_place</span>
+ <span class="ruby-keyword kw">end</span>
+ (<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-identifier">arc_length</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">arc_position</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">arc_position</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
+ <span class="ruby-identifier">this_arc</span>[<span class="ruby-identifier">arc_position</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_arc</span>[<span class="ruby-identifier">arc_position</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">arc_position</span> <span class="ruby-operator"><</span> (<span class="ruby-identifier">arc_length</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>)
+ <span class="ruby-identifier">this_arc</span>[<span class="ruby-identifier">arc_position</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_arc</span>[<span class="ruby-identifier">arc_position</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+
+ <span class="ruby-comment cmt"># build the spoke</span>
+ <span class="ruby-identifier">this_spoke</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
+ (<span class="ruby-value">1</span><span class="ruby-operator">..</span>(<span class="ruby-identifier">spoke_length</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>)).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">spoke_position</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">position_name</span> = <span class="ruby-identifier">arc</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"c"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">spoke_position</span>.<span class="ruby-identifier">to_s</span>
+ <span class="ruby-identifier">spoke_place</span> = <span class="ruby-constant">Position</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">position_name</span>, <span class="ruby-identifier">spoke_position</span> <span class="ruby-operator">==</span> <span class="ruby-value">3</span>, <span class="ruby-keyword kw">false</span>)
+ <span class="ruby-identifier">spoke_place</span>.<span class="ruby-identifier">neighbours</span> = []
+ <span class="ruby-ivar">@positions</span>[<span class="ruby-identifier">position_name</span>] = <span class="ruby-identifier">spoke_place</span>
+ <span class="ruby-identifier">this_spoke</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">spoke_place</span>
+ <span class="ruby-keyword kw">end</span>
+ (<span class="ruby-value">0</span><span class="ruby-operator">...</span>(<span class="ruby-identifier">spoke_length</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>)).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">spoke_position</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">spoke_position</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
+ <span class="ruby-identifier">this_spoke</span>[<span class="ruby-identifier">spoke_position</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_spoke</span>[<span class="ruby-identifier">spoke_position</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">spoke_position</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">spoke_length</span> <span class="ruby-operator">-</span> <span class="ruby-value">2</span>
+ <span class="ruby-identifier">this_spoke</span>[<span class="ruby-identifier">spoke_position</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_spoke</span>[<span class="ruby-identifier">spoke_position</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+
+ <span class="ruby-comment cmt"># tie the spoke and arc together, </span>
+ <span class="ruby-identifier">this_arc</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_spoke</span>[<span class="ruby-value">0</span>]
+ <span class="ruby-identifier">this_spoke</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_arc</span>[<span class="ruby-value">0</span>]
+
+ <span class="ruby-comment cmt"># tie the spoke to the centre, and</span>
+ <span class="ruby-identifier">this_spoke</span>[<span class="ruby-value">-1</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-ivar">@centre</span>
+ <span class="ruby-ivar">@centre</span>.<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_spoke</span>[<span class="ruby-value">-1</span>]
+
+ <span class="ruby-comment cmt"># tie the base to the arc</span>
+ <span class="ruby-identifier">base</span> = <span class="ruby-constant">Position</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">arc</span>, <span class="ruby-keyword kw">false</span>, <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-ivar">@positions</span>[<span class="ruby-identifier">arc</span>] = <span class="ruby-identifier">base</span>
+ <span class="ruby-identifier">base</span>.<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_arc</span>[<span class="ruby-value">0</span>]
+ <span class="ruby-identifier">this_arc</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">base</span>
+
+ <span class="ruby-comment cmt"># record the ends of the arc for tying to adjacent arcs</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">end_of_previous_arc</span>
+ <span class="ruby-identifier">end_of_previous_arc</span>.<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_arc</span>[<span class="ruby-value">0</span>]
+ <span class="ruby-identifier">this_arc</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">end_of_previous_arc</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">end_of_previous_arc</span> = <span class="ruby-identifier">this_arc</span>[<span class="ruby-value">-1</span>]
+
+ <span class="ruby-keyword kw">end</span> <span class="ruby-comment cmt"># arc</span>
+
+ <span class="ruby-comment cmt"># tie both ends of the rim together </span>
+ <span class="ruby-identifier">a1_corner</span>.<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">end_of_previous_arc</span>
+ <span class="ruby-identifier">end_of_previous_arc</span>.<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">a1_corner</span>
+
+ <span class="ruby-identifier">cache_valid_moves</span>
+
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_s (Board)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 171</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
+ <span class="ruby-identifier">layout</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>layout (Board)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 176</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">layout</span>
+ <span class="ruby-identifier">out_string</span> = <span class="ruby-value str">""</span>
+ <span class="ruby-ivar">@positions</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">sort</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">position</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">out_string</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">sprintf</span>(<span class="ruby-value str">"%s touches "</span>, <span class="ruby-ivar">@positions</span>[<span class="ruby-identifier">position</span>])
+ <span class="ruby-ivar">@positions</span>[<span class="ruby-identifier">position</span>].<span class="ruby-identifier">neighbours</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">neighbour</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">out_string</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">sprintf</span>(<span class="ruby-value str">"%s, "</span>, <span class="ruby-identifier">neighbour</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">out_string</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">sprintf</span>(<span class="ruby-value str">"\n"</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">out_string</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>cache_valid_moves (Board)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 191</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cache_valid_moves</span>
+ <span class="ruby-comment cmt"># A hash of arrays. The has key is the name of a positions. The array </span>
+ <span class="ruby-comment cmt"># element [i] stores the positions that are i spaces from here</span>
+ <span class="ruby-ivar">@valid_moves</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
+ <span class="ruby-comment cmt"># A hash of hashes. Given two names, return the shortest distance between</span>
+ <span class="ruby-comment cmt"># the two locations</span>
+ <span class="ruby-ivar">@distance_between</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
+ <span class="ruby-ivar">@positions</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">place</span>, <span class="ruby-identifier">position</span><span class="ruby-operator">|</span>
+ <span class="ruby-ivar">@valid_moves</span>[<span class="ruby-identifier">place</span>] = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
+ <span class="ruby-ivar">@distance_between</span>[<span class="ruby-identifier">place</span>] = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
+ <span class="ruby-ivar">@valid_moves</span>[<span class="ruby-identifier">place</span>][<span class="ruby-value">0</span>] = [<span class="ruby-identifier">place</span>]
+ <span class="ruby-ivar">@distance_between</span>[<span class="ruby-identifier">place</span>][<span class="ruby-identifier">place</span>] = <span class="ruby-value">0</span>
+ <span class="ruby-comment cmt"># Find the shortest routes by Dijkstra's algorithm</span>
+ <span class="ruby-identifier">agenda</span> = [<span class="ruby-identifier">position</span>]
+ <span class="ruby-identifier">closed_list</span> = [<span class="ruby-identifier">position</span>]
+ <span class="ruby-identifier">i</span> = <span class="ruby-value">1</span>
+ <span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">agenda</span>.<span class="ruby-identifier">empty?</span>
+ <span class="ruby-ivar">@valid_moves</span>[<span class="ruby-identifier">place</span>][<span class="ruby-identifier">i</span>] = []
+ <span class="ruby-identifier">new_agenda</span> = []
+ <span class="ruby-identifier">agenda</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">pos</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">valid_extensions</span> = <span class="ruby-identifier">pos</span>.<span class="ruby-identifier">neighbours</span>.<span class="ruby-identifier">reject</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">new_position</span><span class="ruby-operator">|</span> <span class="ruby-identifier">closed_list</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">new_position</span>) }
+ <span class="ruby-ivar">@valid_moves</span>[<span class="ruby-identifier">place</span>][<span class="ruby-identifier">i</span>] <span class="ruby-operator">+=</span> <span class="ruby-identifier">valid_extensions</span>
+ <span class="ruby-identifier">valid_extensions</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">ext</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@distance_between</span>[<span class="ruby-identifier">place</span>][<span class="ruby-identifier">ext</span>.<span class="ruby-identifier">place</span>] <span class="ruby-operator">||=</span> <span class="ruby-identifier">i</span> }
+ <span class="ruby-identifier">closed_list</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">valid_extensions</span>
+ <span class="ruby-identifier">new_agenda</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">valid_extensions</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">agenda</span> = <span class="ruby-identifier">new_agenda</span>
+ <span class="ruby-identifier">i</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (Board)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 82</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">spokes</span>, <span class="ruby-identifier">spoke_length</span>, <span class="ruby-identifier">arc_length</span>)
+ <span class="ruby-comment cmt"># A hash of all positions, indexed by position names</span>
+ <span class="ruby-ivar">@positions</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
+ <span class="ruby-ivar">@centre</span> = <span class="ruby-constant">Position</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'ac'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">spoke_length</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-keyword kw">false</span>, <span class="ruby-keyword kw">false</span>)
+ <span class="ruby-ivar">@positions</span>[<span class="ruby-value str">'ac'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">spoke_length</span>.<span class="ruby-identifier">to_s</span>] = <span class="ruby-identifier">centre</span>
+ <span class="ruby-identifier">a1_corner</span> = <span class="ruby-keyword kw">nil</span>
+ <span class="ruby-identifier">end_of_previous_arc</span> = <span class="ruby-keyword kw">nil</span>
+
+ <span class="ruby-comment cmt"># Do each arc-spoke-base set</span>
+ (<span class="ruby-value">?a</span><span class="ruby-operator">...</span>(<span class="ruby-value">?a</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">spokes</span>)).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">arc_code</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">arc</span> = <span class="ruby-identifier">arc_code</span>.<span class="ruby-identifier">chr</span>
+ <span class="ruby-identifier">base</span> = <span class="ruby-constant">Position</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">arc</span>, <span class="ruby-keyword kw">false</span>, <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-identifier">this_arc</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
+
+ <span class="ruby-comment cmt"># build the arc</span>
+ (<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-identifier">arc_length</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">arc_position</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">position_name</span> = <span class="ruby-identifier">arc</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">arc_position</span>.<span class="ruby-identifier">to_s</span>
+ <span class="ruby-identifier">arc_place</span> = <span class="ruby-constant">Position</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">position_name</span>, <span class="ruby-identifier">arc_position</span> <span class="ruby-operator">==</span> <span class="ruby-value">4</span>, <span class="ruby-keyword kw">false</span>)
+ <span class="ruby-identifier">arc_place</span>.<span class="ruby-identifier">neighbours</span> = []
+ <span class="ruby-ivar">@positions</span>[<span class="ruby-identifier">position_name</span>] = <span class="ruby-identifier">arc_place</span>
+ <span class="ruby-identifier">this_arc</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">arc_place</span>
+ <span class="ruby-identifier">a1_corner</span> = <span class="ruby-identifier">a1_corner</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">arc_place</span>
+ <span class="ruby-keyword kw">end</span>
+ (<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-identifier">arc_length</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">arc_position</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">arc_position</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
+ <span class="ruby-identifier">this_arc</span>[<span class="ruby-identifier">arc_position</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_arc</span>[<span class="ruby-identifier">arc_position</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">arc_position</span> <span class="ruby-operator"><</span> (<span class="ruby-identifier">arc_length</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>)
+ <span class="ruby-identifier">this_arc</span>[<span class="ruby-identifier">arc_position</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_arc</span>[<span class="ruby-identifier">arc_position</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+
+ <span class="ruby-comment cmt"># build the spoke</span>
+ <span class="ruby-identifier">this_spoke</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
+ (<span class="ruby-value">1</span><span class="ruby-operator">..</span>(<span class="ruby-identifier">spoke_length</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>)).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">spoke_position</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">position_name</span> = <span class="ruby-identifier">arc</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"c"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">spoke_position</span>.<span class="ruby-identifier">to_s</span>
+ <span class="ruby-identifier">spoke_place</span> = <span class="ruby-constant">Position</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">position_name</span>, <span class="ruby-identifier">spoke_position</span> <span class="ruby-operator">==</span> <span class="ruby-value">3</span>, <span class="ruby-keyword kw">false</span>)
+ <span class="ruby-identifier">spoke_place</span>.<span class="ruby-identifier">neighbours</span> = []
+ <span class="ruby-ivar">@positions</span>[<span class="ruby-identifier">position_name</span>] = <span class="ruby-identifier">spoke_place</span>
+ <span class="ruby-identifier">this_spoke</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">spoke_place</span>
+ <span class="ruby-keyword kw">end</span>
+ (<span class="ruby-value">0</span><span class="ruby-operator">...</span>(<span class="ruby-identifier">spoke_length</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>)).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">spoke_position</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">spoke_position</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
+ <span class="ruby-identifier">this_spoke</span>[<span class="ruby-identifier">spoke_position</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_spoke</span>[<span class="ruby-identifier">spoke_position</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">spoke_position</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">spoke_length</span> <span class="ruby-operator">-</span> <span class="ruby-value">2</span>
+ <span class="ruby-identifier">this_spoke</span>[<span class="ruby-identifier">spoke_position</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_spoke</span>[<span class="ruby-identifier">spoke_position</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+
+ <span class="ruby-comment cmt"># tie the spoke and arc together, </span>
+ <span class="ruby-identifier">this_arc</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_spoke</span>[<span class="ruby-value">0</span>]
+ <span class="ruby-identifier">this_spoke</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_arc</span>[<span class="ruby-value">0</span>]
+
+ <span class="ruby-comment cmt"># tie the spoke to the centre, and</span>
+ <span class="ruby-identifier">this_spoke</span>[<span class="ruby-value">-1</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-ivar">@centre</span>
+ <span class="ruby-ivar">@centre</span>.<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_spoke</span>[<span class="ruby-value">-1</span>]
+
+ <span class="ruby-comment cmt"># tie the base to the arc</span>
+ <span class="ruby-identifier">base</span> = <span class="ruby-constant">Position</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">arc</span>, <span class="ruby-keyword kw">false</span>, <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-ivar">@positions</span>[<span class="ruby-identifier">arc</span>] = <span class="ruby-identifier">base</span>
+ <span class="ruby-identifier">base</span>.<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_arc</span>[<span class="ruby-value">0</span>]
+ <span class="ruby-identifier">this_arc</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">base</span>
+
+ <span class="ruby-comment cmt"># record the ends of the arc for tying to adjacent arcs</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">end_of_previous_arc</span>
+ <span class="ruby-identifier">end_of_previous_arc</span>.<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_arc</span>[<span class="ruby-value">0</span>]
+ <span class="ruby-identifier">this_arc</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">end_of_previous_arc</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">end_of_previous_arc</span> = <span class="ruby-identifier">this_arc</span>[<span class="ruby-value">-1</span>]
+
+ <span class="ruby-keyword kw">end</span> <span class="ruby-comment cmt"># arc</span>
+
+ <span class="ruby-comment cmt"># tie both ends of the rim together </span>
+ <span class="ruby-identifier">a1_corner</span>.<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">end_of_previous_arc</span>
+ <span class="ruby-identifier">end_of_previous_arc</span>.<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">a1_corner</span>
+
+ <span class="ruby-identifier">cache_valid_moves</span>
+
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_s (Board)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 163</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
+ <span class="ruby-identifier">layout</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>layout (Board)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 168</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">layout</span>
+ <span class="ruby-identifier">out_string</span> = <span class="ruby-value str">""</span>
+ <span class="ruby-ivar">@positions</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">sort</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">position</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">out_string</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">sprintf</span>(<span class="ruby-value str">"%s touches "</span>, <span class="ruby-ivar">@positions</span>[<span class="ruby-identifier">position</span>])
+ <span class="ruby-ivar">@positions</span>[<span class="ruby-identifier">position</span>].<span class="ruby-identifier">neighbours</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">neighbour</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">out_string</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">sprintf</span>(<span class="ruby-value str">"%s, "</span>, <span class="ruby-identifier">neighbour</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">out_string</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">sprintf</span>(<span class="ruby-value str">"\n"</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">out_string</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>cache_valid_moves (Board)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 182</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cache_valid_moves</span>
+ <span class="ruby-comment cmt"># A hash of arrays. The has key is the name of a positions. The array element [i] stores the</span>
+ <span class="ruby-comment cmt"># positions that are i spaces from here</span>
+ <span class="ruby-ivar">@valid_moves</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
+ <span class="ruby-comment cmt"># A hash of hashes. Given two names, return the shortest distance between the two locations</span>
+ <span class="ruby-ivar">@distance_between</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
+ <span class="ruby-ivar">@positions</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">place</span>, <span class="ruby-identifier">position</span><span class="ruby-operator">|</span>
+ <span class="ruby-ivar">@valid_moves</span>[<span class="ruby-identifier">place</span>] = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
+ <span class="ruby-ivar">@distance_between</span>[<span class="ruby-identifier">place</span>] = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
+ <span class="ruby-ivar">@valid_moves</span>[<span class="ruby-identifier">place</span>][<span class="ruby-value">0</span>] = [<span class="ruby-identifier">place</span>]
+ <span class="ruby-ivar">@distance_between</span>[<span class="ruby-identifier">place</span>][<span class="ruby-identifier">place</span>] = <span class="ruby-value">0</span>
+ <span class="ruby-comment cmt"># Find the shortest routes by Dijkstra's algorithm</span>
+ <span class="ruby-identifier">agenda</span> = [<span class="ruby-identifier">position</span>]
+ <span class="ruby-identifier">closed_list</span> = [<span class="ruby-identifier">position</span>]
+ <span class="ruby-identifier">i</span> = <span class="ruby-value">1</span>
+ <span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">agenda</span>.<span class="ruby-identifier">empty?</span>
+ <span class="ruby-ivar">@valid_moves</span>[<span class="ruby-identifier">place</span>][<span class="ruby-identifier">i</span>] = []
+ <span class="ruby-identifier">new_agenda</span> = []
+ <span class="ruby-identifier">agenda</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">pos</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">valid_extensions</span> = <span class="ruby-identifier">pos</span>.<span class="ruby-identifier">neighbours</span>.<span class="ruby-identifier">reject</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">new_position</span><span class="ruby-operator">|</span> <span class="ruby-identifier">closed_list</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">new_position</span>) }
+ <span class="ruby-ivar">@valid_moves</span>[<span class="ruby-identifier">place</span>][<span class="ruby-identifier">i</span>] <span class="ruby-operator">+=</span> <span class="ruby-identifier">valid_extensions</span>
+ <span class="ruby-identifier">valid_extensions</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">ext</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@distance_between</span>[<span class="ruby-identifier">place</span>][<span class="ruby-identifier">ext</span>.<span class="ruby-identifier">place</span>] <span class="ruby-operator">||=</span> <span class="ruby-identifier">i</span> }
+ <span class="ruby-identifier">closed_list</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">valid_extensions</span>
+ <span class="ruby-identifier">new_agenda</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">valid_extensions</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">agenda</span> = <span class="ruby-identifier">new_agenda</span>
+ <span class="ruby-identifier">i</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (Board)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 94</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">spokes</span>, <span class="ruby-identifier">spoke_length</span>, <span class="ruby-identifier">arc_length</span>)
+ <span class="ruby-comment cmt"># A hash of all positions, indexed by position names</span>
+ <span class="ruby-ivar">@positions</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
+ <span class="ruby-ivar">@centre</span> = <span class="ruby-constant">Position</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'ac'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">spoke_length</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-keyword kw">false</span>, <span class="ruby-keyword kw">false</span>)
+ <span class="ruby-ivar">@positions</span>[<span class="ruby-value str">'ac'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">spoke_length</span>.<span class="ruby-identifier">to_s</span>] = <span class="ruby-identifier">centre</span>
+ <span class="ruby-identifier">a1_corner</span> = <span class="ruby-keyword kw">nil</span>
+ <span class="ruby-identifier">end_of_previous_arc</span> = <span class="ruby-keyword kw">nil</span>
+
+ <span class="ruby-comment cmt"># Do each arc-spoke-base set</span>
+ (<span class="ruby-value">?a</span><span class="ruby-operator">...</span>(<span class="ruby-value">?a</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">spokes</span>)).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">arc_code</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">arc</span> = <span class="ruby-identifier">arc_code</span>.<span class="ruby-identifier">chr</span>
+ <span class="ruby-identifier">base</span> = <span class="ruby-constant">Position</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">arc</span>, <span class="ruby-keyword kw">false</span>, <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-identifier">this_arc</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
+
+ <span class="ruby-comment cmt"># build the arc</span>
+ (<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-identifier">arc_length</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">arc_position</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">position_name</span> = <span class="ruby-identifier">arc</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">arc_position</span>.<span class="ruby-identifier">to_s</span>
+ <span class="ruby-identifier">arc_place</span> = <span class="ruby-constant">Position</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">position_name</span>, <span class="ruby-identifier">arc_position</span> <span class="ruby-operator">==</span> <span class="ruby-value">4</span>, <span class="ruby-keyword kw">false</span>)
+ <span class="ruby-identifier">arc_place</span>.<span class="ruby-identifier">neighbours</span> = []
+ <span class="ruby-ivar">@positions</span>[<span class="ruby-identifier">position_name</span>] = <span class="ruby-identifier">arc_place</span>
+ <span class="ruby-identifier">this_arc</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">arc_place</span>
+ <span class="ruby-identifier">a1_corner</span> = <span class="ruby-identifier">a1_corner</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">arc_place</span>
+ <span class="ruby-keyword kw">end</span>
+ (<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-identifier">arc_length</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">arc_position</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">arc_position</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
+ <span class="ruby-identifier">this_arc</span>[<span class="ruby-identifier">arc_position</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_arc</span>[<span class="ruby-identifier">arc_position</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">arc_position</span> <span class="ruby-operator"><</span> (<span class="ruby-identifier">arc_length</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>)
+ <span class="ruby-identifier">this_arc</span>[<span class="ruby-identifier">arc_position</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_arc</span>[<span class="ruby-identifier">arc_position</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+
+ <span class="ruby-comment cmt"># build the spoke</span>
+ <span class="ruby-identifier">this_spoke</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
+ (<span class="ruby-value">1</span><span class="ruby-operator">..</span>(<span class="ruby-identifier">spoke_length</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>)).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">spoke_position</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">position_name</span> = <span class="ruby-identifier">arc</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"c"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">spoke_position</span>.<span class="ruby-identifier">to_s</span>
+ <span class="ruby-identifier">spoke_place</span> = <span class="ruby-constant">Position</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">position_name</span>, <span class="ruby-identifier">spoke_position</span> <span class="ruby-operator">==</span> <span class="ruby-value">3</span>, <span class="ruby-keyword kw">false</span>)
+ <span class="ruby-identifier">spoke_place</span>.<span class="ruby-identifier">neighbours</span> = []
+ <span class="ruby-ivar">@positions</span>[<span class="ruby-identifier">position_name</span>] = <span class="ruby-identifier">spoke_place</span>
+ <span class="ruby-identifier">this_spoke</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">spoke_place</span>
+ <span class="ruby-keyword kw">end</span>
+ (<span class="ruby-value">0</span><span class="ruby-operator">...</span>(<span class="ruby-identifier">spoke_length</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>)).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">spoke_position</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">spoke_position</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
+ <span class="ruby-identifier">this_spoke</span>[<span class="ruby-identifier">spoke_position</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_spoke</span>[<span class="ruby-identifier">spoke_position</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">spoke_position</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">spoke_length</span> <span class="ruby-operator">-</span> <span class="ruby-value">2</span>
+ <span class="ruby-identifier">this_spoke</span>[<span class="ruby-identifier">spoke_position</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_spoke</span>[<span class="ruby-identifier">spoke_position</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+
+ <span class="ruby-comment cmt"># tie the spoke and arc together, </span>
+ <span class="ruby-identifier">this_arc</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_spoke</span>[<span class="ruby-value">0</span>]
+ <span class="ruby-identifier">this_spoke</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_arc</span>[<span class="ruby-value">0</span>]
+
+ <span class="ruby-comment cmt"># tie the spoke to the centre, and</span>
+ <span class="ruby-identifier">this_spoke</span>[<span class="ruby-value">-1</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-ivar">@centre</span>
+ <span class="ruby-ivar">@centre</span>.<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_spoke</span>[<span class="ruby-value">-1</span>]
+
+ <span class="ruby-comment cmt"># tie the base to the arc</span>
+ <span class="ruby-identifier">base</span> = <span class="ruby-constant">Position</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">arc</span>, <span class="ruby-keyword kw">false</span>, <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-ivar">@positions</span>[<span class="ruby-identifier">arc</span>] = <span class="ruby-identifier">base</span>
+ <span class="ruby-identifier">base</span>.<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_arc</span>[<span class="ruby-value">0</span>]
+ <span class="ruby-identifier">this_arc</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">base</span>
+
+ <span class="ruby-comment cmt"># record the ends of the arc for tying to adjacent arcs</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">end_of_previous_arc</span>
+ <span class="ruby-identifier">end_of_previous_arc</span>.<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_arc</span>[<span class="ruby-value">0</span>]
+ <span class="ruby-identifier">this_arc</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">end_of_previous_arc</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">end_of_previous_arc</span> = <span class="ruby-identifier">this_arc</span>[<span class="ruby-value">-1</span>]
+
+ <span class="ruby-keyword kw">end</span> <span class="ruby-comment cmt"># arc</span>
+
+ <span class="ruby-comment cmt"># tie both ends of the rim together </span>
+ <span class="ruby-identifier">a1_corner</span>.<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">end_of_previous_arc</span>
+ <span class="ruby-identifier">end_of_previous_arc</span>.<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">a1_corner</span>
+
+ <span class="ruby-identifier">cache_valid_moves</span>
+
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_s (Board)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 175</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
+ <span class="ruby-identifier">layout</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_str (Board)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 179</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_str</span>
+ <span class="ruby-identifier">to_s</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>layout (Board)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 185</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">layout</span>
+ <span class="ruby-identifier">out_string</span> = <span class="ruby-value str">""</span>
+ <span class="ruby-ivar">@positions</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">sort</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">position</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">out_string</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">sprintf</span>(<span class="ruby-value str">"%s touches "</span>, <span class="ruby-ivar">@positions</span>[<span class="ruby-identifier">position</span>])
+ <span class="ruby-ivar">@positions</span>[<span class="ruby-identifier">position</span>].<span class="ruby-identifier">neighbours</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">neighbour</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">out_string</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">sprintf</span>(<span class="ruby-value str">"%s, "</span>, <span class="ruby-identifier">neighbour</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">out_string</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">sprintf</span>(<span class="ruby-value str">"\n"</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">out_string</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>cache_valid_moves (Board)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 200</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cache_valid_moves</span>
+ <span class="ruby-comment cmt"># A hash of arrays. The has key is the name of a positions. The array </span>
+ <span class="ruby-comment cmt"># element [i] stores the positions that are i spaces from here</span>
+ <span class="ruby-ivar">@valid_moves</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
+ <span class="ruby-comment cmt"># A hash of hashes. Given two names, return the shortest distance between</span>
+ <span class="ruby-comment cmt"># the two locations</span>
+ <span class="ruby-ivar">@distance_between</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
+ <span class="ruby-ivar">@positions</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">place</span>, <span class="ruby-identifier">position</span><span class="ruby-operator">|</span>
+ <span class="ruby-ivar">@valid_moves</span>[<span class="ruby-identifier">place</span>] = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
+ <span class="ruby-ivar">@distance_between</span>[<span class="ruby-identifier">place</span>] = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
+ <span class="ruby-ivar">@valid_moves</span>[<span class="ruby-identifier">place</span>][<span class="ruby-value">0</span>] = [<span class="ruby-ivar">@positions</span>[<span class="ruby-identifier">place</span>]]
+ <span class="ruby-ivar">@distance_between</span>[<span class="ruby-identifier">place</span>][<span class="ruby-identifier">place</span>] = <span class="ruby-value">0</span>
+ <span class="ruby-comment cmt"># Find the shortest routes by Dijkstra's algorithm</span>
+ <span class="ruby-identifier">agenda</span> = [<span class="ruby-identifier">position</span>]
+ <span class="ruby-identifier">closed_list</span> = [<span class="ruby-identifier">position</span>]
+ <span class="ruby-identifier">i</span> = <span class="ruby-value">1</span>
+ <span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">agenda</span>.<span class="ruby-identifier">empty?</span>
+ <span class="ruby-ivar">@valid_moves</span>[<span class="ruby-identifier">place</span>][<span class="ruby-identifier">i</span>] = []
+ <span class="ruby-identifier">new_agenda</span> = []
+ <span class="ruby-identifier">agenda</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">pos</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">valid_extensions</span> = <span class="ruby-identifier">pos</span>.<span class="ruby-identifier">neighbours</span>.<span class="ruby-identifier">reject</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">new_position</span><span class="ruby-operator">|</span> <span class="ruby-identifier">closed_list</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">new_position</span>) }
+ <span class="ruby-ivar">@valid_moves</span>[<span class="ruby-identifier">place</span>][<span class="ruby-identifier">i</span>] <span class="ruby-operator">+=</span> <span class="ruby-identifier">valid_extensions</span>
+ <span class="ruby-identifier">valid_extensions</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">ext</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@distance_between</span>[<span class="ruby-identifier">place</span>][<span class="ruby-identifier">ext</span>.<span class="ruby-identifier">place</span>] <span class="ruby-operator">||=</span> <span class="ruby-identifier">i</span> }
+ <span class="ruby-identifier">closed_list</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">valid_extensions</span>
+ <span class="ruby-identifier">new_agenda</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">valid_extensions</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">agenda</span> = <span class="ruby-identifier">new_agenda</span>
+ <span class="ruby-identifier">i</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (Board)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 90</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">spokes</span>, <span class="ruby-identifier">spoke_length</span>, <span class="ruby-identifier">arc_length</span>)
+ <span class="ruby-comment cmt"># A hash of all positions, indexed by position names</span>
+ <span class="ruby-ivar">@positions</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
+ <span class="ruby-ivar">@centre</span> = <span class="ruby-constant">Position</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'ac'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">spoke_length</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-keyword kw">false</span>, <span class="ruby-keyword kw">false</span>)
+ <span class="ruby-ivar">@positions</span>[<span class="ruby-value str">'ac'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">spoke_length</span>.<span class="ruby-identifier">to_s</span>] = <span class="ruby-identifier">centre</span>
+ <span class="ruby-identifier">a1_corner</span> = <span class="ruby-keyword kw">nil</span>
+ <span class="ruby-identifier">end_of_previous_arc</span> = <span class="ruby-keyword kw">nil</span>
+
+ <span class="ruby-comment cmt"># Do each arc-spoke-base set</span>
+ (<span class="ruby-value">?a</span><span class="ruby-operator">...</span>(<span class="ruby-value">?a</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">spokes</span>)).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">arc_code</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">arc</span> = <span class="ruby-identifier">arc_code</span>.<span class="ruby-identifier">chr</span>
+ <span class="ruby-identifier">base</span> = <span class="ruby-constant">Position</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">arc</span>, <span class="ruby-keyword kw">false</span>, <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-identifier">this_arc</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
+
+ <span class="ruby-comment cmt"># build the arc</span>
+ (<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-identifier">arc_length</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">arc_position</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">position_name</span> = <span class="ruby-identifier">arc</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">arc_position</span>.<span class="ruby-identifier">to_s</span>
+ <span class="ruby-identifier">arc_place</span> = <span class="ruby-constant">Position</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">position_name</span>, <span class="ruby-identifier">arc_position</span> <span class="ruby-operator">==</span> <span class="ruby-value">4</span>, <span class="ruby-keyword kw">false</span>)
+ <span class="ruby-identifier">arc_place</span>.<span class="ruby-identifier">neighbours</span> = []
+ <span class="ruby-ivar">@positions</span>[<span class="ruby-identifier">position_name</span>] = <span class="ruby-identifier">arc_place</span>
+ <span class="ruby-identifier">this_arc</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">arc_place</span>
+ <span class="ruby-identifier">a1_corner</span> = <span class="ruby-identifier">a1_corner</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">arc_place</span>
+ <span class="ruby-keyword kw">end</span>
+ (<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-identifier">arc_length</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">arc_position</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">arc_position</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
+ <span class="ruby-identifier">this_arc</span>[<span class="ruby-identifier">arc_position</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_arc</span>[<span class="ruby-identifier">arc_position</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">arc_position</span> <span class="ruby-operator"><</span> (<span class="ruby-identifier">arc_length</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>)
+ <span class="ruby-identifier">this_arc</span>[<span class="ruby-identifier">arc_position</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_arc</span>[<span class="ruby-identifier">arc_position</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+
+ <span class="ruby-comment cmt"># build the spoke</span>
+ <span class="ruby-identifier">this_spoke</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
+ (<span class="ruby-value">1</span><span class="ruby-operator">..</span>(<span class="ruby-identifier">spoke_length</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>)).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">spoke_position</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">position_name</span> = <span class="ruby-identifier">arc</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"c"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">spoke_position</span>.<span class="ruby-identifier">to_s</span>
+ <span class="ruby-identifier">spoke_place</span> = <span class="ruby-constant">Position</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">position_name</span>, <span class="ruby-identifier">spoke_position</span> <span class="ruby-operator">==</span> <span class="ruby-value">3</span>, <span class="ruby-keyword kw">false</span>)
+ <span class="ruby-identifier">spoke_place</span>.<span class="ruby-identifier">neighbours</span> = []
+ <span class="ruby-ivar">@positions</span>[<span class="ruby-identifier">position_name</span>] = <span class="ruby-identifier">spoke_place</span>
+ <span class="ruby-identifier">this_spoke</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">spoke_place</span>
+ <span class="ruby-keyword kw">end</span>
+ (<span class="ruby-value">0</span><span class="ruby-operator">...</span>(<span class="ruby-identifier">spoke_length</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>)).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">spoke_position</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">spoke_position</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
+ <span class="ruby-identifier">this_spoke</span>[<span class="ruby-identifier">spoke_position</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_spoke</span>[<span class="ruby-identifier">spoke_position</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">spoke_position</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">spoke_length</span> <span class="ruby-operator">-</span> <span class="ruby-value">2</span>
+ <span class="ruby-identifier">this_spoke</span>[<span class="ruby-identifier">spoke_position</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_spoke</span>[<span class="ruby-identifier">spoke_position</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+
+ <span class="ruby-comment cmt"># tie the spoke and arc together, </span>
+ <span class="ruby-identifier">this_arc</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_spoke</span>[<span class="ruby-value">0</span>]
+ <span class="ruby-identifier">this_spoke</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_arc</span>[<span class="ruby-value">0</span>]
+
+ <span class="ruby-comment cmt"># tie the spoke to the centre, and</span>
+ <span class="ruby-identifier">this_spoke</span>[<span class="ruby-value">-1</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-ivar">@centre</span>
+ <span class="ruby-ivar">@centre</span>.<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_spoke</span>[<span class="ruby-value">-1</span>]
+
+ <span class="ruby-comment cmt"># tie the base to the arc</span>
+ <span class="ruby-identifier">base</span> = <span class="ruby-constant">Position</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">arc</span>, <span class="ruby-keyword kw">false</span>, <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-ivar">@positions</span>[<span class="ruby-identifier">arc</span>] = <span class="ruby-identifier">base</span>
+ <span class="ruby-identifier">base</span>.<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_arc</span>[<span class="ruby-value">0</span>]
+ <span class="ruby-identifier">this_arc</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">base</span>
+
+ <span class="ruby-comment cmt"># record the ends of the arc for tying to adjacent arcs</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">end_of_previous_arc</span>
+ <span class="ruby-identifier">end_of_previous_arc</span>.<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_arc</span>[<span class="ruby-value">0</span>]
+ <span class="ruby-identifier">this_arc</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">end_of_previous_arc</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">end_of_previous_arc</span> = <span class="ruby-identifier">this_arc</span>[<span class="ruby-value">-1</span>]
+
+ <span class="ruby-keyword kw">end</span> <span class="ruby-comment cmt"># arc</span>
+
+ <span class="ruby-comment cmt"># tie both ends of the rim together </span>
+ <span class="ruby-identifier">a1_corner</span>.<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">end_of_previous_arc</span>
+ <span class="ruby-identifier">end_of_previous_arc</span>.<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">a1_corner</span>
+
+ <span class="ruby-identifier">cache_valid_moves</span>
+
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_s (Board)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 171</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
+ <span class="ruby-identifier">layout</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>layout (Board)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 176</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">layout</span>
+ <span class="ruby-identifier">out_string</span> = <span class="ruby-value str">""</span>
+ <span class="ruby-ivar">@positions</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">sort</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">position</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">out_string</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">sprintf</span>(<span class="ruby-value str">"%s touches "</span>, <span class="ruby-ivar">@positions</span>[<span class="ruby-identifier">position</span>])
+ <span class="ruby-ivar">@positions</span>[<span class="ruby-identifier">position</span>].<span class="ruby-identifier">neighbours</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">neighbour</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">out_string</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">sprintf</span>(<span class="ruby-value str">"%s, "</span>, <span class="ruby-identifier">neighbour</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">out_string</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">sprintf</span>(<span class="ruby-value str">"\n"</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">out_string</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>cache_valid_moves (Board)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 191</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cache_valid_moves</span>
+ <span class="ruby-comment cmt"># A hash of arrays. The has key is the name of a positions. The array </span>
+ <span class="ruby-comment cmt"># element [i] stores the positions that are i spaces from here</span>
+ <span class="ruby-ivar">@valid_moves</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
+ <span class="ruby-comment cmt"># A hash of hashes. Given two names, return the shortest distance between</span>
+ <span class="ruby-comment cmt"># the two locations</span>
+ <span class="ruby-ivar">@distance_between</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
+ <span class="ruby-ivar">@positions</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">place</span>, <span class="ruby-identifier">position</span><span class="ruby-operator">|</span>
+ <span class="ruby-ivar">@valid_moves</span>[<span class="ruby-identifier">place</span>] = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
+ <span class="ruby-ivar">@distance_between</span>[<span class="ruby-identifier">place</span>] = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
+ <span class="ruby-ivar">@valid_moves</span>[<span class="ruby-identifier">place</span>][<span class="ruby-value">0</span>] = [<span class="ruby-identifier">place</span>]
+ <span class="ruby-ivar">@distance_between</span>[<span class="ruby-identifier">place</span>][<span class="ruby-identifier">place</span>] = <span class="ruby-value">0</span>
+ <span class="ruby-comment cmt"># Find the shortest routes by Dijkstra's algorithm</span>
+ <span class="ruby-identifier">agenda</span> = [<span class="ruby-identifier">position</span>]
+ <span class="ruby-identifier">closed_list</span> = [<span class="ruby-identifier">position</span>]
+ <span class="ruby-identifier">i</span> = <span class="ruby-value">1</span>
+ <span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">agenda</span>.<span class="ruby-identifier">empty?</span>
+ <span class="ruby-ivar">@valid_moves</span>[<span class="ruby-identifier">place</span>][<span class="ruby-identifier">i</span>] = []
+ <span class="ruby-identifier">new_agenda</span> = []
+ <span class="ruby-identifier">agenda</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">pos</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">valid_extensions</span> = <span class="ruby-identifier">pos</span>.<span class="ruby-identifier">neighbours</span>.<span class="ruby-identifier">reject</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">new_position</span><span class="ruby-operator">|</span> <span class="ruby-identifier">closed_list</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">new_position</span>) }
+ <span class="ruby-ivar">@valid_moves</span>[<span class="ruby-identifier">place</span>][<span class="ruby-identifier">i</span>] <span class="ruby-operator">+=</span> <span class="ruby-identifier">valid_extensions</span>
+ <span class="ruby-identifier">valid_extensions</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">ext</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@distance_between</span>[<span class="ruby-identifier">place</span>][<span class="ruby-identifier">ext</span>.<span class="ruby-identifier">place</span>] <span class="ruby-operator">||=</span> <span class="ruby-identifier">i</span> }
+ <span class="ruby-identifier">closed_list</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">valid_extensions</span>
+ <span class="ruby-identifier">new_agenda</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">valid_extensions</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">agenda</span> = <span class="ruby-identifier">new_agenda</span>
+ <span class="ruby-identifier">i</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (Board)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 82</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">spokes</span>, <span class="ruby-identifier">spoke_length</span>, <span class="ruby-identifier">arc_length</span>)
+ <span class="ruby-comment cmt"># A hash of all positions, indexed by position names</span>
+ <span class="ruby-ivar">@positions</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
+ <span class="ruby-ivar">@centre</span> = <span class="ruby-constant">Position</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'ac'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">spoke_length</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-keyword kw">false</span>, <span class="ruby-keyword kw">false</span>)
+ <span class="ruby-ivar">@positions</span>[<span class="ruby-value str">'ac'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">spoke_length</span>.<span class="ruby-identifier">to_s</span>] = <span class="ruby-identifier">centre</span>
+ <span class="ruby-identifier">a1_corner</span> = <span class="ruby-keyword kw">nil</span>
+ <span class="ruby-identifier">end_of_previous_arc</span> = <span class="ruby-keyword kw">nil</span>
+
+ <span class="ruby-comment cmt"># Do each arc-spoke-base set</span>
+ (<span class="ruby-value">?a</span><span class="ruby-operator">...</span>(<span class="ruby-value">?a</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">spokes</span>)).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">arc_code</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">arc</span> = <span class="ruby-identifier">arc_code</span>.<span class="ruby-identifier">chr</span>
+ <span class="ruby-identifier">base</span> = <span class="ruby-constant">Position</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">arc</span>, <span class="ruby-keyword kw">false</span>, <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-identifier">this_arc</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
+
+ <span class="ruby-comment cmt"># build the arc</span>
+ (<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-identifier">arc_length</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">arc_position</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">position_name</span> = <span class="ruby-identifier">arc</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">arc_position</span>.<span class="ruby-identifier">to_s</span>
+ <span class="ruby-identifier">arc_place</span> = <span class="ruby-constant">Position</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">position_name</span>, <span class="ruby-identifier">arc_position</span> <span class="ruby-operator">==</span> <span class="ruby-value">4</span>, <span class="ruby-keyword kw">false</span>)
+ <span class="ruby-identifier">arc_place</span>.<span class="ruby-identifier">neighbours</span> = []
+ <span class="ruby-ivar">@positions</span>[<span class="ruby-identifier">position_name</span>] = <span class="ruby-identifier">arc_place</span>
+ <span class="ruby-identifier">this_arc</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">arc_place</span>
+ <span class="ruby-identifier">a1_corner</span> = <span class="ruby-identifier">a1_corner</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">arc_place</span>
+ <span class="ruby-keyword kw">end</span>
+ (<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-identifier">arc_length</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">arc_position</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">arc_position</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
+ <span class="ruby-identifier">this_arc</span>[<span class="ruby-identifier">arc_position</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_arc</span>[<span class="ruby-identifier">arc_position</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">arc_position</span> <span class="ruby-operator"><</span> (<span class="ruby-identifier">arc_length</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>)
+ <span class="ruby-identifier">this_arc</span>[<span class="ruby-identifier">arc_position</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_arc</span>[<span class="ruby-identifier">arc_position</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+
+ <span class="ruby-comment cmt"># build the spoke</span>
+ <span class="ruby-identifier">this_spoke</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
+ (<span class="ruby-value">1</span><span class="ruby-operator">..</span>(<span class="ruby-identifier">spoke_length</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>)).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">spoke_position</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">position_name</span> = <span class="ruby-identifier">arc</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"c"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">spoke_position</span>.<span class="ruby-identifier">to_s</span>
+ <span class="ruby-identifier">spoke_place</span> = <span class="ruby-constant">Position</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">position_name</span>, <span class="ruby-identifier">spoke_position</span> <span class="ruby-operator">==</span> <span class="ruby-value">3</span>, <span class="ruby-keyword kw">false</span>)
+ <span class="ruby-identifier">spoke_place</span>.<span class="ruby-identifier">neighbours</span> = []
+ <span class="ruby-ivar">@positions</span>[<span class="ruby-identifier">position_name</span>] = <span class="ruby-identifier">spoke_place</span>
+ <span class="ruby-identifier">this_spoke</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">spoke_place</span>
+ <span class="ruby-keyword kw">end</span>
+ (<span class="ruby-value">0</span><span class="ruby-operator">...</span>(<span class="ruby-identifier">spoke_length</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>)).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">spoke_position</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">spoke_position</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
+ <span class="ruby-identifier">this_spoke</span>[<span class="ruby-identifier">spoke_position</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_spoke</span>[<span class="ruby-identifier">spoke_position</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">spoke_position</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">spoke_length</span> <span class="ruby-operator">-</span> <span class="ruby-value">2</span>
+ <span class="ruby-identifier">this_spoke</span>[<span class="ruby-identifier">spoke_position</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_spoke</span>[<span class="ruby-identifier">spoke_position</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+
+ <span class="ruby-comment cmt"># tie the spoke and arc together, </span>
+ <span class="ruby-identifier">this_arc</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_spoke</span>[<span class="ruby-value">0</span>]
+ <span class="ruby-identifier">this_spoke</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_arc</span>[<span class="ruby-value">0</span>]
+
+ <span class="ruby-comment cmt"># tie the spoke to the centre, and</span>
+ <span class="ruby-identifier">this_spoke</span>[<span class="ruby-value">-1</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-ivar">@centre</span>
+ <span class="ruby-ivar">@centre</span>.<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_spoke</span>[<span class="ruby-value">-1</span>]
+
+ <span class="ruby-comment cmt"># tie the base to the arc</span>
+ <span class="ruby-identifier">base</span> = <span class="ruby-constant">Position</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">arc</span>, <span class="ruby-keyword kw">false</span>, <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-ivar">@positions</span>[<span class="ruby-identifier">arc</span>] = <span class="ruby-identifier">base</span>
+ <span class="ruby-identifier">base</span>.<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_arc</span>[<span class="ruby-value">0</span>]
+ <span class="ruby-identifier">this_arc</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">base</span>
+
+ <span class="ruby-comment cmt"># record the ends of the arc for tying to adjacent arcs</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">end_of_previous_arc</span>
+ <span class="ruby-identifier">end_of_previous_arc</span>.<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_arc</span>[<span class="ruby-value">0</span>]
+ <span class="ruby-identifier">this_arc</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">end_of_previous_arc</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">end_of_previous_arc</span> = <span class="ruby-identifier">this_arc</span>[<span class="ruby-value">-1</span>]
+
+ <span class="ruby-keyword kw">end</span> <span class="ruby-comment cmt"># arc</span>
+
+ <span class="ruby-comment cmt"># tie both ends of the rim together </span>
+ <span class="ruby-identifier">a1_corner</span>.<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">end_of_previous_arc</span>
+ <span class="ruby-identifier">end_of_previous_arc</span>.<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">a1_corner</span>
+
+ <span class="ruby-identifier">cache_valid_moves</span>
+
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_s (Board)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 163</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
+ <span class="ruby-identifier">layout</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>layout (Board)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 168</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">layout</span>
+ <span class="ruby-identifier">out_string</span> = <span class="ruby-value str">""</span>
+ <span class="ruby-ivar">@positions</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">sort</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">position</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">out_string</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">sprintf</span>(<span class="ruby-value str">"%s touches "</span>, <span class="ruby-ivar">@positions</span>[<span class="ruby-identifier">position</span>])
+ <span class="ruby-ivar">@positions</span>[<span class="ruby-identifier">position</span>].<span class="ruby-identifier">neighbours</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">neighbour</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">out_string</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">sprintf</span>(<span class="ruby-value str">"%s, "</span>, <span class="ruby-identifier">neighbour</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">out_string</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">sprintf</span>(<span class="ruby-value str">"\n"</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">out_string</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>cache_valid_moves (Board)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 182</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cache_valid_moves</span>
+ <span class="ruby-comment cmt"># A hash of arrays. The has key is the name of a positions. The array element [i] stores the</span>
+ <span class="ruby-comment cmt"># positions that are i spaces from here</span>
+ <span class="ruby-ivar">@valid_moves</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
+ <span class="ruby-comment cmt"># A hash of hashes. Given two names, return the shortest distance between the two locations</span>
+ <span class="ruby-ivar">@distance_between</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
+ <span class="ruby-ivar">@positions</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">place</span>, <span class="ruby-identifier">position</span><span class="ruby-operator">|</span>
+ <span class="ruby-ivar">@valid_moves</span>[<span class="ruby-identifier">place</span>] = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
+ <span class="ruby-ivar">@distance_between</span>[<span class="ruby-identifier">place</span>] = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
+ <span class="ruby-ivar">@valid_moves</span>[<span class="ruby-identifier">place</span>][<span class="ruby-value">0</span>] = [<span class="ruby-identifier">place</span>]
+ <span class="ruby-ivar">@distance_between</span>[<span class="ruby-identifier">place</span>][<span class="ruby-identifier">place</span>] = <span class="ruby-value">0</span>
+ <span class="ruby-comment cmt"># Find the shortest routes by Dijkstra's algorithm</span>
+ <span class="ruby-identifier">agenda</span> = [<span class="ruby-identifier">position</span>]
+ <span class="ruby-identifier">closed_list</span> = [<span class="ruby-identifier">position</span>]
+ <span class="ruby-identifier">i</span> = <span class="ruby-value">1</span>
+ <span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">agenda</span>.<span class="ruby-identifier">empty?</span>
+ <span class="ruby-ivar">@valid_moves</span>[<span class="ruby-identifier">place</span>][<span class="ruby-identifier">i</span>] = []
+ <span class="ruby-identifier">new_agenda</span> = []
+ <span class="ruby-identifier">agenda</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">pos</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">valid_extensions</span> = <span class="ruby-identifier">pos</span>.<span class="ruby-identifier">neighbours</span>.<span class="ruby-identifier">reject</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">new_position</span><span class="ruby-operator">|</span> <span class="ruby-identifier">closed_list</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">new_position</span>) }
+ <span class="ruby-ivar">@valid_moves</span>[<span class="ruby-identifier">place</span>][<span class="ruby-identifier">i</span>] <span class="ruby-operator">+=</span> <span class="ruby-identifier">valid_extensions</span>
+ <span class="ruby-identifier">valid_extensions</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">ext</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@distance_between</span>[<span class="ruby-identifier">place</span>][<span class="ruby-identifier">ext</span>.<span class="ruby-identifier">place</span>] <span class="ruby-operator">||=</span> <span class="ruby-identifier">i</span> }
+ <span class="ruby-identifier">closed_list</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">valid_extensions</span>
+ <span class="ruby-identifier">new_agenda</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">valid_extensions</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">agenda</span> = <span class="ruby-identifier">new_agenda</span>
+ <span class="ruby-identifier">i</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (Board)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 94</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">spokes</span>, <span class="ruby-identifier">spoke_length</span>, <span class="ruby-identifier">arc_length</span>)
+ <span class="ruby-comment cmt"># A hash of all positions, indexed by position names</span>
+ <span class="ruby-ivar">@positions</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
+ <span class="ruby-ivar">@centre</span> = <span class="ruby-constant">Position</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'ac'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">spoke_length</span>.<span class="ruby-identifier">to_s</span>, <span class="ruby-keyword kw">false</span>, <span class="ruby-keyword kw">false</span>)
+ <span class="ruby-ivar">@positions</span>[<span class="ruby-value str">'ac'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">spoke_length</span>.<span class="ruby-identifier">to_s</span>] = <span class="ruby-identifier">centre</span>
+ <span class="ruby-identifier">a1_corner</span> = <span class="ruby-keyword kw">nil</span>
+ <span class="ruby-identifier">end_of_previous_arc</span> = <span class="ruby-keyword kw">nil</span>
+
+ <span class="ruby-comment cmt"># Do each arc-spoke-base set</span>
+ (<span class="ruby-value">?a</span><span class="ruby-operator">...</span>(<span class="ruby-value">?a</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">spokes</span>)).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">arc_code</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">arc</span> = <span class="ruby-identifier">arc_code</span>.<span class="ruby-identifier">chr</span>
+ <span class="ruby-identifier">base</span> = <span class="ruby-constant">Position</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">arc</span>, <span class="ruby-keyword kw">false</span>, <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-identifier">this_arc</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
+
+ <span class="ruby-comment cmt"># build the arc</span>
+ (<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-identifier">arc_length</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">arc_position</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">position_name</span> = <span class="ruby-identifier">arc</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">arc_position</span>.<span class="ruby-identifier">to_s</span>
+ <span class="ruby-identifier">arc_place</span> = <span class="ruby-constant">Position</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">position_name</span>, <span class="ruby-identifier">arc_position</span> <span class="ruby-operator">==</span> <span class="ruby-value">4</span>, <span class="ruby-keyword kw">false</span>)
+ <span class="ruby-identifier">arc_place</span>.<span class="ruby-identifier">neighbours</span> = []
+ <span class="ruby-ivar">@positions</span>[<span class="ruby-identifier">position_name</span>] = <span class="ruby-identifier">arc_place</span>
+ <span class="ruby-identifier">this_arc</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">arc_place</span>
+ <span class="ruby-identifier">a1_corner</span> = <span class="ruby-identifier">a1_corner</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">arc_place</span>
+ <span class="ruby-keyword kw">end</span>
+ (<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-identifier">arc_length</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">arc_position</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">arc_position</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
+ <span class="ruby-identifier">this_arc</span>[<span class="ruby-identifier">arc_position</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_arc</span>[<span class="ruby-identifier">arc_position</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">arc_position</span> <span class="ruby-operator"><</span> (<span class="ruby-identifier">arc_length</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>)
+ <span class="ruby-identifier">this_arc</span>[<span class="ruby-identifier">arc_position</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_arc</span>[<span class="ruby-identifier">arc_position</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+
+ <span class="ruby-comment cmt"># build the spoke</span>
+ <span class="ruby-identifier">this_spoke</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
+ (<span class="ruby-value">1</span><span class="ruby-operator">..</span>(<span class="ruby-identifier">spoke_length</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>)).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">spoke_position</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">position_name</span> = <span class="ruby-identifier">arc</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"c"</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">spoke_position</span>.<span class="ruby-identifier">to_s</span>
+ <span class="ruby-identifier">spoke_place</span> = <span class="ruby-constant">Position</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">position_name</span>, <span class="ruby-identifier">spoke_position</span> <span class="ruby-operator">==</span> <span class="ruby-value">3</span>, <span class="ruby-keyword kw">false</span>)
+ <span class="ruby-identifier">spoke_place</span>.<span class="ruby-identifier">neighbours</span> = []
+ <span class="ruby-ivar">@positions</span>[<span class="ruby-identifier">position_name</span>] = <span class="ruby-identifier">spoke_place</span>
+ <span class="ruby-identifier">this_spoke</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">spoke_place</span>
+ <span class="ruby-keyword kw">end</span>
+ (<span class="ruby-value">0</span><span class="ruby-operator">...</span>(<span class="ruby-identifier">spoke_length</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>)).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">spoke_position</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">spoke_position</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
+ <span class="ruby-identifier">this_spoke</span>[<span class="ruby-identifier">spoke_position</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_spoke</span>[<span class="ruby-identifier">spoke_position</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">spoke_position</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">spoke_length</span> <span class="ruby-operator">-</span> <span class="ruby-value">2</span>
+ <span class="ruby-identifier">this_spoke</span>[<span class="ruby-identifier">spoke_position</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_spoke</span>[<span class="ruby-identifier">spoke_position</span> <span class="ruby-operator">+</span> <span class="ruby-value">1</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+
+ <span class="ruby-comment cmt"># tie the spoke and arc together, </span>
+ <span class="ruby-identifier">this_arc</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_spoke</span>[<span class="ruby-value">0</span>]
+ <span class="ruby-identifier">this_spoke</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_arc</span>[<span class="ruby-value">0</span>]
+
+ <span class="ruby-comment cmt"># tie the spoke to the centre, and</span>
+ <span class="ruby-identifier">this_spoke</span>[<span class="ruby-value">-1</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-ivar">@centre</span>
+ <span class="ruby-ivar">@centre</span>.<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_spoke</span>[<span class="ruby-value">-1</span>]
+
+ <span class="ruby-comment cmt"># tie the base to the arc</span>
+ <span class="ruby-identifier">base</span> = <span class="ruby-constant">Position</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">arc</span>, <span class="ruby-keyword kw">false</span>, <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-ivar">@positions</span>[<span class="ruby-identifier">arc</span>] = <span class="ruby-identifier">base</span>
+ <span class="ruby-identifier">base</span>.<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_arc</span>[<span class="ruby-value">0</span>]
+ <span class="ruby-identifier">this_arc</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">base</span>
+
+ <span class="ruby-comment cmt"># record the ends of the arc for tying to adjacent arcs</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">end_of_previous_arc</span>
+ <span class="ruby-identifier">end_of_previous_arc</span>.<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_arc</span>[<span class="ruby-value">0</span>]
+ <span class="ruby-identifier">this_arc</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">end_of_previous_arc</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">end_of_previous_arc</span> = <span class="ruby-identifier">this_arc</span>[<span class="ruby-value">-1</span>]
+
+ <span class="ruby-keyword kw">end</span> <span class="ruby-comment cmt"># arc</span>
+
+ <span class="ruby-comment cmt"># tie both ends of the rim together </span>
+ <span class="ruby-identifier">a1_corner</span>.<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">end_of_previous_arc</span>
+ <span class="ruby-identifier">end_of_previous_arc</span>.<span class="ruby-identifier">neighbours</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">a1_corner</span>
+
+ <span class="ruby-identifier">cache_valid_moves</span>
+
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_s (Board)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 175</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
+ <span class="ruby-identifier">layout</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_str (Board)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 179</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_str</span>
+ <span class="ruby-identifier">to_s</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>layout (Board)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 185</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">layout</span>
+ <span class="ruby-identifier">out_string</span> = <span class="ruby-value str">""</span>
+ <span class="ruby-ivar">@positions</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">sort</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">position</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">out_string</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">sprintf</span>(<span class="ruby-value str">"%s touches "</span>, <span class="ruby-ivar">@positions</span>[<span class="ruby-identifier">position</span>])
+ <span class="ruby-ivar">@positions</span>[<span class="ruby-identifier">position</span>].<span class="ruby-identifier">neighbours</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">neighbour</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">out_string</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">sprintf</span>(<span class="ruby-value str">"%s, "</span>, <span class="ruby-identifier">neighbour</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">out_string</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">sprintf</span>(<span class="ruby-value str">"\n"</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">out_string</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>cache_valid_moves (Board)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 200</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">cache_valid_moves</span>
+ <span class="ruby-comment cmt"># A hash of arrays. The has key is the name of a positions. The array </span>
+ <span class="ruby-comment cmt"># element [i] stores the positions that are i spaces from here</span>
+ <span class="ruby-ivar">@valid_moves</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
+ <span class="ruby-comment cmt"># A hash of hashes. Given two names, return the shortest distance between</span>
+ <span class="ruby-comment cmt"># the two locations</span>
+ <span class="ruby-ivar">@distance_between</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
+ <span class="ruby-ivar">@positions</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">place</span>, <span class="ruby-identifier">position</span><span class="ruby-operator">|</span>
+ <span class="ruby-ivar">@valid_moves</span>[<span class="ruby-identifier">place</span>] = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
+ <span class="ruby-ivar">@distance_between</span>[<span class="ruby-identifier">place</span>] = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
+ <span class="ruby-ivar">@valid_moves</span>[<span class="ruby-identifier">place</span>][<span class="ruby-value">0</span>] = [<span class="ruby-ivar">@positions</span>[<span class="ruby-identifier">place</span>]]
+ <span class="ruby-ivar">@distance_between</span>[<span class="ruby-identifier">place</span>][<span class="ruby-identifier">place</span>] = <span class="ruby-value">0</span>
+ <span class="ruby-comment cmt"># Find the shortest routes by Dijkstra's algorithm</span>
+ <span class="ruby-identifier">agenda</span> = [<span class="ruby-identifier">position</span>]
+ <span class="ruby-identifier">closed_list</span> = [<span class="ruby-identifier">position</span>]
+ <span class="ruby-identifier">i</span> = <span class="ruby-value">1</span>
+ <span class="ruby-keyword kw">while</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">agenda</span>.<span class="ruby-identifier">empty?</span>
+ <span class="ruby-ivar">@valid_moves</span>[<span class="ruby-identifier">place</span>][<span class="ruby-identifier">i</span>] = []
+ <span class="ruby-identifier">new_agenda</span> = []
+ <span class="ruby-identifier">agenda</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">pos</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">valid_extensions</span> = <span class="ruby-identifier">pos</span>.<span class="ruby-identifier">neighbours</span>.<span class="ruby-identifier">reject</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">new_position</span><span class="ruby-operator">|</span> <span class="ruby-identifier">closed_list</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">new_position</span>) }
+ <span class="ruby-ivar">@valid_moves</span>[<span class="ruby-identifier">place</span>][<span class="ruby-identifier">i</span>] <span class="ruby-operator">+=</span> <span class="ruby-identifier">valid_extensions</span>
+ <span class="ruby-identifier">valid_extensions</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">ext</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@distance_between</span>[<span class="ruby-identifier">place</span>][<span class="ruby-identifier">ext</span>.<span class="ruby-identifier">place</span>] <span class="ruby-operator">||=</span> <span class="ruby-identifier">i</span> }
+ <span class="ruby-identifier">closed_list</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">valid_extensions</span>
+ <span class="ruby-identifier">new_agenda</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">valid_extensions</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">agenda</span> = <span class="ruby-identifier">new_agenda</span>
+ <span class="ruby-identifier">i</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Class: Fixnum</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="classHeader">
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Class</strong></td>
+ <td class="class-name-in-header">Fixnum</td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>In:</strong></td>
+ <td>
+ <a href="../files/lib/libgenetics_rb.html">
+ lib/libgenetics.rb
+ </a>
+ <br />
+ </td>
+ </tr>
+
+ <tr class="top-aligned-row">
+ <td><strong>Parent:</strong></td>
+ <td>
+ Object
+ </td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+
+
+ </div>
+
+ <div id="method-list">
+ <h3 class="section-bar">Methods</h3>
+
+ <div class="name-list">
+ <a href="#M000022">to_bitstring</a>
+ </div>
+ </div>
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+ <div id="methods">
+ <h3 class="section-bar">Public Instance methods</h3>
+
+ <div id="method-M000022" class="method-detail">
+ <a name="M000022"></a>
+
+ <div class="method-heading">
+ <a href="Fixnum.src/M000022.html" target="Code" class="method-signature"
+ onclick="popupCode('Fixnum.src/M000022.html');return false;">
+ <span class="method-name">to_bitstring</span><span class="method-args">(min_length = 0)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+K 25
+svn:wc:ra_dav:version-url
+V 61
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Fixnum.src
+END
+M000012.html
+K 25
+svn:wc:ra_dav:version-url
+V 74
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Fixnum.src/M000012.html
+END
+M000022.html
+K 25
+svn:wc:ra_dav:version-url
+V 74
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Fixnum.src/M000022.html
+END
--- /dev/null
+8
+
+dir
+68
+http://scripts.njae.me.uk/svn/njae/TrapTheCap/trunk/doc/classes/Fixnum.src
+http://scripts.njae.me.uk/svn/njae
+
+
+
+2008-10-16T14:11:23.436422Z
+41
+
+
+
+svn:special svn:externals svn:needs-lock
+\f
+M000012.html
+file
+
+
+
+
+2008-04-23T19:30:16.000000Z
+ae2e1de25443c09224230ea37c75c000
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000022.html
+file
+
+
+
+
+2008-04-23T19:33:07.000000Z
+a315af98617a2484b934bce36e982eb6
+2008-10-16T14:11:23.436422Z
+41
+\f
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_bitstring (Fixnum)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libgenetics.rb, line 108</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_bitstring</span>(<span class="ruby-identifier">min_length</span> = <span class="ruby-value">0</span>)
+ <span class="ruby-identifier">bits</span> = []
+ <span class="ruby-identifier">k</span> = <span class="ruby-keyword kw">self</span>
+ <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">k</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span> <span class="ruby-keyword kw">do</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">k</span> <span class="ruby-operator">%</span> <span class="ruby-value">2</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
+ <span class="ruby-identifier">bits</span> <span class="ruby-operator"><<</span> <span class="ruby-value">1</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">bits</span> <span class="ruby-operator"><<</span> <span class="ruby-value">0</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">k</span> = <span class="ruby-identifier">k</span> <span class="ruby-operator">>></span> <span class="ruby-value">1</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">bits</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">min_length</span> <span class="ruby-keyword kw">do</span>
+ <span class="ruby-identifier">bits</span> <span class="ruby-operator"><<</span> <span class="ruby-value">0</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">bits</span>.<span class="ruby-identifier">reverse</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_bitstring (Fixnum)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libgenetics.rb, line 111</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_bitstring</span>(<span class="ruby-identifier">min_length</span> = <span class="ruby-value">0</span>)
+ <span class="ruby-identifier">bits</span> = []
+ <span class="ruby-identifier">k</span> = <span class="ruby-keyword kw">self</span>
+ <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">k</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span> <span class="ruby-keyword kw">do</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">k</span> <span class="ruby-operator">%</span> <span class="ruby-value">2</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
+ <span class="ruby-identifier">bits</span> <span class="ruby-operator"><<</span> <span class="ruby-value">1</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">bits</span> <span class="ruby-operator"><<</span> <span class="ruby-value">0</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">k</span> = <span class="ruby-identifier">k</span> <span class="ruby-operator">>></span> <span class="ruby-value">1</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">bits</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">min_length</span> <span class="ruby-keyword kw">do</span>
+ <span class="ruby-identifier">bits</span> <span class="ruby-operator"><<</span> <span class="ruby-value">0</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">bits</span>.<span class="ruby-identifier">reverse</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_bitstring (Fixnum)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libgenetics.rb, line 108</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_bitstring</span>(<span class="ruby-identifier">min_length</span> = <span class="ruby-value">0</span>)
+ <span class="ruby-identifier">bits</span> = []
+ <span class="ruby-identifier">k</span> = <span class="ruby-keyword kw">self</span>
+ <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">k</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span> <span class="ruby-keyword kw">do</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">k</span> <span class="ruby-operator">%</span> <span class="ruby-value">2</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
+ <span class="ruby-identifier">bits</span> <span class="ruby-operator"><<</span> <span class="ruby-value">1</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">bits</span> <span class="ruby-operator"><<</span> <span class="ruby-value">0</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">k</span> = <span class="ruby-identifier">k</span> <span class="ruby-operator">>></span> <span class="ruby-value">1</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">bits</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">min_length</span> <span class="ruby-keyword kw">do</span>
+ <span class="ruby-identifier">bits</span> <span class="ruby-operator"><<</span> <span class="ruby-value">0</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">bits</span>.<span class="ruby-identifier">reverse</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_bitstring (Fixnum)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libgenetics.rb, line 111</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_bitstring</span>(<span class="ruby-identifier">min_length</span> = <span class="ruby-value">0</span>)
+ <span class="ruby-identifier">bits</span> = []
+ <span class="ruby-identifier">k</span> = <span class="ruby-keyword kw">self</span>
+ <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">k</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span> <span class="ruby-keyword kw">do</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">k</span> <span class="ruby-operator">%</span> <span class="ruby-value">2</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
+ <span class="ruby-identifier">bits</span> <span class="ruby-operator"><<</span> <span class="ruby-value">1</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">bits</span> <span class="ruby-operator"><<</span> <span class="ruby-value">0</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">k</span> = <span class="ruby-identifier">k</span> <span class="ruby-operator">>></span> <span class="ruby-value">1</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">bits</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">min_length</span> <span class="ruby-keyword kw">do</span>
+ <span class="ruby-identifier">bits</span> <span class="ruby-operator"><<</span> <span class="ruby-value">0</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">bits</span>.<span class="ruby-identifier">reverse</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Class: Game</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="classHeader">
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Class</strong></td>
+ <td class="class-name-in-header">Game</td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>In:</strong></td>
+ <td>
+ <a href="../files/lib/libttc_rb.html">
+ lib/libttc.rb
+ </a>
+ <br />
+ </td>
+ </tr>
+
+ <tr class="top-aligned-row">
+ <td><strong>Parent:</strong></td>
+ <td>
+ Object
+ </td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <p>
+A game of Trap the Cap. It keeps a history of all previous states.
+</p>
+
+ </div>
+
+
+ </div>
+
+ <div id="method-list">
+ <h3 class="section-bar">Methods</h3>
+
+ <div class="name-list">
+ <a href="#M000037">apply_move!</a>
+ <a href="#M000039">apply_moves!</a>
+ <a href="#M000042">build_state_string</a>
+ <a href="#M000036">new</a>
+ <a href="#M000040">next_player!</a>
+ <a href="#M000041">possible_moves</a>
+ <a href="#M000046">read_game</a>
+ <a href="#M000043">show_state</a>
+ <a href="#M000044">to_s</a>
+ <a href="#M000045">to_str</a>
+ <a href="#M000038">undo_move!</a>
+ </div>
+ </div>
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+ <div id="attribute-list">
+ <h3 class="section-bar">Attributes</h3>
+
+ <div class="name-list">
+ <table>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">board</td>
+ <td class="context-item-value"> [R] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">current_player</td>
+ <td class="context-item-value"> [R] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">history</td>
+ <td class="context-item-value"> [R] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">pieces</td>
+ <td class="context-item-value"> [R] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">players</td>
+ <td class="context-item-value"> [R] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ </table>
+ </div>
+ </div>
+
+
+
+ <!-- if method_list -->
+ <div id="methods">
+ <h3 class="section-bar">Public Class methods</h3>
+
+ <div id="method-M000036" class="method-detail">
+ <a name="M000036"></a>
+
+ <div class="method-heading">
+ <a href="Game.src/M000036.html" target="Code" class="method-signature"
+ onclick="popupCode('Game.src/M000036.html');return false;">
+ <span class="method-name">new</span><span class="method-args">(players = 6, spokes = 6, spoke_length = 6, arc_length = 6, pieces_each = 6)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Create a <a href="Game.html#M000036">new</a> game
+</p>
+ </div>
+ </div>
+
+ <div id="method-M000046" class="method-detail">
+ <a name="M000046"></a>
+
+ <div class="method-heading">
+ <a href="Game.src/M000046.html" target="Code" class="method-signature"
+ onclick="popupCode('Game.src/M000046.html');return false;">
+ <span class="method-name">read_game</span><span class="method-args">(gamelines)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Given a set of lines from an input file, turn them into a <a
+href="Game.html">Game</a> object and a set of <a href="Move.html">Move</a>
+objects. Note the multiple return values. Class method
+</p>
+ </div>
+ </div>
+
+ <h3 class="section-bar">Public Instance methods</h3>
+
+ <div id="method-M000037" class="method-detail">
+ <a name="M000037"></a>
+
+ <div class="method-heading">
+ <a href="Game.src/M000037.html" target="Code" class="method-signature"
+ onclick="popupCode('Game.src/M000037.html');return false;">
+ <span class="method-name">apply_move!</span><span class="method-args">(move, player = @current_player)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Apply a single move to a game.
+</p>
+ </div>
+ </div>
+
+ <div id="method-M000039" class="method-detail">
+ <a name="M000039"></a>
+
+ <div class="method-heading">
+ <a href="Game.src/M000039.html" target="Code" class="method-signature"
+ onclick="popupCode('Game.src/M000039.html');return false;">
+ <span class="method-name">apply_moves!</span><span class="method-args">(moves)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Apply a list of moves in order
+</p>
+ </div>
+ </div>
+
+ <div id="method-M000042" class="method-detail">
+ <a name="M000042"></a>
+
+ <div class="method-heading">
+ <a href="Game.src/M000042.html" target="Code" class="method-signature"
+ onclick="popupCode('Game.src/M000042.html');return false;">
+ <span class="method-name">build_state_string</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <div id="method-M000040" class="method-detail">
+ <a name="M000040"></a>
+
+ <div class="method-heading">
+ <a href="Game.src/M000040.html" target="Code" class="method-signature"
+ onclick="popupCode('Game.src/M000040.html');return false;">
+ <span class="method-name">next_player!</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Set the current player to be the next player
+</p>
+ </div>
+ </div>
+
+ <div id="method-M000041" class="method-detail">
+ <a name="M000041"></a>
+
+ <div class="method-heading">
+ <a href="Game.src/M000041.html" target="Code" class="method-signature"
+ onclick="popupCode('Game.src/M000041.html');return false;">
+ <span class="method-name">possible_moves</span><span class="method-args">(die_result, player = @current_player)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Return an array of all possible moves from this state, given the die roll
+and the active player
+</p>
+ </div>
+ </div>
+
+ <div id="method-M000043" class="method-detail">
+ <a name="M000043"></a>
+
+ <div class="method-heading">
+ <a href="Game.src/M000043.html" target="Code" class="method-signature"
+ onclick="popupCode('Game.src/M000043.html');return false;">
+ <span class="method-name">show_state</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Show the state of the board
+</p>
+ </div>
+ </div>
+
+ <div id="method-M000044" class="method-detail">
+ <a name="M000044"></a>
+
+ <div class="method-heading">
+ <a href="Game.src/M000044.html" target="Code" class="method-signature"
+ onclick="popupCode('Game.src/M000044.html');return false;">
+ <span class="method-name">to_s</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <div id="method-M000045" class="method-detail">
+ <a name="M000045"></a>
+
+ <div class="method-heading">
+ <a href="Game.src/M000045.html" target="Code" class="method-signature"
+ onclick="popupCode('Game.src/M000045.html');return false;">
+ <span class="method-name">to_str</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <div id="method-M000038" class="method-detail">
+ <a name="M000038"></a>
+
+ <div class="method-heading">
+ <a href="Game.src/M000038.html" target="Code" class="method-signature"
+ onclick="popupCode('Game.src/M000038.html');return false;">
+ <span class="method-name">undo_move!</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Undo a move
+</p>
+ </div>
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+K 25
+svn:wc:ra_dav:version-url
+V 59
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Game.src
+END
+M000011.html
+K 25
+svn:wc:ra_dav:version-url
+V 72
+/svn/njae/!svn/ver/24/TrapTheCap/trunk/doc/classes/Game.src/M000011.html
+END
+M000021.html
+K 25
+svn:wc:ra_dav:version-url
+V 72
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/classes/Game.src/M000021.html
+END
+M000012.html
+K 25
+svn:wc:ra_dav:version-url
+V 72
+/svn/njae/!svn/ver/24/TrapTheCap/trunk/doc/classes/Game.src/M000012.html
+END
+M000040.html
+K 25
+svn:wc:ra_dav:version-url
+V 72
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Game.src/M000040.html
+END
+M000022.html
+K 25
+svn:wc:ra_dav:version-url
+V 72
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/classes/Game.src/M000022.html
+END
+M000013.html
+K 25
+svn:wc:ra_dav:version-url
+V 72
+/svn/njae/!svn/ver/24/TrapTheCap/trunk/doc/classes/Game.src/M000013.html
+END
+M000041.html
+K 25
+svn:wc:ra_dav:version-url
+V 72
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Game.src/M000041.html
+END
+M000023.html
+K 25
+svn:wc:ra_dav:version-url
+V 72
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/classes/Game.src/M000023.html
+END
+M000014.html
+K 25
+svn:wc:ra_dav:version-url
+V 72
+/svn/njae/!svn/ver/24/TrapTheCap/trunk/doc/classes/Game.src/M000014.html
+END
+M000042.html
+K 25
+svn:wc:ra_dav:version-url
+V 72
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Game.src/M000042.html
+END
+M000024.html
+K 25
+svn:wc:ra_dav:version-url
+V 72
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/classes/Game.src/M000024.html
+END
+M000015.html
+K 25
+svn:wc:ra_dav:version-url
+V 72
+/svn/njae/!svn/ver/24/TrapTheCap/trunk/doc/classes/Game.src/M000015.html
+END
+M000043.html
+K 25
+svn:wc:ra_dav:version-url
+V 72
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Game.src/M000043.html
+END
+M000025.html
+K 25
+svn:wc:ra_dav:version-url
+V 72
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/classes/Game.src/M000025.html
+END
+M000016.html
+K 25
+svn:wc:ra_dav:version-url
+V 72
+/svn/njae/!svn/ver/24/TrapTheCap/trunk/doc/classes/Game.src/M000016.html
+END
+M000017.html
+K 25
+svn:wc:ra_dav:version-url
+V 72
+/svn/njae/!svn/ver/24/TrapTheCap/trunk/doc/classes/Game.src/M000017.html
+END
+M000026.html
+K 25
+svn:wc:ra_dav:version-url
+V 72
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/classes/Game.src/M000026.html
+END
+M000044.html
+K 25
+svn:wc:ra_dav:version-url
+V 72
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Game.src/M000044.html
+END
+M000036.html
+K 25
+svn:wc:ra_dav:version-url
+V 72
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Game.src/M000036.html
+END
+M000027.html
+K 25
+svn:wc:ra_dav:version-url
+V 72
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/classes/Game.src/M000027.html
+END
+M000045.html
+K 25
+svn:wc:ra_dav:version-url
+V 72
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Game.src/M000045.html
+END
+M000037.html
+K 25
+svn:wc:ra_dav:version-url
+V 72
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Game.src/M000037.html
+END
+M000046.html
+K 25
+svn:wc:ra_dav:version-url
+V 72
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Game.src/M000046.html
+END
+M000038.html
+K 25
+svn:wc:ra_dav:version-url
+V 72
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Game.src/M000038.html
+END
+M000039.html
+K 25
+svn:wc:ra_dav:version-url
+V 72
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Game.src/M000039.html
+END
--- /dev/null
+8
+
+dir
+68
+http://scripts.njae.me.uk/svn/njae/TrapTheCap/trunk/doc/classes/Game.src
+http://scripts.njae.me.uk/svn/njae
+
+
+
+2008-10-16T14:11:23.436422Z
+41
+neil
+
+
+svn:special svn:externals svn:needs-lock
+
+
+
+
+
+
+
+
+
+
+
+0ada9808-85ab-4924-adda-5bf89eae3818
+\f
+M000011.html
+file
+
+
+
+
+2008-03-25T12:43:37.000000Z
+72f0bf2b98751cd586569cc725d9958f
+2008-03-28T15:47:09.723420Z
+24
+neil
+\f
+M000012.html
+file
+
+
+
+
+2008-03-25T12:43:37.000000Z
+847544ecc2aa237c46799d389b4c5022
+2008-03-28T15:47:09.723420Z
+24
+neil
+\f
+M000021.html
+file
+
+
+
+
+2008-03-25T11:48:00.000000Z
+6d26a39471790f335c2079b934dd4f87
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+M000040.html
+file
+
+
+
+
+2008-03-28T15:44:42.000000Z
+8150ce9dcc9a66d1cf726441ca6424e8
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000013.html
+file
+
+
+
+
+2008-03-25T12:43:37.000000Z
+56ad1e2992ed4c5ab5c4cf8b7617db55
+2008-03-28T15:47:09.723420Z
+24
+neil
+\f
+M000022.html
+file
+
+
+
+
+2008-03-25T11:48:00.000000Z
+722d3c796a54769f4a9154e02746a2c9
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+M000014.html
+file
+
+
+
+
+2008-03-25T12:43:37.000000Z
+c8c45fd34107894059c4528364c6e869
+2008-03-28T15:47:09.723420Z
+24
+neil
+\f
+M000023.html
+file
+
+
+
+
+2008-03-25T11:48:00.000000Z
+1130afe34708f44ac61f7ed0b5c4118c
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+M000041.html
+file
+
+
+
+
+2008-03-28T15:44:42.000000Z
+feb55ca6336a84dc5309a068223a5142
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000042.html
+file
+
+
+
+
+2008-03-28T15:44:42.000000Z
+dbc7864e9f5753a51b01ab51edd77fc5
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000015.html
+file
+
+
+
+
+2008-03-25T12:43:37.000000Z
+60db3283ae32e48d3adaf3ce0e5e7333
+2008-03-28T15:47:09.723420Z
+24
+neil
+\f
+M000024.html
+file
+
+
+
+
+2008-03-25T11:48:00.000000Z
+b2bd90498157b556657b1baa008da6c8
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+M000043.html
+file
+
+
+
+
+2008-03-28T15:44:42.000000Z
+bc2baa00a766dd71b53839be9b8f327f
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000016.html
+file
+
+
+
+
+2008-03-25T12:43:37.000000Z
+31e5c38d706790da4db7681b39f8c984
+2008-03-28T15:47:09.723420Z
+24
+neil
+\f
+M000025.html
+file
+
+
+
+
+2008-03-25T11:48:00.000000Z
+3107728daed89cafeee115daefc695cd
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+M000026.html
+file
+
+
+
+
+2008-03-25T11:48:00.000000Z
+fd5f18c9eb5e2edaa940cc7d900807fb
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+M000044.html
+file
+
+
+
+
+2008-03-28T15:44:42.000000Z
+0da711412a0bc336780c4c806ca78f78
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000017.html
+file
+
+
+
+
+2008-03-25T12:43:37.000000Z
+d73fc9ea1b9254b28368249f77d15b5a
+2008-03-28T15:47:09.723420Z
+24
+neil
+\f
+M000027.html
+file
+
+
+
+
+2008-03-25T11:48:00.000000Z
+5790a8e4264498aa0ecf34c3e857060a
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+M000045.html
+file
+
+
+
+
+2008-03-28T15:44:42.000000Z
+68c624e923d750802ebe8c327ee6ac03
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000036.html
+file
+
+
+
+
+2008-03-28T15:44:42.000000Z
+784f5a3f2bf4f4be5649be867d2cb695
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000037.html
+file
+
+
+
+
+2008-03-28T15:44:42.000000Z
+b0f6c28477ed6d3c4970d7a98195d224
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000046.html
+file
+
+
+
+
+2008-03-28T15:44:42.000000Z
+4acd05b0a726cdbf3c1813c5c67f0635
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000038.html
+file
+
+
+
+
+2008-03-28T15:44:42.000000Z
+db418a74dea51b3974b9506c7c69ac36
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000039.html
+file
+
+
+
+
+2008-03-28T15:44:42.000000Z
+7f02999403f38304f4cc063263a3f30a
+2008-10-16T14:11:23.436422Z
+41
+\f
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 329</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">players</span> = <span class="ruby-value">6</span>, <span class="ruby-identifier">spokes</span> = <span class="ruby-value">6</span>, <span class="ruby-identifier">spoke_length</span> = <span class="ruby-value">6</span>, <span class="ruby-identifier">arc_length</span> = <span class="ruby-value">6</span>,
+ <span class="ruby-identifier">pieces_each</span> = <span class="ruby-value">6</span>)
+ <span class="ruby-ivar">@board</span> = <span class="ruby-constant">Board</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">spokes</span>, <span class="ruby-identifier">spoke_length</span>, <span class="ruby-identifier">arc_length</span>)
+ <span class="ruby-ivar">@history</span> = []
+ <span class="ruby-ivar">@pieces</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
+ <span class="ruby-ivar">@players</span> = <span class="ruby-keyword kw">case</span>
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">players</span> <span class="ruby-operator">==</span> <span class="ruby-value">2</span> ; [<span class="ruby-value str">'a'</span>, <span class="ruby-value str">'d'</span>]
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">players</span> <span class="ruby-operator">==</span> <span class="ruby-value">3</span> ; [<span class="ruby-value str">'a'</span>, <span class="ruby-value str">'c'</span>, <span class="ruby-value str">'e'</span>]
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">players</span> <span class="ruby-operator">==</span> <span class="ruby-value">4</span> ; [<span class="ruby-value str">'a'</span>, <span class="ruby-value str">'b'</span>, <span class="ruby-value str">'d'</span>, <span class="ruby-value str">'e'</span>]
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">players</span> <span class="ruby-operator">==</span> <span class="ruby-value">5</span> ; [<span class="ruby-value str">'a'</span>, <span class="ruby-value str">'b'</span>, <span class="ruby-value str">'c'</span>, <span class="ruby-value str">'d'</span>, <span class="ruby-value str">'e'</span>]
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">players</span> <span class="ruby-operator">==</span> <span class="ruby-value">6</span> ; [<span class="ruby-value str">'a'</span>, <span class="ruby-value str">'b'</span>, <span class="ruby-value str">'c'</span>, <span class="ruby-value str">'d'</span>, <span class="ruby-value str">'e'</span>, <span class="ruby-value str">'f'</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-ivar">@current_player</span> = <span class="ruby-value str">'a'</span>
+ <span class="ruby-ivar">@players</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">player</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">players_base</span> = <span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-identifier">player</span>]
+ (<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-identifier">pieces_each</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">count</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">piece</span> = <span class="ruby-constant">Piece</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">count</span>, <span class="ruby-identifier">players_base</span>, <span class="ruby-identifier">player</span>)
+ <span class="ruby-ivar">@pieces</span>[<span class="ruby-identifier">player</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">count</span>.<span class="ruby-identifier">to_s</span>] = <span class="ruby-identifier">piece</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>apply_move (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 353</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">move</span>, <span class="ruby-identifier">player</span> = <span class="ruby-ivar">@current_player</span>)
+ <span class="ruby-comment cmt"># Check the move is a valid one</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-node">"Piece #{move.piece} does not exist"</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">name</span>)
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-node">"Player #{player} moving piece #{move.piece}"</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">player</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-node">"Attempting to move captured piece #{move.piece}"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">captured</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-node">"Attempting to move #{move.piece} onto or via base without captured pieces"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">via_base?</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">empty?</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>.<span class="ruby-identifier">safe?</span>
+ <span class="ruby-keyword kw">if</span> (<span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">find_all</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">position</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>}).<span class="ruby-identifier">length</span> <span class="ruby-operator">>=</span> <span class="ruby-value">3</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-node">"Attempting to move #{move.piece} onto safe position #{move.destination} when there are already three or more pieces there"</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">via_base?</span>
+ <span class="ruby-identifier">moved_distance</span> = <span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">player</span>] <span class="ruby-operator">+</span>
+ <span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">player</span>][<span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>.<span class="ruby-identifier">place</span>]
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">moved_distance</span> = <span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>.<span class="ruby-identifier">place</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-node">"Attempting to move piece #{move.piece} #{moved_distance} places"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">moved_distance</span> <span class="ruby-operator"><</span> <span class="ruby-value">1</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">moved_distance</span> <span class="ruby-operator">></span> <span class="ruby-value">6</span>
+
+ <span class="ruby-comment cmt"># Apply this move</span>
+ <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">move_to</span>(<span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>)
+
+ <span class="ruby-comment cmt"># Capture anything already there (unless it's a safe place or a base, </span>
+ <span class="ruby-comment cmt"># or our own colour)</span>
+ <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>.<span class="ruby-identifier">safe?</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>.<span class="ruby-identifier">base?</span>
+ <span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span>, <span class="ruby-identifier">target_piece</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">target_piece</span>.<span class="ruby-identifier">position</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span> <span class="ruby-keyword kw">and</span>
+ <span class="ruby-identifier">target_piece</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span> <span class="ruby-keyword kw">and</span>
+ <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">member?</span>(<span class="ruby-identifier">target_piece</span>) <span class="ruby-keyword kw">and</span>
+ <span class="ruby-identifier">target_piece</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">player</span>
+ <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">capture</span>(<span class="ruby-identifier">target_piece</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+
+ <span class="ruby-comment cmt"># If the move was via our base, drop all captured pieces</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">via_base?</span>
+ <span class="ruby-identifier">capturers_base</span> = <span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">colour</span>]
+ <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">captured_piece</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">captured_piece</span>.<span class="ruby-identifier">move_to</span> <span class="ruby-identifier">capturers_base</span>
+ <span class="ruby-identifier">captured_piece</span>.<span class="ruby-identifier">captured</span> = <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">captured_piece</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">colour</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">contains</span> = []
+ <span class="ruby-keyword kw">end</span>
+
+ <span class="ruby-comment cmt"># Record the new stae</span>
+ <span class="ruby-identifier">this_game_state</span> = <span class="ruby-constant">GameState</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">move</span>, <span class="ruby-identifier">player</span>, <span class="ruby-ivar">@pieces</span>)
+ <span class="ruby-ivar">@history</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_game_state</span>
+
+ <span class="ruby-comment cmt"># Retain only players that have uncaptured pieces. </span>
+ <span class="ruby-comment cmt"># If there's only one player with uncaptured pieces, declare a win.</span>
+ <span class="ruby-identifier">potential_players</span> = []
+ <span class="ruby-ivar">@players</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> (<span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">values</span>.<span class="ruby-identifier">select</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">piece</span><span class="ruby-operator">|</span> <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">p</span>}).<span class="ruby-identifier">any?</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">piece</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">captured</span>}
+ <span class="ruby-identifier">potential_players</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">p</span>
+ <span class="ruby-keyword kw">end</span>
+<span class="ruby-comment cmt"># potential_players << p if (@pieces.values.select {|p| p.colour == @current_player}).any? {|p| not p.captured}</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">potential_players</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator"><=</span> <span class="ruby-value">1</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">GameWonNotice</span>, <span class="ruby-node">"Game won by #{potential_players[0]}"</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-ivar">@players</span> = <span class="ruby-identifier">potential_players</span>.<span class="ruby-identifier">sort</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>apply_moves (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 419</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">apply_moves</span>(<span class="ruby-identifier">moves</span>)
+ <span class="ruby-identifier">moves</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">move</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">via_base?</span>
+ <span class="ruby-identifier">moved_distance</span> = <span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>][<span class="ruby-ivar">@current_player</span>] <span class="ruby-operator">+</span>
+ <span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-ivar">@current_player</span>][<span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>.<span class="ruby-identifier">place</span>]
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">moved_distance</span> = <span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>.<span class="ruby-identifier">place</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">move</span>, <span class="ruby-ivar">@current_player</span>)
+ <span class="ruby-identifier">next_player</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">moved_distance</span> <span class="ruby-operator">==</span> <span class="ruby-value">6</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>next_player (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 434</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">next_player</span>
+ <span class="ruby-identifier">original_player</span> = <span class="ruby-ivar">@current_player</span>
+ <span class="ruby-keyword kw">begin</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@current_player</span> <span class="ruby-operator">==</span> <span class="ruby-ivar">@players</span>[<span class="ruby-value">-1</span>]
+ <span class="ruby-ivar">@current_player</span> = <span class="ruby-ivar">@players</span>[<span class="ruby-value">0</span>]
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-ivar">@current_player</span> = <span class="ruby-ivar">@players</span>[<span class="ruby-ivar">@players</span>.<span class="ruby-identifier">index</span>(<span class="ruby-ivar">@current_player</span>) <span class="ruby-operator">+</span> <span class="ruby-value">1</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span> <span class="ruby-keyword kw">while</span> (<span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">values</span>.<span class="ruby-identifier">select</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">==</span> <span class="ruby-ivar">@current_player</span>}).<span class="ruby-identifier">all?</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">captured</span>} <span class="ruby-keyword kw">and</span> <span class="ruby-ivar">@current_player</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">original_player</span>
+ <span class="ruby-ivar">@current_player</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>possible_moves (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 448</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">possible_moves</span>(<span class="ruby-identifier">die_result</span>, <span class="ruby-identifier">player</span> = <span class="ruby-ivar">@current_player</span>)
+ <span class="ruby-identifier">moves</span> = []
+ <span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">piece</span><span class="ruby-operator">|</span>
+ <span class="ruby-comment cmt"># only move current player's pieces, and only if they're not captured</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">player</span> <span class="ruby-keyword kw">and</span> (<span class="ruby-keyword kw">not</span> <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">captured</span>)
+ (<span class="ruby-ivar">@board</span>.<span class="ruby-identifier">valid_moves</span>[<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">die_result</span>]).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">destination</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">destination</span>.<span class="ruby-identifier">safe?</span>
+ <span class="ruby-keyword kw">if</span> (<span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">find_all</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">position</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">destination</span>}).<span class="ruby-identifier">length</span> <span class="ruby-operator"><</span> <span class="ruby-value">3</span>
+ <span class="ruby-identifier">moves</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">piece</span>, <span class="ruby-identifier">destination</span>, <span class="ruby-keyword kw">false</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">moves</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">piece</span>, <span class="ruby-identifier">destination</span>, <span class="ruby-keyword kw">false</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">destination</span>.<span class="ruby-identifier">base?</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-comment cmt"># if we can move to our base (but not already on it), add moves via that...</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">player</span>] <span class="ruby-operator"><=</span> <span class="ruby-identifier">die_result</span> <span class="ruby-keyword kw">and</span>
+ <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">player</span> <span class="ruby-keyword kw">and</span>
+ <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">empty?</span>
+ <span class="ruby-identifier">distance_after_base</span> = <span class="ruby-identifier">die_result</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">player</span>]
+ (<span class="ruby-ivar">@board</span>.<span class="ruby-identifier">valid_moves</span>[<span class="ruby-identifier">player</span>][<span class="ruby-identifier">distance_after_base</span>]).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">destination</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">destination</span>.<span class="ruby-identifier">safe?</span>
+ <span class="ruby-keyword kw">if</span> (<span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">find_all</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">position</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">destination</span>}).<span class="ruby-identifier">length</span> <span class="ruby-operator"><</span> <span class="ruby-value">3</span>
+ <span class="ruby-identifier">moves</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">piece</span>, <span class="ruby-identifier">destination</span>, <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">moves</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">piece</span>, <span class="ruby-identifier">destination</span>, <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">moves</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>show_state (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 484</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">show_state</span>
+ <span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">sort</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">piece_name</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@pieces</span>[<span class="ruby-identifier">piece_name</span>].<span class="ruby-identifier">captured</span>
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">"Piece #{piece_name} captured, at #{@pieces[piece_name].position}"</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">"Piece #{piece_name} is at #{@pieces[piece_name].position}, holds #{(@pieces[piece_name].contains.collect{|c| c.name}).join(' ')}"</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>read_game (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 498</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Game</span>.<span class="ruby-identifier">read_game</span>(<span class="ruby-identifier">gamelines</span>)
+ <span class="ruby-identifier">gamelines</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">l</span><span class="ruby-operator">|</span> <span class="ruby-identifier">l</span>.<span class="ruby-identifier">chomp!</span>}
+ <span class="ruby-identifier">game</span> = <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">gamelines</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">to_i</span>, <span class="ruby-value">6</span>, <span class="ruby-value">6</span>, <span class="ruby-value">6</span>, <span class="ruby-value">6</span>)
+ <span class="ruby-identifier">moves</span> = []
+ <span class="ruby-identifier">gamelines</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-2</span>].<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span> <span class="ruby-identifier">moves</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>)}
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">game</span>, <span class="ruby-identifier">moves</span>, <span class="ruby-identifier">gamelines</span>[<span class="ruby-value">-1</span>].<span class="ruby-identifier">to_i</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 318</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">players</span> = <span class="ruby-value">6</span>, <span class="ruby-identifier">spokes</span> = <span class="ruby-value">6</span>, <span class="ruby-identifier">spoke_length</span> = <span class="ruby-value">6</span>, <span class="ruby-identifier">arc_length</span> = <span class="ruby-value">6</span>, <span class="ruby-identifier">pieces_each</span> = <span class="ruby-value">6</span>)
+ <span class="ruby-ivar">@board</span> = <span class="ruby-constant">Board</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">spokes</span>, <span class="ruby-identifier">spoke_length</span>, <span class="ruby-identifier">arc_length</span>)
+ <span class="ruby-ivar">@history</span> = []
+ <span class="ruby-ivar">@pieces</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
+ <span class="ruby-ivar">@players</span> = <span class="ruby-keyword kw">case</span>
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">players</span> <span class="ruby-operator">==</span> <span class="ruby-value">2</span> ; [<span class="ruby-value str">'a'</span>, <span class="ruby-value str">'d'</span>]
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">players</span> <span class="ruby-operator">==</span> <span class="ruby-value">3</span> ; [<span class="ruby-value str">'a'</span>, <span class="ruby-value str">'c'</span>, <span class="ruby-value str">'e'</span>]
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">players</span> <span class="ruby-operator">==</span> <span class="ruby-value">4</span> ; [<span class="ruby-value str">'a'</span>, <span class="ruby-value str">'b'</span>, <span class="ruby-value str">'d'</span>, <span class="ruby-value str">'e'</span>]
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">players</span> <span class="ruby-operator">==</span> <span class="ruby-value">5</span> ; [<span class="ruby-value str">'a'</span>, <span class="ruby-value str">'b'</span>, <span class="ruby-value str">'c'</span>, <span class="ruby-value str">'d'</span>, <span class="ruby-value str">'e'</span>]
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">players</span> <span class="ruby-operator">==</span> <span class="ruby-value">6</span> ; [<span class="ruby-value str">'a'</span>, <span class="ruby-value str">'b'</span>, <span class="ruby-value str">'c'</span>, <span class="ruby-value str">'d'</span>, <span class="ruby-value str">'e'</span>, <span class="ruby-value str">'f'</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-ivar">@current_player</span> = <span class="ruby-value str">'a'</span>
+ <span class="ruby-ivar">@players</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">player</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">players_base</span> = <span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-identifier">player</span>]
+ (<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-identifier">pieces_each</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">count</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">piece</span> = <span class="ruby-constant">Piece</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">count</span>, <span class="ruby-identifier">players_base</span>, <span class="ruby-identifier">player</span>)
+ <span class="ruby-ivar">@pieces</span>[<span class="ruby-identifier">player</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">count</span>.<span class="ruby-identifier">to_s</span>] = <span class="ruby-identifier">piece</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>apply_move (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 341</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">move</span>, <span class="ruby-identifier">player</span> = <span class="ruby-ivar">@current_player</span>)
+ <span class="ruby-comment cmt"># Check the move is a valid one</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-node">"Piece #{move.piece} does not exist"</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">name</span>)
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-node">"Player #{player} moving piece #{move.piece}"</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">player</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-node">"Attempting to move captured piece #{move.piece}"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">captured</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-node">"Attempting to move #{move.piece} onto or via base without captured pieces"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">via_base?</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">empty?</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>.<span class="ruby-identifier">safe?</span>
+ <span class="ruby-keyword kw">if</span> (<span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">find_all</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">position</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>}).<span class="ruby-identifier">length</span> <span class="ruby-operator">>=</span> <span class="ruby-value">3</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-node">"Attempting to move #{move.piece} onto safe position #{move.destination} when there are already three or more pieces there"</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">via_base?</span>
+ <span class="ruby-identifier">moved_distance</span> = <span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">player</span>] <span class="ruby-operator">+</span>
+ <span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">player</span>][<span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>.<span class="ruby-identifier">place</span>]
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">moved_distance</span> = <span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>.<span class="ruby-identifier">place</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-node">"Attempting to move piece #{move.piece} #{moved_distance} places"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">moved_distance</span> <span class="ruby-operator"><</span> <span class="ruby-value">1</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">moved_distance</span> <span class="ruby-operator">></span> <span class="ruby-value">6</span>
+
+ <span class="ruby-comment cmt"># Apply this move</span>
+ <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">move_to</span>(<span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>)
+
+ <span class="ruby-comment cmt"># Capture anything already there (unless it's a safe place or a base, or our own colour)</span>
+ <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>.<span class="ruby-identifier">safe?</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>.<span class="ruby-identifier">base?</span>
+ <span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span>, <span class="ruby-identifier">target_piece</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">target_piece</span>.<span class="ruby-identifier">position</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span> <span class="ruby-keyword kw">and</span>
+ <span class="ruby-identifier">target_piece</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span> <span class="ruby-keyword kw">and</span>
+ <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">member?</span>(<span class="ruby-identifier">target_piece</span>) <span class="ruby-keyword kw">and</span>
+ <span class="ruby-identifier">target_piece</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">player</span>
+ <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">capture</span>(<span class="ruby-identifier">target_piece</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+
+ <span class="ruby-comment cmt"># If the move was via our base, drop all captured pieces</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">via_base?</span>
+ <span class="ruby-identifier">capturers_base</span> = <span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">colour</span>]
+ <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">captured_piece</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">captured_piece</span>.<span class="ruby-identifier">move_to</span> <span class="ruby-identifier">capturers_base</span>
+ <span class="ruby-identifier">captured_piece</span>.<span class="ruby-identifier">captured</span> = <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">captured_piece</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">colour</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">contains</span> = []
+ <span class="ruby-keyword kw">end</span>
+
+ <span class="ruby-comment cmt"># Record the new stae</span>
+ <span class="ruby-identifier">this_game_state</span> = <span class="ruby-constant">GameState</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">move</span>, <span class="ruby-identifier">player</span>, <span class="ruby-ivar">@pieces</span>)
+ <span class="ruby-ivar">@history</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_game_state</span>
+
+ <span class="ruby-comment cmt"># If there's only one player with uncaptured pieces, declare a win</span>
+ <span class="ruby-identifier">potential_players</span> = []
+ <span class="ruby-ivar">@players</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">potential_players</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">p</span> <span class="ruby-keyword kw">if</span> (<span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">values</span>.<span class="ruby-identifier">select</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">==</span> <span class="ruby-ivar">@current_player</span>}).<span class="ruby-identifier">any?</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">captured</span>}
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">potential_players</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator"><=</span> <span class="ruby-value">1</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">GameWonNotice</span>, <span class="ruby-node">"Game won by #{potential_players[0]}"</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>apply_moves (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 401</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">apply_moves</span>(<span class="ruby-identifier">moves</span>)
+ <span class="ruby-identifier">moves</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">move</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">via_base?</span>
+ <span class="ruby-identifier">moved_distance</span> = <span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>][<span class="ruby-ivar">@current_player</span>] <span class="ruby-operator">+</span>
+ <span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-ivar">@current_player</span>][<span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>.<span class="ruby-identifier">place</span>]
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">moved_distance</span> = <span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>.<span class="ruby-identifier">place</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">move</span>, <span class="ruby-ivar">@current_player</span>)
+ <span class="ruby-identifier">next_player</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">moved_distance</span> <span class="ruby-operator">==</span> <span class="ruby-value">6</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>next_player (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 416</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">next_player</span>
+ <span class="ruby-identifier">original_player</span> = <span class="ruby-ivar">@current_player</span>
+ <span class="ruby-keyword kw">begin</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@current_player</span> <span class="ruby-operator">==</span> <span class="ruby-ivar">@players</span>[<span class="ruby-value">-1</span>]
+ <span class="ruby-ivar">@current_player</span> = <span class="ruby-ivar">@players</span>[<span class="ruby-value">0</span>]
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-ivar">@current_player</span> = <span class="ruby-ivar">@players</span>[<span class="ruby-ivar">@players</span>.<span class="ruby-identifier">index</span>(<span class="ruby-ivar">@current_player</span>) <span class="ruby-operator">+</span> <span class="ruby-value">1</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span> <span class="ruby-keyword kw">while</span> (<span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">values</span>.<span class="ruby-identifier">select</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">==</span> <span class="ruby-ivar">@current_player</span>}).<span class="ruby-identifier">all?</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">captured</span>} <span class="ruby-keyword kw">and</span> <span class="ruby-ivar">@current_player</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">original_player</span>
+ <span class="ruby-ivar">@current_player</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>possible_moves (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 430</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">possible_moves</span>(<span class="ruby-identifier">die_result</span>, <span class="ruby-identifier">player</span> = <span class="ruby-ivar">@current_player</span>)
+ <span class="ruby-identifier">moves</span> = []
+ <span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">piece</span><span class="ruby-operator">|</span>
+ <span class="ruby-comment cmt"># only move current player's pieces, and only if they're not captured</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">player</span> <span class="ruby-keyword kw">and</span> (<span class="ruby-keyword kw">not</span> <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">captured</span>)
+ (<span class="ruby-ivar">@board</span>.<span class="ruby-identifier">valid_moves</span>[<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">die_result</span>]).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">destination</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">destination</span>.<span class="ruby-identifier">safe?</span>
+ <span class="ruby-keyword kw">if</span> (<span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">find_all</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">position</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">destination</span>}).<span class="ruby-identifier">length</span> <span class="ruby-operator"><</span> <span class="ruby-value">3</span>
+ <span class="ruby-identifier">moves</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">piece</span>, <span class="ruby-identifier">destination</span>, <span class="ruby-keyword kw">false</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">moves</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">piece</span>, <span class="ruby-identifier">destination</span>, <span class="ruby-keyword kw">false</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">destination</span>.<span class="ruby-identifier">base?</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-comment cmt"># if we can move to our base (but not already on it), add moves via that...</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">player</span>] <span class="ruby-operator"><=</span> <span class="ruby-identifier">die_result</span> <span class="ruby-keyword kw">and</span>
+ <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">player</span> <span class="ruby-keyword kw">and</span>
+ <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">empty?</span>
+ <span class="ruby-identifier">distance_after_base</span> = <span class="ruby-identifier">die_result</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">player</span>]
+ (<span class="ruby-ivar">@board</span>.<span class="ruby-identifier">valid_moves</span>[<span class="ruby-identifier">player</span>][<span class="ruby-identifier">distance_after_base</span>]).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">destination</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">destination</span>.<span class="ruby-identifier">safe?</span>
+ <span class="ruby-keyword kw">if</span> (<span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">find_all</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">position</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">destination</span>}).<span class="ruby-identifier">length</span> <span class="ruby-operator"><</span> <span class="ruby-value">3</span>
+ <span class="ruby-identifier">moves</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">piece</span>, <span class="ruby-identifier">destination</span>, <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">moves</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">piece</span>, <span class="ruby-identifier">destination</span>, <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">moves</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>show_state (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 466</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">show_state</span>
+ <span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">sort</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">piece_name</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@pieces</span>[<span class="ruby-identifier">piece_name</span>].<span class="ruby-identifier">captured</span>
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">"Piece #{piece_name} captured, at #{@pieces[piece_name].position}"</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">"Piece #{piece_name} is at #{@pieces[piece_name].position}, holds #{(@pieces[piece_name].contains.collect{|c| c.name}).join(' ')}"</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>read_game (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 480</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Game</span>.<span class="ruby-identifier">read_game</span>(<span class="ruby-identifier">gamelines</span>)
+ <span class="ruby-identifier">gamelines</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">l</span><span class="ruby-operator">|</span> <span class="ruby-identifier">l</span>.<span class="ruby-identifier">chomp!</span>}
+ <span class="ruby-identifier">game</span> = <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">gamelines</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">to_i</span>, <span class="ruby-value">6</span>, <span class="ruby-value">6</span>, <span class="ruby-value">6</span>, <span class="ruby-value">6</span>)
+ <span class="ruby-identifier">moves</span> = []
+ <span class="ruby-identifier">gamelines</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-2</span>].<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span> <span class="ruby-identifier">moves</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>)}
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">game</span>, <span class="ruby-identifier">moves</span>, <span class="ruby-identifier">gamelines</span>[<span class="ruby-value">-1</span>].<span class="ruby-identifier">to_i</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 355</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">players</span> = <span class="ruby-value">6</span>, <span class="ruby-identifier">spokes</span> = <span class="ruby-value">6</span>, <span class="ruby-identifier">spoke_length</span> = <span class="ruby-value">6</span>, <span class="ruby-identifier">arc_length</span> = <span class="ruby-value">6</span>,
+ <span class="ruby-identifier">pieces_each</span> = <span class="ruby-value">6</span>)
+ <span class="ruby-ivar">@board</span> = <span class="ruby-constant">Board</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">spokes</span>, <span class="ruby-identifier">spoke_length</span>, <span class="ruby-identifier">arc_length</span>)
+ <span class="ruby-ivar">@history</span> = []
+ <span class="ruby-ivar">@pieces</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
+ <span class="ruby-ivar">@players</span> = <span class="ruby-keyword kw">case</span>
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">players</span> <span class="ruby-operator">==</span> <span class="ruby-value">2</span> ; [<span class="ruby-value str">'a'</span>, <span class="ruby-value str">'d'</span>]
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">players</span> <span class="ruby-operator">==</span> <span class="ruby-value">3</span> ; [<span class="ruby-value str">'a'</span>, <span class="ruby-value str">'c'</span>, <span class="ruby-value str">'e'</span>]
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">players</span> <span class="ruby-operator">==</span> <span class="ruby-value">4</span> ; [<span class="ruby-value str">'a'</span>, <span class="ruby-value str">'b'</span>, <span class="ruby-value str">'d'</span>, <span class="ruby-value str">'e'</span>]
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">players</span> <span class="ruby-operator">==</span> <span class="ruby-value">5</span> ; [<span class="ruby-value str">'a'</span>, <span class="ruby-value str">'b'</span>, <span class="ruby-value str">'c'</span>, <span class="ruby-value str">'d'</span>, <span class="ruby-value str">'e'</span>]
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">players</span> <span class="ruby-operator">==</span> <span class="ruby-value">6</span> ; [<span class="ruby-value str">'a'</span>, <span class="ruby-value str">'b'</span>, <span class="ruby-value str">'c'</span>, <span class="ruby-value str">'d'</span>, <span class="ruby-value str">'e'</span>, <span class="ruby-value str">'f'</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-ivar">@current_player</span> = <span class="ruby-value str">'a'</span>
+ <span class="ruby-ivar">@players</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">player</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">players_base</span> = <span class="ruby-ivar">@board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-identifier">player</span>]
+ (<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-identifier">pieces_each</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">count</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">piece</span> = <span class="ruby-constant">Piece</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">count</span>, <span class="ruby-identifier">players_base</span>, <span class="ruby-identifier">player</span>)
+ <span class="ruby-ivar">@pieces</span>[<span class="ruby-identifier">player</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">count</span>.<span class="ruby-identifier">to_s</span>] = <span class="ruby-identifier">piece</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>apply_move! (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 379</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">move</span>, <span class="ruby-identifier">player</span> = <span class="ruby-ivar">@current_player</span>)
+ <span class="ruby-comment cmt"># Check the move is a valid one</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-node">"Piece #{move.piece} does not exist"</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">name</span>)
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-node">"Player #{player} moving piece #{move.piece}"</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">player</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-node">"Attempting to move captured piece #{move.piece}"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">captured</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-node">"Attempting to move #{move.piece} onto or via base without captured pieces"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">via_base?</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">empty?</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>.<span class="ruby-identifier">safe?</span>
+ <span class="ruby-keyword kw">if</span> (<span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">find_all</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">position</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>}).<span class="ruby-identifier">length</span> <span class="ruby-operator">>=</span> <span class="ruby-value">3</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-node">"Attempting to move #{move.piece} onto safe position #{move.destination} when there are already three or more pieces there"</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">via_base?</span>
+ <span class="ruby-identifier">moved_distance</span> = <span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">player</span>] <span class="ruby-operator">+</span>
+ <span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">player</span>][<span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>.<span class="ruby-identifier">place</span>]
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">moved_distance</span> = <span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>.<span class="ruby-identifier">place</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-node">"Attempting to move piece #{move.piece} #{moved_distance} places (from #{move.piece.position} to #{move.destination})"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">moved_distance</span> <span class="ruby-operator"><</span> <span class="ruby-value">1</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">moved_distance</span> <span class="ruby-operator">></span> <span class="ruby-value">6</span>
+
+ <span class="ruby-comment cmt"># Apply this move</span>
+ <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">move_to</span>(<span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>)
+
+ <span class="ruby-comment cmt"># Capture anything already there (unless it's a safe place or a base, </span>
+ <span class="ruby-comment cmt"># or our own colour, or already captured)</span>
+ <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>.<span class="ruby-identifier">safe?</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>.<span class="ruby-identifier">base?</span>
+ <span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span>, <span class="ruby-identifier">target_piece</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">target_piece</span>.<span class="ruby-identifier">position</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span> <span class="ruby-keyword kw">and</span>
+ <span class="ruby-identifier">target_piece</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span> <span class="ruby-keyword kw">and</span>
+ <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">member?</span>(<span class="ruby-identifier">target_piece</span>) <span class="ruby-keyword kw">and</span>
+ <span class="ruby-identifier">target_piece</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">player</span> <span class="ruby-keyword kw">and</span>
+ <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">target_piece</span>.<span class="ruby-identifier">captured</span>
+ <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">capture</span>(<span class="ruby-identifier">target_piece</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+
+ <span class="ruby-comment cmt"># If the move was via our base, drop all captured pieces</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">via_base?</span>
+ <span class="ruby-identifier">capturers_base</span> = <span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">colour</span>]
+ <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">captured_piece</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">captured_piece</span>.<span class="ruby-identifier">move_to</span> <span class="ruby-identifier">capturers_base</span>
+ <span class="ruby-identifier">captured_piece</span>.<span class="ruby-identifier">captured</span> = <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">captured_piece</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">colour</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">contains</span> = []
+ <span class="ruby-keyword kw">end</span>
+
+ <span class="ruby-comment cmt"># Record the new stae</span>
+ <span class="ruby-identifier">this_game_state</span> = <span class="ruby-constant">GameState</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">move</span>, <span class="ruby-identifier">player</span>, <span class="ruby-ivar">@pieces</span>)
+ <span class="ruby-ivar">@history</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_game_state</span>
+
+ <span class="ruby-comment cmt"># Retain only players that have uncaptured pieces. </span>
+ <span class="ruby-comment cmt"># If there's only one player with uncaptured pieces, declare a win.</span>
+ <span class="ruby-identifier">potential_players</span> = []
+ <span class="ruby-ivar">@players</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> (<span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">values</span>.<span class="ruby-identifier">select</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">piece</span><span class="ruby-operator">|</span> <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">p</span>}).<span class="ruby-identifier">any?</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">piece</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">captured</span>}
+ <span class="ruby-identifier">potential_players</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">p</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-comment cmt"># potential_players << p if (@pieces.values.select {|p| p.colour == @current_player}).any? {|p| not p.captured}</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">potential_players</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator"><=</span> <span class="ruby-value">1</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">GameWonNotice</span>, <span class="ruby-node">"Game won by #{potential_players[0]}"</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-ivar">@players</span> = <span class="ruby-identifier">potential_players</span>.<span class="ruby-identifier">sort</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>undo_move! (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 445</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">undo_move!</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@history</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">1</span>
+ <span class="ruby-comment cmt"># general case</span>
+ <span class="ruby-identifier">state_to_restore</span> = <span class="ruby-ivar">@history</span>[<span class="ruby-value">-2</span>]
+ <span class="ruby-ivar">@current_player</span> = <span class="ruby-ivar">@history</span>[<span class="ruby-value">-1</span>].<span class="ruby-identifier">player</span>
+ <span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span>, <span class="ruby-identifier">piece</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">copy_piece</span> = <span class="ruby-identifier">state_to_restore</span>.<span class="ruby-identifier">pieces_after_move</span>[<span class="ruby-identifier">name</span>]
+ <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span> = <span class="ruby-identifier">copy_piece</span>.<span class="ruby-identifier">position</span>
+ <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">captured</span> = <span class="ruby-identifier">copy_piece</span>.<span class="ruby-identifier">captured</span>
+ <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">contains</span> = []
+ <span class="ruby-identifier">copy_piece</span>.<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span>
+<span class="ruby-comment cmt"># piece.capture(@pieces[p.name])</span>
+ <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">contains</span> <span class="ruby-operator"><<</span> <span class="ruby-ivar">@pieces</span>[<span class="ruby-identifier">p</span>.<span class="ruby-identifier">name</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-ivar">@history</span>.<span class="ruby-identifier">pop</span>
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-ivar">@history</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
+ <span class="ruby-comment cmt"># reset to start</span>
+ <span class="ruby-ivar">@current_player</span> = <span class="ruby-value str">'a'</span>
+ <span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span>, <span class="ruby-identifier">piece</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span> = <span class="ruby-ivar">@board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">colour</span>]
+ <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">captured</span> = <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">contains</span> = []
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-ivar">@history</span>.<span class="ruby-identifier">pop</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>apply_moves! (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 474</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">apply_moves!</span>(<span class="ruby-identifier">moves</span>)
+ <span class="ruby-identifier">moves</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">move</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">via_base?</span>
+ <span class="ruby-identifier">moved_distance</span> = <span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>][<span class="ruby-ivar">@current_player</span>] <span class="ruby-operator">+</span>
+ <span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-ivar">@current_player</span>][<span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>.<span class="ruby-identifier">place</span>]
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">moved_distance</span> = <span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>.<span class="ruby-identifier">place</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">move</span>, <span class="ruby-ivar">@current_player</span>)
+ <span class="ruby-identifier">next_player!</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">moved_distance</span> <span class="ruby-operator">==</span> <span class="ruby-value">6</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>next_player! (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 489</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">next_player!</span>
+ <span class="ruby-identifier">original_player</span> = <span class="ruby-ivar">@current_player</span>
+ <span class="ruby-keyword kw">begin</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@current_player</span> <span class="ruby-operator">==</span> <span class="ruby-ivar">@players</span>[<span class="ruby-value">-1</span>]
+ <span class="ruby-ivar">@current_player</span> = <span class="ruby-ivar">@players</span>[<span class="ruby-value">0</span>]
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-ivar">@current_player</span> = <span class="ruby-ivar">@players</span>[<span class="ruby-ivar">@players</span>.<span class="ruby-identifier">index</span>(<span class="ruby-ivar">@current_player</span>) <span class="ruby-operator">+</span> <span class="ruby-value">1</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span> <span class="ruby-keyword kw">while</span> (<span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">values</span>.<span class="ruby-identifier">select</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">==</span> <span class="ruby-ivar">@current_player</span>}).<span class="ruby-identifier">all?</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">captured</span>} <span class="ruby-keyword kw">and</span> <span class="ruby-ivar">@current_player</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">original_player</span>
+ <span class="ruby-ivar">@current_player</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>possible_moves (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 504</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">possible_moves</span>(<span class="ruby-identifier">die_result</span>, <span class="ruby-identifier">player</span> = <span class="ruby-ivar">@current_player</span>)
+ <span class="ruby-identifier">moves</span> = []
+ <span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">piece</span><span class="ruby-operator">|</span>
+ <span class="ruby-comment cmt"># only move current player's pieces, and only if they're not captured</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">player</span> <span class="ruby-keyword kw">and</span> (<span class="ruby-keyword kw">not</span> <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">captured</span>)
+ (<span class="ruby-ivar">@board</span>.<span class="ruby-identifier">valid_moves</span>[<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">die_result</span>]).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">destination</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">destination</span>.<span class="ruby-identifier">safe?</span>
+ <span class="ruby-keyword kw">if</span> (<span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">find_all</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">position</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">destination</span>}).<span class="ruby-identifier">length</span> <span class="ruby-operator"><</span> <span class="ruby-value">3</span>
+ <span class="ruby-identifier">moves</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">piece</span>, <span class="ruby-identifier">destination</span>, <span class="ruby-keyword kw">false</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">moves</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">piece</span>, <span class="ruby-identifier">destination</span>, <span class="ruby-keyword kw">false</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">destination</span>.<span class="ruby-identifier">base?</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-comment cmt"># if we can move to our base (but not already on it), add moves via that...</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">player</span>] <span class="ruby-operator"><=</span> <span class="ruby-identifier">die_result</span> <span class="ruby-keyword kw">and</span>
+ <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">player</span> <span class="ruby-keyword kw">and</span>
+ <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">empty?</span>
+ <span class="ruby-identifier">distance_after_base</span> = <span class="ruby-identifier">die_result</span> <span class="ruby-operator">-</span> <span class="ruby-ivar">@board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">player</span>]
+ (<span class="ruby-ivar">@board</span>.<span class="ruby-identifier">valid_moves</span>[<span class="ruby-identifier">player</span>][<span class="ruby-identifier">distance_after_base</span>]).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">destination</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">destination</span>.<span class="ruby-identifier">safe?</span>
+ <span class="ruby-keyword kw">if</span> (<span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">find_all</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">position</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">destination</span>}).<span class="ruby-identifier">length</span> <span class="ruby-operator"><</span> <span class="ruby-value">3</span>
+ <span class="ruby-identifier">moves</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">piece</span>, <span class="ruby-identifier">destination</span>, <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">moves</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">piece</span>, <span class="ruby-identifier">destination</span>, <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">moves</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>build_state_string (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 539</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">build_state_string</span>
+ <span class="ruby-identifier">outstr</span> = <span class="ruby-node">"Current player = #{@current_player}\n"</span>
+ <span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">sort</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">piece_name</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@pieces</span>[<span class="ruby-identifier">piece_name</span>].<span class="ruby-identifier">captured</span>
+ <span class="ruby-identifier">outstr</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"Piece #{piece_name} captured, at #{@pieces[piece_name].position}\n"</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">outstr</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"Piece #{piece_name} is at #{@pieces[piece_name].position}, holds #{(@pieces[piece_name].contains.collect{|c| c.name}).join(' ')}\n"</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">outstr</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>show_state (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 552</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">show_state</span>
+ <span class="ruby-identifier">puts</span> <span class="ruby-identifier">build_state_string</span>
+<span class="ruby-comment cmt"># @pieces.keys.sort.each do |piece_name|</span>
+<span class="ruby-comment cmt"># if @pieces[piece_name].captured</span>
+<span class="ruby-comment cmt"># puts "Piece #{piece_name} captured, at #{@pieces[piece_name].position}"</span>
+<span class="ruby-comment cmt"># else</span>
+<span class="ruby-comment cmt"># puts "Piece #{piece_name} is at #{@pieces[piece_name].position}, holds #{(@pieces[piece_name].contains.collect{|c| c.name}).join(' ')}"</span>
+<span class="ruby-comment cmt"># end</span>
+<span class="ruby-comment cmt"># end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_s (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 563</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
+ <span class="ruby-identifier">show_state</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_str (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 567</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_str</span>
+ <span class="ruby-identifier">to_s</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>read_game (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 576</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Game</span>.<span class="ruby-identifier">read_game</span>(<span class="ruby-identifier">gamelines</span>)
+ <span class="ruby-identifier">gamelines</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">l</span><span class="ruby-operator">|</span> <span class="ruby-identifier">l</span>.<span class="ruby-identifier">chomp!</span>}
+ <span class="ruby-identifier">game</span> = <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">gamelines</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">to_i</span>, <span class="ruby-value">6</span>, <span class="ruby-value">6</span>, <span class="ruby-value">6</span>, <span class="ruby-value">6</span>)
+ <span class="ruby-identifier">moves</span> = []
+ <span class="ruby-identifier">gamelines</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-2</span>].<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span> <span class="ruby-identifier">moves</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>)}
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">game</span>, <span class="ruby-identifier">moves</span>, <span class="ruby-identifier">gamelines</span>[<span class="ruby-value">-1</span>].<span class="ruby-identifier">to_i</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 329</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">players</span> = <span class="ruby-value">6</span>, <span class="ruby-identifier">spokes</span> = <span class="ruby-value">6</span>, <span class="ruby-identifier">spoke_length</span> = <span class="ruby-value">6</span>, <span class="ruby-identifier">arc_length</span> = <span class="ruby-value">6</span>,
+ <span class="ruby-identifier">pieces_each</span> = <span class="ruby-value">6</span>)
+ <span class="ruby-ivar">@board</span> = <span class="ruby-constant">Board</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">spokes</span>, <span class="ruby-identifier">spoke_length</span>, <span class="ruby-identifier">arc_length</span>)
+ <span class="ruby-ivar">@history</span> = []
+ <span class="ruby-ivar">@pieces</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
+ <span class="ruby-ivar">@players</span> = <span class="ruby-keyword kw">case</span>
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">players</span> <span class="ruby-operator">==</span> <span class="ruby-value">2</span> ; [<span class="ruby-value str">'a'</span>, <span class="ruby-value str">'d'</span>]
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">players</span> <span class="ruby-operator">==</span> <span class="ruby-value">3</span> ; [<span class="ruby-value str">'a'</span>, <span class="ruby-value str">'c'</span>, <span class="ruby-value str">'e'</span>]
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">players</span> <span class="ruby-operator">==</span> <span class="ruby-value">4</span> ; [<span class="ruby-value str">'a'</span>, <span class="ruby-value str">'b'</span>, <span class="ruby-value str">'d'</span>, <span class="ruby-value str">'e'</span>]
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">players</span> <span class="ruby-operator">==</span> <span class="ruby-value">5</span> ; [<span class="ruby-value str">'a'</span>, <span class="ruby-value str">'b'</span>, <span class="ruby-value str">'c'</span>, <span class="ruby-value str">'d'</span>, <span class="ruby-value str">'e'</span>]
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">players</span> <span class="ruby-operator">==</span> <span class="ruby-value">6</span> ; [<span class="ruby-value str">'a'</span>, <span class="ruby-value str">'b'</span>, <span class="ruby-value str">'c'</span>, <span class="ruby-value str">'d'</span>, <span class="ruby-value str">'e'</span>, <span class="ruby-value str">'f'</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-ivar">@current_player</span> = <span class="ruby-value str">'a'</span>
+ <span class="ruby-ivar">@players</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">player</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">players_base</span> = <span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-identifier">player</span>]
+ (<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-identifier">pieces_each</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">count</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">piece</span> = <span class="ruby-constant">Piece</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">count</span>, <span class="ruby-identifier">players_base</span>, <span class="ruby-identifier">player</span>)
+ <span class="ruby-ivar">@pieces</span>[<span class="ruby-identifier">player</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">count</span>.<span class="ruby-identifier">to_s</span>] = <span class="ruby-identifier">piece</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>apply_move (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 353</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">move</span>, <span class="ruby-identifier">player</span> = <span class="ruby-ivar">@current_player</span>)
+ <span class="ruby-comment cmt"># Check the move is a valid one</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-node">"Piece #{move.piece} does not exist"</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">name</span>)
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-node">"Player #{player} moving piece #{move.piece}"</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">player</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-node">"Attempting to move captured piece #{move.piece}"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">captured</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-node">"Attempting to move #{move.piece} onto or via base without captured pieces"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">via_base?</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">empty?</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>.<span class="ruby-identifier">safe?</span>
+ <span class="ruby-keyword kw">if</span> (<span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">find_all</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">position</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>}).<span class="ruby-identifier">length</span> <span class="ruby-operator">>=</span> <span class="ruby-value">3</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-node">"Attempting to move #{move.piece} onto safe position #{move.destination} when there are already three or more pieces there"</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">via_base?</span>
+ <span class="ruby-identifier">moved_distance</span> = <span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">player</span>] <span class="ruby-operator">+</span>
+ <span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">player</span>][<span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>.<span class="ruby-identifier">place</span>]
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">moved_distance</span> = <span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>.<span class="ruby-identifier">place</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-node">"Attempting to move piece #{move.piece} #{moved_distance} places"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">moved_distance</span> <span class="ruby-operator"><</span> <span class="ruby-value">1</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">moved_distance</span> <span class="ruby-operator">></span> <span class="ruby-value">6</span>
+
+ <span class="ruby-comment cmt"># Apply this move</span>
+ <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">move_to</span>(<span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>)
+
+ <span class="ruby-comment cmt"># Capture anything already there (unless it's a safe place or a base, </span>
+ <span class="ruby-comment cmt"># or our own colour)</span>
+ <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>.<span class="ruby-identifier">safe?</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>.<span class="ruby-identifier">base?</span>
+ <span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span>, <span class="ruby-identifier">target_piece</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">target_piece</span>.<span class="ruby-identifier">position</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span> <span class="ruby-keyword kw">and</span>
+ <span class="ruby-identifier">target_piece</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span> <span class="ruby-keyword kw">and</span>
+ <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">member?</span>(<span class="ruby-identifier">target_piece</span>) <span class="ruby-keyword kw">and</span>
+ <span class="ruby-identifier">target_piece</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">player</span>
+ <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">capture</span>(<span class="ruby-identifier">target_piece</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+
+ <span class="ruby-comment cmt"># If the move was via our base, drop all captured pieces</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">via_base?</span>
+ <span class="ruby-identifier">capturers_base</span> = <span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">colour</span>]
+ <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">captured_piece</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">captured_piece</span>.<span class="ruby-identifier">move_to</span> <span class="ruby-identifier">capturers_base</span>
+ <span class="ruby-identifier">captured_piece</span>.<span class="ruby-identifier">captured</span> = <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">captured_piece</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">colour</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">contains</span> = []
+ <span class="ruby-keyword kw">end</span>
+
+ <span class="ruby-comment cmt"># Record the new stae</span>
+ <span class="ruby-identifier">this_game_state</span> = <span class="ruby-constant">GameState</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">move</span>, <span class="ruby-identifier">player</span>, <span class="ruby-ivar">@pieces</span>)
+ <span class="ruby-ivar">@history</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_game_state</span>
+
+ <span class="ruby-comment cmt"># Retain only players that have uncaptured pieces. </span>
+ <span class="ruby-comment cmt"># If there's only one player with uncaptured pieces, declare a win.</span>
+ <span class="ruby-identifier">potential_players</span> = []
+ <span class="ruby-ivar">@players</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> (<span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">values</span>.<span class="ruby-identifier">select</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">piece</span><span class="ruby-operator">|</span> <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">p</span>}).<span class="ruby-identifier">any?</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">piece</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">captured</span>}
+ <span class="ruby-identifier">potential_players</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">p</span>
+ <span class="ruby-keyword kw">end</span>
+<span class="ruby-comment cmt"># potential_players << p if (@pieces.values.select {|p| p.colour == @current_player}).any? {|p| not p.captured}</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">potential_players</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator"><=</span> <span class="ruby-value">1</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">GameWonNotice</span>, <span class="ruby-node">"Game won by #{potential_players[0]}"</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-ivar">@players</span> = <span class="ruby-identifier">potential_players</span>.<span class="ruby-identifier">sort</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>apply_moves (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 419</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">apply_moves</span>(<span class="ruby-identifier">moves</span>)
+ <span class="ruby-identifier">moves</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">move</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">via_base?</span>
+ <span class="ruby-identifier">moved_distance</span> = <span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>][<span class="ruby-ivar">@current_player</span>] <span class="ruby-operator">+</span>
+ <span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-ivar">@current_player</span>][<span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>.<span class="ruby-identifier">place</span>]
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">moved_distance</span> = <span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>.<span class="ruby-identifier">place</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">move</span>, <span class="ruby-ivar">@current_player</span>)
+ <span class="ruby-identifier">next_player</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">moved_distance</span> <span class="ruby-operator">==</span> <span class="ruby-value">6</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>next_player (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 434</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">next_player</span>
+ <span class="ruby-identifier">original_player</span> = <span class="ruby-ivar">@current_player</span>
+ <span class="ruby-keyword kw">begin</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@current_player</span> <span class="ruby-operator">==</span> <span class="ruby-ivar">@players</span>[<span class="ruby-value">-1</span>]
+ <span class="ruby-ivar">@current_player</span> = <span class="ruby-ivar">@players</span>[<span class="ruby-value">0</span>]
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-ivar">@current_player</span> = <span class="ruby-ivar">@players</span>[<span class="ruby-ivar">@players</span>.<span class="ruby-identifier">index</span>(<span class="ruby-ivar">@current_player</span>) <span class="ruby-operator">+</span> <span class="ruby-value">1</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span> <span class="ruby-keyword kw">while</span> (<span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">values</span>.<span class="ruby-identifier">select</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">==</span> <span class="ruby-ivar">@current_player</span>}).<span class="ruby-identifier">all?</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">captured</span>} <span class="ruby-keyword kw">and</span> <span class="ruby-ivar">@current_player</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">original_player</span>
+ <span class="ruby-ivar">@current_player</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>possible_moves (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 448</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">possible_moves</span>(<span class="ruby-identifier">die_result</span>, <span class="ruby-identifier">player</span> = <span class="ruby-ivar">@current_player</span>)
+ <span class="ruby-identifier">moves</span> = []
+ <span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">piece</span><span class="ruby-operator">|</span>
+ <span class="ruby-comment cmt"># only move current player's pieces, and only if they're not captured</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">player</span> <span class="ruby-keyword kw">and</span> (<span class="ruby-keyword kw">not</span> <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">captured</span>)
+ (<span class="ruby-ivar">@board</span>.<span class="ruby-identifier">valid_moves</span>[<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">die_result</span>]).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">destination</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">destination</span>.<span class="ruby-identifier">safe?</span>
+ <span class="ruby-keyword kw">if</span> (<span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">find_all</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">position</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">destination</span>}).<span class="ruby-identifier">length</span> <span class="ruby-operator"><</span> <span class="ruby-value">3</span>
+ <span class="ruby-identifier">moves</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">piece</span>, <span class="ruby-identifier">destination</span>, <span class="ruby-keyword kw">false</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">moves</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">piece</span>, <span class="ruby-identifier">destination</span>, <span class="ruby-keyword kw">false</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">destination</span>.<span class="ruby-identifier">base?</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-comment cmt"># if we can move to our base (but not already on it), add moves via that...</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">player</span>] <span class="ruby-operator"><=</span> <span class="ruby-identifier">die_result</span> <span class="ruby-keyword kw">and</span>
+ <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">player</span> <span class="ruby-keyword kw">and</span>
+ <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">empty?</span>
+ <span class="ruby-identifier">distance_after_base</span> = <span class="ruby-identifier">die_result</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">player</span>]
+ (<span class="ruby-ivar">@board</span>.<span class="ruby-identifier">valid_moves</span>[<span class="ruby-identifier">player</span>][<span class="ruby-identifier">distance_after_base</span>]).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">destination</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">destination</span>.<span class="ruby-identifier">safe?</span>
+ <span class="ruby-keyword kw">if</span> (<span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">find_all</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">position</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">destination</span>}).<span class="ruby-identifier">length</span> <span class="ruby-operator"><</span> <span class="ruby-value">3</span>
+ <span class="ruby-identifier">moves</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">piece</span>, <span class="ruby-identifier">destination</span>, <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">moves</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">piece</span>, <span class="ruby-identifier">destination</span>, <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">moves</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>show_state (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 484</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">show_state</span>
+ <span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">sort</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">piece_name</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@pieces</span>[<span class="ruby-identifier">piece_name</span>].<span class="ruby-identifier">captured</span>
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">"Piece #{piece_name} captured, at #{@pieces[piece_name].position}"</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">"Piece #{piece_name} is at #{@pieces[piece_name].position}, holds #{(@pieces[piece_name].contains.collect{|c| c.name}).join(' ')}"</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>read_game (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 498</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Game</span>.<span class="ruby-identifier">read_game</span>(<span class="ruby-identifier">gamelines</span>)
+ <span class="ruby-identifier">gamelines</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">l</span><span class="ruby-operator">|</span> <span class="ruby-identifier">l</span>.<span class="ruby-identifier">chomp!</span>}
+ <span class="ruby-identifier">game</span> = <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">gamelines</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">to_i</span>, <span class="ruby-value">6</span>, <span class="ruby-value">6</span>, <span class="ruby-value">6</span>, <span class="ruby-value">6</span>)
+ <span class="ruby-identifier">moves</span> = []
+ <span class="ruby-identifier">gamelines</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-2</span>].<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span> <span class="ruby-identifier">moves</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>)}
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">game</span>, <span class="ruby-identifier">moves</span>, <span class="ruby-identifier">gamelines</span>[<span class="ruby-value">-1</span>].<span class="ruby-identifier">to_i</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 318</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">players</span> = <span class="ruby-value">6</span>, <span class="ruby-identifier">spokes</span> = <span class="ruby-value">6</span>, <span class="ruby-identifier">spoke_length</span> = <span class="ruby-value">6</span>, <span class="ruby-identifier">arc_length</span> = <span class="ruby-value">6</span>, <span class="ruby-identifier">pieces_each</span> = <span class="ruby-value">6</span>)
+ <span class="ruby-ivar">@board</span> = <span class="ruby-constant">Board</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">spokes</span>, <span class="ruby-identifier">spoke_length</span>, <span class="ruby-identifier">arc_length</span>)
+ <span class="ruby-ivar">@history</span> = []
+ <span class="ruby-ivar">@pieces</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
+ <span class="ruby-ivar">@players</span> = <span class="ruby-keyword kw">case</span>
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">players</span> <span class="ruby-operator">==</span> <span class="ruby-value">2</span> ; [<span class="ruby-value str">'a'</span>, <span class="ruby-value str">'d'</span>]
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">players</span> <span class="ruby-operator">==</span> <span class="ruby-value">3</span> ; [<span class="ruby-value str">'a'</span>, <span class="ruby-value str">'c'</span>, <span class="ruby-value str">'e'</span>]
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">players</span> <span class="ruby-operator">==</span> <span class="ruby-value">4</span> ; [<span class="ruby-value str">'a'</span>, <span class="ruby-value str">'b'</span>, <span class="ruby-value str">'d'</span>, <span class="ruby-value str">'e'</span>]
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">players</span> <span class="ruby-operator">==</span> <span class="ruby-value">5</span> ; [<span class="ruby-value str">'a'</span>, <span class="ruby-value str">'b'</span>, <span class="ruby-value str">'c'</span>, <span class="ruby-value str">'d'</span>, <span class="ruby-value str">'e'</span>]
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">players</span> <span class="ruby-operator">==</span> <span class="ruby-value">6</span> ; [<span class="ruby-value str">'a'</span>, <span class="ruby-value str">'b'</span>, <span class="ruby-value str">'c'</span>, <span class="ruby-value str">'d'</span>, <span class="ruby-value str">'e'</span>, <span class="ruby-value str">'f'</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-ivar">@current_player</span> = <span class="ruby-value str">'a'</span>
+ <span class="ruby-ivar">@players</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">player</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">players_base</span> = <span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-identifier">player</span>]
+ (<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-identifier">pieces_each</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">count</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">piece</span> = <span class="ruby-constant">Piece</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">count</span>, <span class="ruby-identifier">players_base</span>, <span class="ruby-identifier">player</span>)
+ <span class="ruby-ivar">@pieces</span>[<span class="ruby-identifier">player</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">count</span>.<span class="ruby-identifier">to_s</span>] = <span class="ruby-identifier">piece</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>apply_move (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 341</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">move</span>, <span class="ruby-identifier">player</span> = <span class="ruby-ivar">@current_player</span>)
+ <span class="ruby-comment cmt"># Check the move is a valid one</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-node">"Piece #{move.piece} does not exist"</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">name</span>)
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-node">"Player #{player} moving piece #{move.piece}"</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">player</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-node">"Attempting to move captured piece #{move.piece}"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">captured</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-node">"Attempting to move #{move.piece} onto or via base without captured pieces"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">via_base?</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">empty?</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>.<span class="ruby-identifier">safe?</span>
+ <span class="ruby-keyword kw">if</span> (<span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">find_all</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">position</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>}).<span class="ruby-identifier">length</span> <span class="ruby-operator">>=</span> <span class="ruby-value">3</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-node">"Attempting to move #{move.piece} onto safe position #{move.destination} when there are already three or more pieces there"</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">via_base?</span>
+ <span class="ruby-identifier">moved_distance</span> = <span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">player</span>] <span class="ruby-operator">+</span>
+ <span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">player</span>][<span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>.<span class="ruby-identifier">place</span>]
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">moved_distance</span> = <span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>.<span class="ruby-identifier">place</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-node">"Attempting to move piece #{move.piece} #{moved_distance} places"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">moved_distance</span> <span class="ruby-operator"><</span> <span class="ruby-value">1</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">moved_distance</span> <span class="ruby-operator">></span> <span class="ruby-value">6</span>
+
+ <span class="ruby-comment cmt"># Apply this move</span>
+ <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">move_to</span>(<span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>)
+
+ <span class="ruby-comment cmt"># Capture anything already there (unless it's a safe place or a base, or our own colour)</span>
+ <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>.<span class="ruby-identifier">safe?</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>.<span class="ruby-identifier">base?</span>
+ <span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span>, <span class="ruby-identifier">target_piece</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">target_piece</span>.<span class="ruby-identifier">position</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span> <span class="ruby-keyword kw">and</span>
+ <span class="ruby-identifier">target_piece</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span> <span class="ruby-keyword kw">and</span>
+ <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">member?</span>(<span class="ruby-identifier">target_piece</span>) <span class="ruby-keyword kw">and</span>
+ <span class="ruby-identifier">target_piece</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">player</span>
+ <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">capture</span>(<span class="ruby-identifier">target_piece</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+
+ <span class="ruby-comment cmt"># If the move was via our base, drop all captured pieces</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">via_base?</span>
+ <span class="ruby-identifier">capturers_base</span> = <span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">colour</span>]
+ <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">captured_piece</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">captured_piece</span>.<span class="ruby-identifier">move_to</span> <span class="ruby-identifier">capturers_base</span>
+ <span class="ruby-identifier">captured_piece</span>.<span class="ruby-identifier">captured</span> = <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">captured_piece</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">colour</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">contains</span> = []
+ <span class="ruby-keyword kw">end</span>
+
+ <span class="ruby-comment cmt"># Record the new stae</span>
+ <span class="ruby-identifier">this_game_state</span> = <span class="ruby-constant">GameState</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">move</span>, <span class="ruby-identifier">player</span>, <span class="ruby-ivar">@pieces</span>)
+ <span class="ruby-ivar">@history</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_game_state</span>
+
+ <span class="ruby-comment cmt"># If there's only one player with uncaptured pieces, declare a win</span>
+ <span class="ruby-identifier">potential_players</span> = []
+ <span class="ruby-ivar">@players</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">potential_players</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">p</span> <span class="ruby-keyword kw">if</span> (<span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">values</span>.<span class="ruby-identifier">select</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">==</span> <span class="ruby-ivar">@current_player</span>}).<span class="ruby-identifier">any?</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">captured</span>}
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">potential_players</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator"><=</span> <span class="ruby-value">1</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">GameWonNotice</span>, <span class="ruby-node">"Game won by #{potential_players[0]}"</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>apply_moves (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 401</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">apply_moves</span>(<span class="ruby-identifier">moves</span>)
+ <span class="ruby-identifier">moves</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">move</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">via_base?</span>
+ <span class="ruby-identifier">moved_distance</span> = <span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>][<span class="ruby-ivar">@current_player</span>] <span class="ruby-operator">+</span>
+ <span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-ivar">@current_player</span>][<span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>.<span class="ruby-identifier">place</span>]
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">moved_distance</span> = <span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>.<span class="ruby-identifier">place</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">move</span>, <span class="ruby-ivar">@current_player</span>)
+ <span class="ruby-identifier">next_player</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">moved_distance</span> <span class="ruby-operator">==</span> <span class="ruby-value">6</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>next_player (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 416</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">next_player</span>
+ <span class="ruby-identifier">original_player</span> = <span class="ruby-ivar">@current_player</span>
+ <span class="ruby-keyword kw">begin</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@current_player</span> <span class="ruby-operator">==</span> <span class="ruby-ivar">@players</span>[<span class="ruby-value">-1</span>]
+ <span class="ruby-ivar">@current_player</span> = <span class="ruby-ivar">@players</span>[<span class="ruby-value">0</span>]
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-ivar">@current_player</span> = <span class="ruby-ivar">@players</span>[<span class="ruby-ivar">@players</span>.<span class="ruby-identifier">index</span>(<span class="ruby-ivar">@current_player</span>) <span class="ruby-operator">+</span> <span class="ruby-value">1</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span> <span class="ruby-keyword kw">while</span> (<span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">values</span>.<span class="ruby-identifier">select</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">==</span> <span class="ruby-ivar">@current_player</span>}).<span class="ruby-identifier">all?</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">captured</span>} <span class="ruby-keyword kw">and</span> <span class="ruby-ivar">@current_player</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">original_player</span>
+ <span class="ruby-ivar">@current_player</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>possible_moves (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 430</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">possible_moves</span>(<span class="ruby-identifier">die_result</span>, <span class="ruby-identifier">player</span> = <span class="ruby-ivar">@current_player</span>)
+ <span class="ruby-identifier">moves</span> = []
+ <span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">piece</span><span class="ruby-operator">|</span>
+ <span class="ruby-comment cmt"># only move current player's pieces, and only if they're not captured</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">player</span> <span class="ruby-keyword kw">and</span> (<span class="ruby-keyword kw">not</span> <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">captured</span>)
+ (<span class="ruby-ivar">@board</span>.<span class="ruby-identifier">valid_moves</span>[<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">die_result</span>]).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">destination</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">destination</span>.<span class="ruby-identifier">safe?</span>
+ <span class="ruby-keyword kw">if</span> (<span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">find_all</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">position</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">destination</span>}).<span class="ruby-identifier">length</span> <span class="ruby-operator"><</span> <span class="ruby-value">3</span>
+ <span class="ruby-identifier">moves</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">piece</span>, <span class="ruby-identifier">destination</span>, <span class="ruby-keyword kw">false</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">moves</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">piece</span>, <span class="ruby-identifier">destination</span>, <span class="ruby-keyword kw">false</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">destination</span>.<span class="ruby-identifier">base?</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-comment cmt"># if we can move to our base (but not already on it), add moves via that...</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">player</span>] <span class="ruby-operator"><=</span> <span class="ruby-identifier">die_result</span> <span class="ruby-keyword kw">and</span>
+ <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">player</span> <span class="ruby-keyword kw">and</span>
+ <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">empty?</span>
+ <span class="ruby-identifier">distance_after_base</span> = <span class="ruby-identifier">die_result</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">player</span>]
+ (<span class="ruby-ivar">@board</span>.<span class="ruby-identifier">valid_moves</span>[<span class="ruby-identifier">player</span>][<span class="ruby-identifier">distance_after_base</span>]).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">destination</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">destination</span>.<span class="ruby-identifier">safe?</span>
+ <span class="ruby-keyword kw">if</span> (<span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">find_all</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">position</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">destination</span>}).<span class="ruby-identifier">length</span> <span class="ruby-operator"><</span> <span class="ruby-value">3</span>
+ <span class="ruby-identifier">moves</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">piece</span>, <span class="ruby-identifier">destination</span>, <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">moves</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">piece</span>, <span class="ruby-identifier">destination</span>, <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">moves</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>show_state (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 466</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">show_state</span>
+ <span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">sort</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">piece_name</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@pieces</span>[<span class="ruby-identifier">piece_name</span>].<span class="ruby-identifier">captured</span>
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">"Piece #{piece_name} captured, at #{@pieces[piece_name].position}"</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">"Piece #{piece_name} is at #{@pieces[piece_name].position}, holds #{(@pieces[piece_name].contains.collect{|c| c.name}).join(' ')}"</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>read_game (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 480</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Game</span>.<span class="ruby-identifier">read_game</span>(<span class="ruby-identifier">gamelines</span>)
+ <span class="ruby-identifier">gamelines</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">l</span><span class="ruby-operator">|</span> <span class="ruby-identifier">l</span>.<span class="ruby-identifier">chomp!</span>}
+ <span class="ruby-identifier">game</span> = <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">gamelines</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">to_i</span>, <span class="ruby-value">6</span>, <span class="ruby-value">6</span>, <span class="ruby-value">6</span>, <span class="ruby-value">6</span>)
+ <span class="ruby-identifier">moves</span> = []
+ <span class="ruby-identifier">gamelines</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-2</span>].<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span> <span class="ruby-identifier">moves</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>)}
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">game</span>, <span class="ruby-identifier">moves</span>, <span class="ruby-identifier">gamelines</span>[<span class="ruby-value">-1</span>].<span class="ruby-identifier">to_i</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 355</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">players</span> = <span class="ruby-value">6</span>, <span class="ruby-identifier">spokes</span> = <span class="ruby-value">6</span>, <span class="ruby-identifier">spoke_length</span> = <span class="ruby-value">6</span>, <span class="ruby-identifier">arc_length</span> = <span class="ruby-value">6</span>,
+ <span class="ruby-identifier">pieces_each</span> = <span class="ruby-value">6</span>)
+ <span class="ruby-ivar">@board</span> = <span class="ruby-constant">Board</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">spokes</span>, <span class="ruby-identifier">spoke_length</span>, <span class="ruby-identifier">arc_length</span>)
+ <span class="ruby-ivar">@history</span> = []
+ <span class="ruby-ivar">@pieces</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
+ <span class="ruby-ivar">@players</span> = <span class="ruby-keyword kw">case</span>
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">players</span> <span class="ruby-operator">==</span> <span class="ruby-value">2</span> ; [<span class="ruby-value str">'a'</span>, <span class="ruby-value str">'d'</span>]
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">players</span> <span class="ruby-operator">==</span> <span class="ruby-value">3</span> ; [<span class="ruby-value str">'a'</span>, <span class="ruby-value str">'c'</span>, <span class="ruby-value str">'e'</span>]
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">players</span> <span class="ruby-operator">==</span> <span class="ruby-value">4</span> ; [<span class="ruby-value str">'a'</span>, <span class="ruby-value str">'b'</span>, <span class="ruby-value str">'d'</span>, <span class="ruby-value str">'e'</span>]
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">players</span> <span class="ruby-operator">==</span> <span class="ruby-value">5</span> ; [<span class="ruby-value str">'a'</span>, <span class="ruby-value str">'b'</span>, <span class="ruby-value str">'c'</span>, <span class="ruby-value str">'d'</span>, <span class="ruby-value str">'e'</span>]
+ <span class="ruby-keyword kw">when</span> <span class="ruby-identifier">players</span> <span class="ruby-operator">==</span> <span class="ruby-value">6</span> ; [<span class="ruby-value str">'a'</span>, <span class="ruby-value str">'b'</span>, <span class="ruby-value str">'c'</span>, <span class="ruby-value str">'d'</span>, <span class="ruby-value str">'e'</span>, <span class="ruby-value str">'f'</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-ivar">@current_player</span> = <span class="ruby-value str">'a'</span>
+ <span class="ruby-ivar">@players</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">player</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">players_base</span> = <span class="ruby-ivar">@board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-identifier">player</span>]
+ (<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-identifier">pieces_each</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">count</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">piece</span> = <span class="ruby-constant">Piece</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">count</span>, <span class="ruby-identifier">players_base</span>, <span class="ruby-identifier">player</span>)
+ <span class="ruby-ivar">@pieces</span>[<span class="ruby-identifier">player</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">count</span>.<span class="ruby-identifier">to_s</span>] = <span class="ruby-identifier">piece</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>apply_move! (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 379</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">move</span>, <span class="ruby-identifier">player</span> = <span class="ruby-ivar">@current_player</span>)
+ <span class="ruby-comment cmt"># Check the move is a valid one</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-node">"Piece #{move.piece} does not exist"</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">name</span>)
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-node">"Player #{player} moving piece #{move.piece}"</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">player</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-node">"Attempting to move captured piece #{move.piece}"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">captured</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-node">"Attempting to move #{move.piece} onto or via base without captured pieces"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">via_base?</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">empty?</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>.<span class="ruby-identifier">safe?</span>
+ <span class="ruby-keyword kw">if</span> (<span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">find_all</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">position</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>}).<span class="ruby-identifier">length</span> <span class="ruby-operator">>=</span> <span class="ruby-value">3</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-node">"Attempting to move #{move.piece} onto safe position #{move.destination} when there are already three or more pieces there"</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">via_base?</span>
+ <span class="ruby-identifier">moved_distance</span> = <span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">player</span>] <span class="ruby-operator">+</span>
+ <span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">player</span>][<span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>.<span class="ruby-identifier">place</span>]
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">moved_distance</span> = <span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>.<span class="ruby-identifier">place</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-node">"Attempting to move piece #{move.piece} #{moved_distance} places (from #{move.piece.position} to #{move.destination})"</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">moved_distance</span> <span class="ruby-operator"><</span> <span class="ruby-value">1</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">moved_distance</span> <span class="ruby-operator">></span> <span class="ruby-value">6</span>
+
+ <span class="ruby-comment cmt"># Apply this move</span>
+ <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">move_to</span>(<span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>)
+
+ <span class="ruby-comment cmt"># Capture anything already there (unless it's a safe place or a base, </span>
+ <span class="ruby-comment cmt"># or our own colour, or already captured)</span>
+ <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>.<span class="ruby-identifier">safe?</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>.<span class="ruby-identifier">base?</span>
+ <span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span>, <span class="ruby-identifier">target_piece</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">target_piece</span>.<span class="ruby-identifier">position</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span> <span class="ruby-keyword kw">and</span>
+ <span class="ruby-identifier">target_piece</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span> <span class="ruby-keyword kw">and</span>
+ <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">member?</span>(<span class="ruby-identifier">target_piece</span>) <span class="ruby-keyword kw">and</span>
+ <span class="ruby-identifier">target_piece</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">player</span> <span class="ruby-keyword kw">and</span>
+ <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">target_piece</span>.<span class="ruby-identifier">captured</span>
+ <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">capture</span>(<span class="ruby-identifier">target_piece</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+
+ <span class="ruby-comment cmt"># If the move was via our base, drop all captured pieces</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">via_base?</span>
+ <span class="ruby-identifier">capturers_base</span> = <span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">colour</span>]
+ <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">captured_piece</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">captured_piece</span>.<span class="ruby-identifier">move_to</span> <span class="ruby-identifier">capturers_base</span>
+ <span class="ruby-identifier">captured_piece</span>.<span class="ruby-identifier">captured</span> = <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">captured_piece</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">colour</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">contains</span> = []
+ <span class="ruby-keyword kw">end</span>
+
+ <span class="ruby-comment cmt"># Record the new stae</span>
+ <span class="ruby-identifier">this_game_state</span> = <span class="ruby-constant">GameState</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">move</span>, <span class="ruby-identifier">player</span>, <span class="ruby-ivar">@pieces</span>)
+ <span class="ruby-ivar">@history</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">this_game_state</span>
+
+ <span class="ruby-comment cmt"># Retain only players that have uncaptured pieces. </span>
+ <span class="ruby-comment cmt"># If there's only one player with uncaptured pieces, declare a win.</span>
+ <span class="ruby-identifier">potential_players</span> = []
+ <span class="ruby-ivar">@players</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> (<span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">values</span>.<span class="ruby-identifier">select</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">piece</span><span class="ruby-operator">|</span> <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">p</span>}).<span class="ruby-identifier">any?</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">piece</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">captured</span>}
+ <span class="ruby-identifier">potential_players</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">p</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-comment cmt"># potential_players << p if (@pieces.values.select {|p| p.colour == @current_player}).any? {|p| not p.captured}</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">potential_players</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator"><=</span> <span class="ruby-value">1</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">GameWonNotice</span>, <span class="ruby-node">"Game won by #{potential_players[0]}"</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-ivar">@players</span> = <span class="ruby-identifier">potential_players</span>.<span class="ruby-identifier">sort</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>undo_move! (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 445</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">undo_move!</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@history</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">1</span>
+ <span class="ruby-comment cmt"># general case</span>
+ <span class="ruby-identifier">state_to_restore</span> = <span class="ruby-ivar">@history</span>[<span class="ruby-value">-2</span>]
+ <span class="ruby-ivar">@current_player</span> = <span class="ruby-ivar">@history</span>[<span class="ruby-value">-1</span>].<span class="ruby-identifier">player</span>
+ <span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span>, <span class="ruby-identifier">piece</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">copy_piece</span> = <span class="ruby-identifier">state_to_restore</span>.<span class="ruby-identifier">pieces_after_move</span>[<span class="ruby-identifier">name</span>]
+ <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span> = <span class="ruby-identifier">copy_piece</span>.<span class="ruby-identifier">position</span>
+ <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">captured</span> = <span class="ruby-identifier">copy_piece</span>.<span class="ruby-identifier">captured</span>
+ <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">contains</span> = []
+ <span class="ruby-identifier">copy_piece</span>.<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span>
+<span class="ruby-comment cmt"># piece.capture(@pieces[p.name])</span>
+ <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">contains</span> <span class="ruby-operator"><<</span> <span class="ruby-ivar">@pieces</span>[<span class="ruby-identifier">p</span>.<span class="ruby-identifier">name</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-ivar">@history</span>.<span class="ruby-identifier">pop</span>
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-ivar">@history</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span>
+ <span class="ruby-comment cmt"># reset to start</span>
+ <span class="ruby-ivar">@current_player</span> = <span class="ruby-value str">'a'</span>
+ <span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">name</span>, <span class="ruby-identifier">piece</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span> = <span class="ruby-ivar">@board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">colour</span>]
+ <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">captured</span> = <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">contains</span> = []
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-ivar">@history</span>.<span class="ruby-identifier">pop</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>apply_moves! (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 474</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">apply_moves!</span>(<span class="ruby-identifier">moves</span>)
+ <span class="ruby-identifier">moves</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">move</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">move</span>.<span class="ruby-identifier">via_base?</span>
+ <span class="ruby-identifier">moved_distance</span> = <span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>][<span class="ruby-ivar">@current_player</span>] <span class="ruby-operator">+</span>
+ <span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-ivar">@current_player</span>][<span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>.<span class="ruby-identifier">place</span>]
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">moved_distance</span> = <span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">move</span>.<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">move</span>.<span class="ruby-identifier">destination</span>.<span class="ruby-identifier">place</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">move</span>, <span class="ruby-ivar">@current_player</span>)
+ <span class="ruby-identifier">next_player!</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">moved_distance</span> <span class="ruby-operator">==</span> <span class="ruby-value">6</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>next_player! (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 489</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">next_player!</span>
+ <span class="ruby-identifier">original_player</span> = <span class="ruby-ivar">@current_player</span>
+ <span class="ruby-keyword kw">begin</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@current_player</span> <span class="ruby-operator">==</span> <span class="ruby-ivar">@players</span>[<span class="ruby-value">-1</span>]
+ <span class="ruby-ivar">@current_player</span> = <span class="ruby-ivar">@players</span>[<span class="ruby-value">0</span>]
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-ivar">@current_player</span> = <span class="ruby-ivar">@players</span>[<span class="ruby-ivar">@players</span>.<span class="ruby-identifier">index</span>(<span class="ruby-ivar">@current_player</span>) <span class="ruby-operator">+</span> <span class="ruby-value">1</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span> <span class="ruby-keyword kw">while</span> (<span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">values</span>.<span class="ruby-identifier">select</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">==</span> <span class="ruby-ivar">@current_player</span>}).<span class="ruby-identifier">all?</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">captured</span>} <span class="ruby-keyword kw">and</span> <span class="ruby-ivar">@current_player</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">original_player</span>
+ <span class="ruby-ivar">@current_player</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>possible_moves (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 504</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">possible_moves</span>(<span class="ruby-identifier">die_result</span>, <span class="ruby-identifier">player</span> = <span class="ruby-ivar">@current_player</span>)
+ <span class="ruby-identifier">moves</span> = []
+ <span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">key</span>, <span class="ruby-identifier">piece</span><span class="ruby-operator">|</span>
+ <span class="ruby-comment cmt"># only move current player's pieces, and only if they're not captured</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">player</span> <span class="ruby-keyword kw">and</span> (<span class="ruby-keyword kw">not</span> <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">captured</span>)
+ (<span class="ruby-ivar">@board</span>.<span class="ruby-identifier">valid_moves</span>[<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">die_result</span>]).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">destination</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">destination</span>.<span class="ruby-identifier">safe?</span>
+ <span class="ruby-keyword kw">if</span> (<span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">find_all</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">position</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">destination</span>}).<span class="ruby-identifier">length</span> <span class="ruby-operator"><</span> <span class="ruby-value">3</span>
+ <span class="ruby-identifier">moves</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">piece</span>, <span class="ruby-identifier">destination</span>, <span class="ruby-keyword kw">false</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">moves</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">piece</span>, <span class="ruby-identifier">destination</span>, <span class="ruby-keyword kw">false</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">destination</span>.<span class="ruby-identifier">base?</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-comment cmt"># if we can move to our base (but not already on it), add moves via that...</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">player</span>] <span class="ruby-operator"><=</span> <span class="ruby-identifier">die_result</span> <span class="ruby-keyword kw">and</span>
+ <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">player</span> <span class="ruby-keyword kw">and</span>
+ <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">empty?</span>
+ <span class="ruby-identifier">distance_after_base</span> = <span class="ruby-identifier">die_result</span> <span class="ruby-operator">-</span> <span class="ruby-ivar">@board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">player</span>]
+ (<span class="ruby-ivar">@board</span>.<span class="ruby-identifier">valid_moves</span>[<span class="ruby-identifier">player</span>][<span class="ruby-identifier">distance_after_base</span>]).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">destination</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">destination</span>.<span class="ruby-identifier">safe?</span>
+ <span class="ruby-keyword kw">if</span> (<span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">find_all</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">position</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">destination</span>}).<span class="ruby-identifier">length</span> <span class="ruby-operator"><</span> <span class="ruby-value">3</span>
+ <span class="ruby-identifier">moves</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">piece</span>, <span class="ruby-identifier">destination</span>, <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">moves</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">piece</span>, <span class="ruby-identifier">destination</span>, <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">moves</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>build_state_string (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 539</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">build_state_string</span>
+ <span class="ruby-identifier">outstr</span> = <span class="ruby-node">"Current player = #{@current_player}\n"</span>
+ <span class="ruby-ivar">@pieces</span>.<span class="ruby-identifier">keys</span>.<span class="ruby-identifier">sort</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">piece_name</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@pieces</span>[<span class="ruby-identifier">piece_name</span>].<span class="ruby-identifier">captured</span>
+ <span class="ruby-identifier">outstr</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"Piece #{piece_name} captured, at #{@pieces[piece_name].position}\n"</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">outstr</span> <span class="ruby-operator"><<</span> <span class="ruby-node">"Piece #{piece_name} is at #{@pieces[piece_name].position}, holds #{(@pieces[piece_name].contains.collect{|c| c.name}).join(' ')}\n"</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">outstr</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>show_state (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 552</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">show_state</span>
+ <span class="ruby-identifier">puts</span> <span class="ruby-identifier">build_state_string</span>
+<span class="ruby-comment cmt"># @pieces.keys.sort.each do |piece_name|</span>
+<span class="ruby-comment cmt"># if @pieces[piece_name].captured</span>
+<span class="ruby-comment cmt"># puts "Piece #{piece_name} captured, at #{@pieces[piece_name].position}"</span>
+<span class="ruby-comment cmt"># else</span>
+<span class="ruby-comment cmt"># puts "Piece #{piece_name} is at #{@pieces[piece_name].position}, holds #{(@pieces[piece_name].contains.collect{|c| c.name}).join(' ')}"</span>
+<span class="ruby-comment cmt"># end</span>
+<span class="ruby-comment cmt"># end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_s (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 563</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
+ <span class="ruby-identifier">show_state</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_str (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 567</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_str</span>
+ <span class="ruby-identifier">to_s</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>read_game (Game)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 576</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-constant">Game</span>.<span class="ruby-identifier">read_game</span>(<span class="ruby-identifier">gamelines</span>)
+ <span class="ruby-identifier">gamelines</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">l</span><span class="ruby-operator">|</span> <span class="ruby-identifier">l</span>.<span class="ruby-identifier">chomp!</span>}
+ <span class="ruby-identifier">game</span> = <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">gamelines</span>[<span class="ruby-value">0</span>].<span class="ruby-identifier">to_i</span>, <span class="ruby-value">6</span>, <span class="ruby-value">6</span>, <span class="ruby-value">6</span>, <span class="ruby-value">6</span>)
+ <span class="ruby-identifier">moves</span> = []
+ <span class="ruby-identifier">gamelines</span>[<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-value">-2</span>].<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span> <span class="ruby-identifier">moves</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>)}
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">game</span>, <span class="ruby-identifier">moves</span>, <span class="ruby-identifier">gamelines</span>[<span class="ruby-value">-1</span>].<span class="ruby-identifier">to_i</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Class: GameHandler</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="classHeader">
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Class</strong></td>
+ <td class="class-name-in-header">GameHandler</td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>In:</strong></td>
+ <td>
+ <a href="../files/src/play_rb.html">
+ src/play.rb
+ </a>
+ <br />
+ </td>
+ </tr>
+
+ <tr class="top-aligned-row">
+ <td><strong>Parent:</strong></td>
+ <td>
+ Object
+ </td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <p>
+Play a game to completion, given a set of player agents.
+</p>
+
+ </div>
+
+
+ </div>
+
+ <div id="method-list">
+ <h3 class="section-bar">Methods</h3>
+
+ <div class="name-list">
+ <a href="#M000011">new</a>
+ <a href="#M000012">play</a>
+ </div>
+ </div>
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+ <div id="attribute-list">
+ <h3 class="section-bar">Attributes</h3>
+
+ <div class="name-list">
+ <table>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">game</td>
+ <td class="context-item-value"> [R] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ </table>
+ </div>
+ </div>
+
+
+
+ <!-- if method_list -->
+ <div id="methods">
+ <h3 class="section-bar">Public Class methods</h3>
+
+ <div id="method-M000011" class="method-detail">
+ <a name="M000011"></a>
+
+ <div class="method-heading">
+ <a href="GameHandler.src/M000011.html" target="Code" class="method-signature"
+ onclick="popupCode('GameHandler.src/M000011.html');return false;">
+ <span class="method-name">new</span><span class="method-args">(players, limit = 5000, verbose = false, very_verbose = false)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Create a game handler that uses a set of players
+</p>
+ </div>
+ </div>
+
+ <h3 class="section-bar">Public Instance methods</h3>
+
+ <div id="method-M000012" class="method-detail">
+ <a name="M000012"></a>
+
+ <div class="method-heading">
+ <a href="GameHandler.src/M000012.html" target="Code" class="method-signature"
+ onclick="popupCode('GameHandler.src/M000012.html');return false;">
+ <span class="method-name">play</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Play a game of Trap the Cap. If players make illegal moves, disqualify them
+and restart the game. Terminate the game if there‘s a winner,
+there‘s only one player left, or the game has gone on too long.
+</p>
+ </div>
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+K 25
+svn:wc:ra_dav:version-url
+V 66
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/GameHandler.src
+END
+M000011.html
+K 25
+svn:wc:ra_dav:version-url
+V 79
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/GameHandler.src/M000011.html
+END
+M000012.html
+K 25
+svn:wc:ra_dav:version-url
+V 79
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/GameHandler.src/M000012.html
+END
+M000015.html
+K 25
+svn:wc:ra_dav:version-url
+V 79
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/GameHandler.src/M000015.html
+END
+M000007.html
+K 25
+svn:wc:ra_dav:version-url
+V 79
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/GameHandler.src/M000007.html
+END
+M000016.html
+K 25
+svn:wc:ra_dav:version-url
+V 79
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/GameHandler.src/M000016.html
+END
+M000008.html
+K 25
+svn:wc:ra_dav:version-url
+V 79
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/GameHandler.src/M000008.html
+END
--- /dev/null
+8
+
+dir
+68
+http://scripts.njae.me.uk/svn/njae/TrapTheCap/trunk/doc/classes/GameHandler.src
+http://scripts.njae.me.uk/svn/njae
+
+
+
+2008-10-16T14:11:23.436422Z
+41
+
+
+
+svn:special svn:externals svn:needs-lock
+\f
+M000011.html
+file
+
+
+
+
+2008-04-23T19:33:07.000000Z
+939077acf9214bad9823993b168f41fd
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000012.html
+file
+
+
+
+
+2008-04-23T19:33:07.000000Z
+2b3aed430837f7fcb7efcc0215aa15b1
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000015.html
+file
+
+
+
+
+2008-03-28T15:44:41.000000Z
+a7006ef4f9d9898134b63084e0f5ee93
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000007.html
+file
+
+
+
+
+2008-04-23T19:29:25.000000Z
+52c636847bfcbf3e9c7c30bf40a14eb7
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000016.html
+file
+
+
+
+
+2008-03-28T15:44:41.000000Z
+04d010669eee28801a59cb0aa2d7f136
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000008.html
+file
+
+
+
+
+2008-04-23T19:29:25.000000Z
+92ef1798c25bf920d3d3fece94068477
+2008-10-16T14:11:23.436422Z
+41
+\f
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (GameHandler)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File src/play.rb, line 17</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">players</span>, <span class="ruby-identifier">limit</span> = <span class="ruby-value">5000</span>, <span class="ruby-identifier">verbose</span> = <span class="ruby-keyword kw">false</span>, <span class="ruby-identifier">very_verbose</span> = <span class="ruby-keyword kw">false</span>)
+ <span class="ruby-ivar">@game</span> = <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">players</span>.<span class="ruby-identifier">length</span>)
+ <span class="ruby-ivar">@verbose</span> = <span class="ruby-identifier">verbose</span>
+ <span class="ruby-ivar">@very_verbose</span> = <span class="ruby-identifier">very_verbose</span>
+ <span class="ruby-ivar">@limit</span> = <span class="ruby-identifier">limit</span>
+
+ <span class="ruby-comment cmt"># Give each player a name</span>
+ <span class="ruby-ivar">@named_players</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
+ (<span class="ruby-ivar">@game</span>.<span class="ruby-identifier">players</span>.<span class="ruby-identifier">zip</span> <span class="ruby-identifier">players</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">kv</span><span class="ruby-operator">|</span>
+ <span class="ruby-ivar">@named_players</span>[<span class="ruby-identifier">kv</span>[<span class="ruby-value">0</span>]] = <span class="ruby-identifier">kv</span>[<span class="ruby-value">1</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>play (GameHandler)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File src/play.rb, line 33</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">play</span>
+ <span class="ruby-keyword kw">while</span> <span class="ruby-ivar">@game</span>.<span class="ruby-identifier">history</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator"><</span> <span class="ruby-ivar">@limit</span>
+ <span class="ruby-identifier">roll</span> = <span class="ruby-identifier">rand</span>(<span class="ruby-value">6</span>) <span class="ruby-operator">+</span> <span class="ruby-value">1</span>
+ <span class="ruby-identifier">move_to_apply</span> = <span class="ruby-ivar">@named_players</span>[<span class="ruby-ivar">@game</span>.<span class="ruby-identifier">current_player</span>].<span class="ruby-identifier">best_move</span>(<span class="ruby-ivar">@game</span>, <span class="ruby-identifier">roll</span>)
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">"Move #{@game.history.length + 1}: Player #{@game.current_player} rolled #{roll}: making move #{move_to_apply}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@verbose</span>
+ <span class="ruby-ivar">@game</span>.<span class="ruby-identifier">apply_moves!</span> [<span class="ruby-identifier">move_to_apply</span>]
+ <span class="ruby-identifier">puts</span> <span class="ruby-ivar">@game</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@very_verbose</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">"Game terminated after #{@game.history.length} moves"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@verbose</span>
+ [<span class="ruby-identifier">:draw</span>, <span class="ruby-ivar">@limit</span>]
+ <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">GameWonNotice</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">win_notification</span>
+ <span class="ruby-identifier">winner</span> = <span class="ruby-identifier">win_notification</span>.<span class="ruby-identifier">message</span>[<span class="ruby-value">-1</span>,<span class="ruby-value">1</span>]
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">"Game won by #{winner} in #{@game.history.length} moves"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@verbose</span>
+ [<span class="ruby-ivar">@named_players</span>[<span class="ruby-identifier">winner</span>], <span class="ruby-ivar">@game</span>.<span class="ruby-identifier">history</span>.<span class="ruby-identifier">length</span>]
+ <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">InvalidCaptureError</span>, <span class="ruby-constant">InvalidMoveError</span>
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">"Disqualifying player #{@game.current_player}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@verbose</span>
+ <span class="ruby-ivar">@named_players</span>.<span class="ruby-identifier">delete</span> <span class="ruby-ivar">@game</span>.<span class="ruby-identifier">current_player</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@named_players</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">1</span>
+ <span class="ruby-keyword kw">retry</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">"Game won by #{@named_players.keys[0]} by default"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@verbose</span>
+ [<span class="ruby-ivar">@named_players</span>[<span class="ruby-ivar">@named_players</span>.<span class="ruby-identifier">keys</span>[<span class="ruby-value">0</span>]], <span class="ruby-value">0</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (GameHandler)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File src/play.rb, line 20</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">players</span>, <span class="ruby-identifier">limit</span> = <span class="ruby-value">5000</span>, <span class="ruby-identifier">verbose</span> = <span class="ruby-keyword kw">false</span>, <span class="ruby-identifier">very_verbose</span> = <span class="ruby-keyword kw">false</span>)
+ <span class="ruby-ivar">@game</span> = <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">players</span>.<span class="ruby-identifier">length</span>)
+ <span class="ruby-ivar">@verbose</span> = <span class="ruby-identifier">verbose</span>
+ <span class="ruby-ivar">@very_verbose</span> = <span class="ruby-identifier">very_verbose</span>
+ <span class="ruby-ivar">@limit</span> = <span class="ruby-identifier">limit</span>
+
+ <span class="ruby-comment cmt"># Give each player a name</span>
+ <span class="ruby-ivar">@named_players</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
+ (<span class="ruby-ivar">@game</span>.<span class="ruby-identifier">players</span>.<span class="ruby-identifier">zip</span> <span class="ruby-identifier">players</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">kv</span><span class="ruby-operator">|</span>
+ <span class="ruby-ivar">@named_players</span>[<span class="ruby-identifier">kv</span>[<span class="ruby-value">0</span>]] = <span class="ruby-identifier">kv</span>[<span class="ruby-value">1</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>play (GameHandler)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File src/play.rb, line 36</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">play</span>
+ <span class="ruby-keyword kw">while</span> <span class="ruby-ivar">@game</span>.<span class="ruby-identifier">history</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator"><</span> <span class="ruby-ivar">@limit</span>
+ <span class="ruby-identifier">roll</span> = <span class="ruby-identifier">rand</span>(<span class="ruby-value">6</span>) <span class="ruby-operator">+</span> <span class="ruby-value">1</span>
+ <span class="ruby-identifier">move_to_apply</span> = <span class="ruby-ivar">@named_players</span>[<span class="ruby-ivar">@game</span>.<span class="ruby-identifier">current_player</span>].<span class="ruby-identifier">best_move</span>(<span class="ruby-ivar">@game</span>, <span class="ruby-identifier">roll</span>)
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">"Move #{@game.history.length + 1}: Player #{@game.current_player} rolled #{roll}: making move #{move_to_apply}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@verbose</span>
+ <span class="ruby-ivar">@game</span>.<span class="ruby-identifier">apply_moves!</span> [<span class="ruby-identifier">move_to_apply</span>]
+ <span class="ruby-identifier">puts</span> <span class="ruby-ivar">@game</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@very_verbose</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">"Game terminated after #{@game.history.length} moves"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@verbose</span>
+ [<span class="ruby-identifier">:draw</span>, <span class="ruby-ivar">@limit</span>]
+ <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">GameWonNotice</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">win_notification</span>
+ <span class="ruby-identifier">winner</span> = <span class="ruby-identifier">win_notification</span>.<span class="ruby-identifier">message</span>[<span class="ruby-value">-1</span>,<span class="ruby-value">1</span>]
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">"Game won by #{winner} in #{@game.history.length} moves"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@verbose</span>
+ [<span class="ruby-ivar">@named_players</span>[<span class="ruby-identifier">winner</span>], <span class="ruby-ivar">@game</span>.<span class="ruby-identifier">history</span>.<span class="ruby-identifier">length</span>]
+ <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">InvalidCaptureError</span>, <span class="ruby-constant">InvalidMoveError</span>
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">"Disqualifying player #{@game.current_player}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@verbose</span>
+ <span class="ruby-ivar">@named_players</span>.<span class="ruby-identifier">delete</span> <span class="ruby-ivar">@game</span>.<span class="ruby-identifier">current_player</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@named_players</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">1</span>
+ <span class="ruby-keyword kw">retry</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">"Game won by #{@named_players.keys[0]} by default"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@verbose</span>
+ [<span class="ruby-ivar">@named_players</span>[<span class="ruby-ivar">@named_players</span>.<span class="ruby-identifier">keys</span>[<span class="ruby-value">0</span>]], <span class="ruby-value">0</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (GameHandler)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File src/play.rb, line 16</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">players</span>, <span class="ruby-identifier">verbose</span> = <span class="ruby-keyword kw">false</span>, <span class="ruby-identifier">limit</span> = <span class="ruby-value">5000</span>)
+ <span class="ruby-ivar">@game</span> = <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">players</span>.<span class="ruby-identifier">length</span>)
+ <span class="ruby-ivar">@verbose</span> = <span class="ruby-identifier">verbose</span>
+ <span class="ruby-ivar">@limit</span> = <span class="ruby-identifier">limit</span>
+
+ <span class="ruby-comment cmt"># Give each player a name</span>
+ <span class="ruby-ivar">@named_players</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
+ (<span class="ruby-ivar">@game</span>.<span class="ruby-identifier">players</span>.<span class="ruby-identifier">zip</span> <span class="ruby-identifier">players</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">kv</span><span class="ruby-operator">|</span>
+ <span class="ruby-ivar">@named_players</span>[<span class="ruby-identifier">kv</span>[<span class="ruby-value">0</span>]] = <span class="ruby-identifier">kv</span>[<span class="ruby-value">1</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>play (GameHandler)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File src/play.rb, line 28</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">play</span>
+ <span class="ruby-keyword kw">begin</span>
+ <span class="ruby-keyword kw">while</span> <span class="ruby-ivar">@game</span>.<span class="ruby-identifier">history</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator"><</span> <span class="ruby-ivar">@limit</span>
+ <span class="ruby-identifier">roll</span> = <span class="ruby-identifier">rand</span>(<span class="ruby-value">6</span>) <span class="ruby-operator">+</span> <span class="ruby-value">1</span>
+ <span class="ruby-identifier">move_to_apply</span> = <span class="ruby-ivar">@named_players</span>[<span class="ruby-ivar">@game</span>.<span class="ruby-identifier">current_player</span>].<span class="ruby-identifier">best_move</span>(<span class="ruby-ivar">@game</span>, <span class="ruby-identifier">roll</span>)
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">"Move #{@game.history.length + 1}: Player #{@game.current_player} rolled #{roll}: making move #{move_to_apply}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@verbose</span>
+ <span class="ruby-ivar">@game</span>.<span class="ruby-identifier">apply_moves!</span> [<span class="ruby-identifier">move_to_apply</span>]
+ <span class="ruby-identifier">puts</span> <span class="ruby-ivar">@game</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@verbose</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">"Game terminated after #{@game.history.length} moves"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@verbose</span>
+ [<span class="ruby-identifier">:draw</span>, <span class="ruby-value">0</span>]
+ <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">GameWonNotice</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">win_notification</span>
+ <span class="ruby-identifier">winner</span> = <span class="ruby-identifier">win_notification</span>.<span class="ruby-identifier">message</span>[<span class="ruby-value">-1</span>,<span class="ruby-value">1</span>]
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">"Game won by #{winner} in #{@game.history.length} moves"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@verbose</span>
+ [<span class="ruby-ivar">@named_players</span>[<span class="ruby-identifier">winner</span>], <span class="ruby-ivar">@game</span>.<span class="ruby-identifier">history</span>.<span class="ruby-identifier">length</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (GameHandler)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File src/play.rb, line 17</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">players</span>, <span class="ruby-identifier">limit</span> = <span class="ruby-value">5000</span>, <span class="ruby-identifier">verbose</span> = <span class="ruby-keyword kw">false</span>, <span class="ruby-identifier">very_verbose</span> = <span class="ruby-keyword kw">false</span>)
+ <span class="ruby-ivar">@game</span> = <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">players</span>.<span class="ruby-identifier">length</span>)
+ <span class="ruby-ivar">@verbose</span> = <span class="ruby-identifier">verbose</span>
+ <span class="ruby-ivar">@very_verbose</span> = <span class="ruby-identifier">very_verbose</span>
+ <span class="ruby-ivar">@limit</span> = <span class="ruby-identifier">limit</span>
+
+ <span class="ruby-comment cmt"># Give each player a name</span>
+ <span class="ruby-ivar">@named_players</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
+ (<span class="ruby-ivar">@game</span>.<span class="ruby-identifier">players</span>.<span class="ruby-identifier">zip</span> <span class="ruby-identifier">players</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">kv</span><span class="ruby-operator">|</span>
+ <span class="ruby-ivar">@named_players</span>[<span class="ruby-identifier">kv</span>[<span class="ruby-value">0</span>]] = <span class="ruby-identifier">kv</span>[<span class="ruby-value">1</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>play (GameHandler)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File src/play.rb, line 33</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">play</span>
+ <span class="ruby-keyword kw">while</span> <span class="ruby-ivar">@game</span>.<span class="ruby-identifier">history</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator"><</span> <span class="ruby-ivar">@limit</span>
+ <span class="ruby-identifier">roll</span> = <span class="ruby-identifier">rand</span>(<span class="ruby-value">6</span>) <span class="ruby-operator">+</span> <span class="ruby-value">1</span>
+ <span class="ruby-identifier">move_to_apply</span> = <span class="ruby-ivar">@named_players</span>[<span class="ruby-ivar">@game</span>.<span class="ruby-identifier">current_player</span>].<span class="ruby-identifier">best_move</span>(<span class="ruby-ivar">@game</span>, <span class="ruby-identifier">roll</span>)
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">"Move #{@game.history.length + 1}: Player #{@game.current_player} rolled #{roll}: making move #{move_to_apply}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@verbose</span>
+ <span class="ruby-ivar">@game</span>.<span class="ruby-identifier">apply_moves!</span> [<span class="ruby-identifier">move_to_apply</span>]
+ <span class="ruby-identifier">puts</span> <span class="ruby-ivar">@game</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@very_verbose</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">"Game terminated after #{@game.history.length} moves"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@verbose</span>
+ [<span class="ruby-identifier">:draw</span>, <span class="ruby-ivar">@limit</span>]
+ <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">GameWonNotice</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">win_notification</span>
+ <span class="ruby-identifier">winner</span> = <span class="ruby-identifier">win_notification</span>.<span class="ruby-identifier">message</span>[<span class="ruby-value">-1</span>,<span class="ruby-value">1</span>]
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">"Game won by #{winner} in #{@game.history.length} moves"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@verbose</span>
+ [<span class="ruby-ivar">@named_players</span>[<span class="ruby-identifier">winner</span>], <span class="ruby-ivar">@game</span>.<span class="ruby-identifier">history</span>.<span class="ruby-identifier">length</span>]
+ <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">InvalidCaptureError</span>, <span class="ruby-constant">InvalidMoveError</span>
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">"Disqualifying player #{@game.current_player}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@verbose</span>
+ <span class="ruby-ivar">@named_players</span>.<span class="ruby-identifier">delete</span> <span class="ruby-ivar">@game</span>.<span class="ruby-identifier">current_player</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@named_players</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">1</span>
+ <span class="ruby-keyword kw">retry</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">"Game won by #{@named_players.keys[0]} by default"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@verbose</span>
+ [<span class="ruby-ivar">@named_players</span>[<span class="ruby-ivar">@named_players</span>.<span class="ruby-identifier">keys</span>[<span class="ruby-value">0</span>]], <span class="ruby-value">0</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (GameHandler)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File src/play.rb, line 20</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">players</span>, <span class="ruby-identifier">limit</span> = <span class="ruby-value">5000</span>, <span class="ruby-identifier">verbose</span> = <span class="ruby-keyword kw">false</span>, <span class="ruby-identifier">very_verbose</span> = <span class="ruby-keyword kw">false</span>)
+ <span class="ruby-ivar">@game</span> = <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">players</span>.<span class="ruby-identifier">length</span>)
+ <span class="ruby-ivar">@verbose</span> = <span class="ruby-identifier">verbose</span>
+ <span class="ruby-ivar">@very_verbose</span> = <span class="ruby-identifier">very_verbose</span>
+ <span class="ruby-ivar">@limit</span> = <span class="ruby-identifier">limit</span>
+
+ <span class="ruby-comment cmt"># Give each player a name</span>
+ <span class="ruby-ivar">@named_players</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
+ (<span class="ruby-ivar">@game</span>.<span class="ruby-identifier">players</span>.<span class="ruby-identifier">zip</span> <span class="ruby-identifier">players</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">kv</span><span class="ruby-operator">|</span>
+ <span class="ruby-ivar">@named_players</span>[<span class="ruby-identifier">kv</span>[<span class="ruby-value">0</span>]] = <span class="ruby-identifier">kv</span>[<span class="ruby-value">1</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>play (GameHandler)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File src/play.rb, line 36</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">play</span>
+ <span class="ruby-keyword kw">while</span> <span class="ruby-ivar">@game</span>.<span class="ruby-identifier">history</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator"><</span> <span class="ruby-ivar">@limit</span>
+ <span class="ruby-identifier">roll</span> = <span class="ruby-identifier">rand</span>(<span class="ruby-value">6</span>) <span class="ruby-operator">+</span> <span class="ruby-value">1</span>
+ <span class="ruby-identifier">move_to_apply</span> = <span class="ruby-ivar">@named_players</span>[<span class="ruby-ivar">@game</span>.<span class="ruby-identifier">current_player</span>].<span class="ruby-identifier">best_move</span>(<span class="ruby-ivar">@game</span>, <span class="ruby-identifier">roll</span>)
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">"Move #{@game.history.length + 1}: Player #{@game.current_player} rolled #{roll}: making move #{move_to_apply}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@verbose</span>
+ <span class="ruby-ivar">@game</span>.<span class="ruby-identifier">apply_moves!</span> [<span class="ruby-identifier">move_to_apply</span>]
+ <span class="ruby-identifier">puts</span> <span class="ruby-ivar">@game</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@very_verbose</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">"Game terminated after #{@game.history.length} moves"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@verbose</span>
+ [<span class="ruby-identifier">:draw</span>, <span class="ruby-ivar">@limit</span>]
+ <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">GameWonNotice</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">win_notification</span>
+ <span class="ruby-identifier">winner</span> = <span class="ruby-identifier">win_notification</span>.<span class="ruby-identifier">message</span>[<span class="ruby-value">-1</span>,<span class="ruby-value">1</span>]
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">"Game won by #{winner} in #{@game.history.length} moves"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@verbose</span>
+ [<span class="ruby-ivar">@named_players</span>[<span class="ruby-identifier">winner</span>], <span class="ruby-ivar">@game</span>.<span class="ruby-identifier">history</span>.<span class="ruby-identifier">length</span>]
+ <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">InvalidCaptureError</span>, <span class="ruby-constant">InvalidMoveError</span>
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">"Disqualifying player #{@game.current_player}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@verbose</span>
+ <span class="ruby-ivar">@named_players</span>.<span class="ruby-identifier">delete</span> <span class="ruby-ivar">@game</span>.<span class="ruby-identifier">current_player</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@named_players</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">1</span>
+ <span class="ruby-keyword kw">retry</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">"Game won by #{@named_players.keys[0]} by default"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@verbose</span>
+ [<span class="ruby-ivar">@named_players</span>[<span class="ruby-ivar">@named_players</span>.<span class="ruby-identifier">keys</span>[<span class="ruby-value">0</span>]], <span class="ruby-value">0</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (GameHandler)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File src/play.rb, line 16</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">players</span>, <span class="ruby-identifier">verbose</span> = <span class="ruby-keyword kw">false</span>, <span class="ruby-identifier">limit</span> = <span class="ruby-value">5000</span>)
+ <span class="ruby-ivar">@game</span> = <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">players</span>.<span class="ruby-identifier">length</span>)
+ <span class="ruby-ivar">@verbose</span> = <span class="ruby-identifier">verbose</span>
+ <span class="ruby-ivar">@limit</span> = <span class="ruby-identifier">limit</span>
+
+ <span class="ruby-comment cmt"># Give each player a name</span>
+ <span class="ruby-ivar">@named_players</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
+ (<span class="ruby-ivar">@game</span>.<span class="ruby-identifier">players</span>.<span class="ruby-identifier">zip</span> <span class="ruby-identifier">players</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">kv</span><span class="ruby-operator">|</span>
+ <span class="ruby-ivar">@named_players</span>[<span class="ruby-identifier">kv</span>[<span class="ruby-value">0</span>]] = <span class="ruby-identifier">kv</span>[<span class="ruby-value">1</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>play (GameHandler)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File src/play.rb, line 28</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">play</span>
+ <span class="ruby-keyword kw">begin</span>
+ <span class="ruby-keyword kw">while</span> <span class="ruby-ivar">@game</span>.<span class="ruby-identifier">history</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator"><</span> <span class="ruby-ivar">@limit</span>
+ <span class="ruby-identifier">roll</span> = <span class="ruby-identifier">rand</span>(<span class="ruby-value">6</span>) <span class="ruby-operator">+</span> <span class="ruby-value">1</span>
+ <span class="ruby-identifier">move_to_apply</span> = <span class="ruby-ivar">@named_players</span>[<span class="ruby-ivar">@game</span>.<span class="ruby-identifier">current_player</span>].<span class="ruby-identifier">best_move</span>(<span class="ruby-ivar">@game</span>, <span class="ruby-identifier">roll</span>)
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">"Move #{@game.history.length + 1}: Player #{@game.current_player} rolled #{roll}: making move #{move_to_apply}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@verbose</span>
+ <span class="ruby-ivar">@game</span>.<span class="ruby-identifier">apply_moves!</span> [<span class="ruby-identifier">move_to_apply</span>]
+ <span class="ruby-identifier">puts</span> <span class="ruby-ivar">@game</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@verbose</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">"Game terminated after #{@game.history.length} moves"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@verbose</span>
+ [<span class="ruby-identifier">:draw</span>, <span class="ruby-value">0</span>]
+ <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">GameWonNotice</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">win_notification</span>
+ <span class="ruby-identifier">winner</span> = <span class="ruby-identifier">win_notification</span>.<span class="ruby-identifier">message</span>[<span class="ruby-value">-1</span>,<span class="ruby-value">1</span>]
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">"Game won by #{winner} in #{@game.history.length} moves"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@verbose</span>
+ [<span class="ruby-ivar">@named_players</span>[<span class="ruby-identifier">winner</span>], <span class="ruby-ivar">@game</span>.<span class="ruby-identifier">history</span>.<span class="ruby-identifier">length</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Class: GameState</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="classHeader">
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Class</strong></td>
+ <td class="class-name-in-header">GameState</td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>In:</strong></td>
+ <td>
+ <a href="../files/lib/libttc_rb.html">
+ lib/libttc.rb
+ </a>
+ <br />
+ </td>
+ </tr>
+
+ <tr class="top-aligned-row">
+ <td><strong>Parent:</strong></td>
+ <td>
+ Object
+ </td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <p>
+A class to record each of the states previously found in a game. Note that
+this is a deep copy of the pieces and what they‘ve captured, so
+you‘ll need to convert back
+</p>
+
+ </div>
+
+
+ </div>
+
+ <div id="method-list">
+ <h3 class="section-bar">Methods</h3>
+
+ <div class="name-list">
+ <a href="#M000009">==</a>
+ <a href="#M000008">new</a>
+ </div>
+ </div>
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+ <div id="attribute-list">
+ <h3 class="section-bar">Attributes</h3>
+
+ <div class="name-list">
+ <table>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">move</td>
+ <td class="context-item-value"> [RW] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">pieces_after_move</td>
+ <td class="context-item-value"> [RW] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">player</td>
+ <td class="context-item-value"> [RW] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ </table>
+ </div>
+ </div>
+
+
+
+ <!-- if method_list -->
+ <div id="methods">
+ <h3 class="section-bar">Public Class methods</h3>
+
+ <div id="method-M000008" class="method-detail">
+ <a name="M000008"></a>
+
+ <div class="method-heading">
+ <a href="GameState.src/M000008.html" target="Code" class="method-signature"
+ onclick="popupCode('GameState.src/M000008.html');return false;">
+ <span class="method-name">new</span><span class="method-args">(move, player, pieces)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <h3 class="section-bar">Public Instance methods</h3>
+
+ <div id="method-M000009" class="method-detail">
+ <a name="M000009"></a>
+
+ <div class="method-heading">
+ <a href="GameState.src/M000009.html" target="Code" class="method-signature"
+ onclick="popupCode('GameState.src/M000009.html');return false;">
+ <span class="method-name">==</span><span class="method-args">(other)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+K 25
+svn:wc:ra_dav:version-url
+V 64
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/GameState.src
+END
+M000001.html
+K 25
+svn:wc:ra_dav:version-url
+V 77
+/svn/njae/!svn/ver/24/TrapTheCap/trunk/doc/classes/GameState.src/M000001.html
+END
+M000002.html
+K 25
+svn:wc:ra_dav:version-url
+V 77
+/svn/njae/!svn/ver/24/TrapTheCap/trunk/doc/classes/GameState.src/M000002.html
+END
+M000003.html
+K 25
+svn:wc:ra_dav:version-url
+V 77
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/classes/GameState.src/M000003.html
+END
+M000004.html
+K 25
+svn:wc:ra_dav:version-url
+V 77
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/classes/GameState.src/M000004.html
+END
+M000008.html
+K 25
+svn:wc:ra_dav:version-url
+V 77
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/GameState.src/M000008.html
+END
+M000009.html
+K 25
+svn:wc:ra_dav:version-url
+V 77
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/GameState.src/M000009.html
+END
--- /dev/null
+8
+
+dir
+68
+http://scripts.njae.me.uk/svn/njae/TrapTheCap/trunk/doc/classes/GameState.src
+http://scripts.njae.me.uk/svn/njae
+
+
+
+2008-10-16T14:11:23.436422Z
+41
+neil
+
+
+svn:special svn:externals svn:needs-lock
+
+
+
+
+
+
+
+
+
+
+
+0ada9808-85ab-4924-adda-5bf89eae3818
+\f
+M000001.html
+file
+
+
+
+
+2008-03-25T12:43:37.000000Z
+88a7b482fdcf7df6e919405d4317dbdf
+2008-03-28T15:47:09.723420Z
+24
+neil
+\f
+M000002.html
+file
+
+
+
+
+2008-03-25T12:43:37.000000Z
+541cddb93a958e71a9026925d1971c18
+2008-03-28T15:47:09.723420Z
+24
+neil
+\f
+M000003.html
+file
+
+
+
+
+2008-03-25T11:47:59.000000Z
+53d4e4c62b9ea912ba03d54198dbc536
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+M000004.html
+file
+
+
+
+
+2008-03-25T11:47:59.000000Z
+7f4e5884a0a391f63029b7789affcd7b
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+M000008.html
+file
+
+
+
+
+2008-03-28T15:44:41.000000Z
+6b9064aa3d3719b9e478d45316128cb2
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000009.html
+file
+
+
+
+
+2008-03-28T15:44:41.000000Z
+daadaa01653644bfd2f85328266014c5
+2008-10-16T14:11:23.436422Z
+41
+\f
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (GameState)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 305</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">move</span>, <span class="ruby-identifier">player</span>, <span class="ruby-identifier">pieces</span>)
+ <span class="ruby-ivar">@move</span> = <span class="ruby-identifier">move</span>
+ <span class="ruby-ivar">@player</span> = <span class="ruby-identifier">player</span>
+ <span class="ruby-ivar">@pieces_after_move</span> = <span class="ruby-identifier">pieces</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>== (GameState)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 311</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-operator">==</span>(<span class="ruby-identifier">other</span>)
+ <span class="ruby-ivar">@move</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">move</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-keyword kw">and</span>
+ <span class="ruby-ivar">@player</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">player</span> <span class="ruby-keyword kw">and</span>
+ <span class="ruby-ivar">@piece_after_move</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">pieces_after_move</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (GameState)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 294</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">move</span>, <span class="ruby-identifier">player</span>, <span class="ruby-identifier">pieces</span>)
+ <span class="ruby-ivar">@move</span> = <span class="ruby-identifier">move</span>
+ <span class="ruby-ivar">@player</span> = <span class="ruby-identifier">player</span>
+ <span class="ruby-ivar">@pieces_after_move</span> = <span class="ruby-identifier">pieces</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>== (GameState)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 300</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-operator">==</span>(<span class="ruby-identifier">other</span>)
+ <span class="ruby-ivar">@move</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">move</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-keyword kw">and</span>
+ <span class="ruby-ivar">@player</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">player</span> <span class="ruby-keyword kw">and</span>
+ <span class="ruby-ivar">@piece_after_move</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">pieces_after_move</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (GameState)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 323</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">move</span>, <span class="ruby-identifier">player</span>, <span class="ruby-identifier">pieces</span>)
+ <span class="ruby-ivar">@move</span> = <span class="ruby-identifier">move</span>
+ <span class="ruby-ivar">@player</span> = <span class="ruby-identifier">player</span>
+ <span class="ruby-ivar">@pieces_after_move</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
+ <span class="ruby-identifier">pieces</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@pieces_after_move</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">p</span>.<span class="ruby-identifier">dup</span>}
+ <span class="ruby-ivar">@pieces_after_move</span>.<span class="ruby-identifier">each_value</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">contains</span> = []}
+ <span class="ruby-comment cmt"># and now to make the captured pieces point to the copies</span>
+ <span class="ruby-identifier">pieces</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">p</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">p</span>.<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">captured_piece</span><span class="ruby-operator">|</span>
+ <span class="ruby-ivar">@pieces_after_move</span>[<span class="ruby-identifier">k</span>].<span class="ruby-identifier">capture</span>(<span class="ruby-ivar">@pieces_after_move</span>[<span class="ruby-identifier">captured_piece</span>.<span class="ruby-identifier">name</span>])
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>== (GameState)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 337</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-operator">==</span>(<span class="ruby-identifier">other</span>)
+ <span class="ruby-ivar">@move</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">move</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-keyword kw">and</span>
+ <span class="ruby-ivar">@player</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">player</span> <span class="ruby-keyword kw">and</span>
+ <span class="ruby-ivar">@piece_after_move</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">pieces_after_move</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (GameState)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 305</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">move</span>, <span class="ruby-identifier">player</span>, <span class="ruby-identifier">pieces</span>)
+ <span class="ruby-ivar">@move</span> = <span class="ruby-identifier">move</span>
+ <span class="ruby-ivar">@player</span> = <span class="ruby-identifier">player</span>
+ <span class="ruby-ivar">@pieces_after_move</span> = <span class="ruby-identifier">pieces</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>== (GameState)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 311</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-operator">==</span>(<span class="ruby-identifier">other</span>)
+ <span class="ruby-ivar">@move</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">move</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-keyword kw">and</span>
+ <span class="ruby-ivar">@player</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">player</span> <span class="ruby-keyword kw">and</span>
+ <span class="ruby-ivar">@piece_after_move</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">pieces_after_move</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (GameState)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 294</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">move</span>, <span class="ruby-identifier">player</span>, <span class="ruby-identifier">pieces</span>)
+ <span class="ruby-ivar">@move</span> = <span class="ruby-identifier">move</span>
+ <span class="ruby-ivar">@player</span> = <span class="ruby-identifier">player</span>
+ <span class="ruby-ivar">@pieces_after_move</span> = <span class="ruby-identifier">pieces</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>== (GameState)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 300</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-operator">==</span>(<span class="ruby-identifier">other</span>)
+ <span class="ruby-ivar">@move</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">move</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-keyword kw">and</span>
+ <span class="ruby-ivar">@player</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">player</span> <span class="ruby-keyword kw">and</span>
+ <span class="ruby-ivar">@piece_after_move</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">pieces_after_move</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (GameState)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 323</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">move</span>, <span class="ruby-identifier">player</span>, <span class="ruby-identifier">pieces</span>)
+ <span class="ruby-ivar">@move</span> = <span class="ruby-identifier">move</span>
+ <span class="ruby-ivar">@player</span> = <span class="ruby-identifier">player</span>
+ <span class="ruby-ivar">@pieces_after_move</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
+ <span class="ruby-identifier">pieces</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@pieces_after_move</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">p</span>.<span class="ruby-identifier">dup</span>}
+ <span class="ruby-ivar">@pieces_after_move</span>.<span class="ruby-identifier">each_value</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">p</span><span class="ruby-operator">|</span> <span class="ruby-identifier">p</span>.<span class="ruby-identifier">contains</span> = []}
+ <span class="ruby-comment cmt"># and now to make the captured pieces point to the copies</span>
+ <span class="ruby-identifier">pieces</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>, <span class="ruby-identifier">p</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">p</span>.<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">captured_piece</span><span class="ruby-operator">|</span>
+ <span class="ruby-ivar">@pieces_after_move</span>[<span class="ruby-identifier">k</span>].<span class="ruby-identifier">capture</span>(<span class="ruby-ivar">@pieces_after_move</span>[<span class="ruby-identifier">captured_piece</span>.<span class="ruby-identifier">name</span>])
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>== (GameState)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 337</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-operator">==</span>(<span class="ruby-identifier">other</span>)
+ <span class="ruby-ivar">@move</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">move</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-keyword kw">and</span>
+ <span class="ruby-ivar">@player</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">player</span> <span class="ruby-keyword kw">and</span>
+ <span class="ruby-ivar">@piece_after_move</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">other</span>.<span class="ruby-identifier">pieces_after_move</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Class: GameTest</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="classHeader">
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Class</strong></td>
+ <td class="class-name-in-header">GameTest</td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>In:</strong></td>
+ <td>
+ <a href="../files/test/libttc_test_rb.html">
+ test/libttc_test.rb
+ </a>
+ <br />
+ </td>
+ </tr>
+
+ <tr class="top-aligned-row">
+ <td><strong>Parent:</strong></td>
+ <td>
+ Test::Unit::TestCase
+ </td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+
+
+ </div>
+
+ <div id="method-list">
+ <h3 class="section-bar">Methods</h3>
+
+ <div class="name-list">
+ <a href="#M000025">test_apply_moves!</a>
+ <a href="#M000021">test_captures</a>
+ <a href="#M000026">test_eliminations</a>
+ <a href="#M000024">test_game</a>
+ <a href="#M000018">test_game_init</a>
+ <a href="#M000017">test_init</a>
+ <a href="#M000023">test_move_after_captures</a>
+ <a href="#M000022">test_no_captures_on_safe_spaces</a>
+ <a href="#M000020">test_separate_moves</a>
+ <a href="#M000019">test_single_moves_1</a>
+ <a href="#M000027">test_undo_move!</a>
+ </div>
+ </div>
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+ <div id="methods">
+ <h3 class="section-bar">Public Instance methods</h3>
+
+ <div id="method-M000025" class="method-detail">
+ <a name="M000025"></a>
+
+ <div class="method-heading">
+ <a href="GameTest.src/M000025.html" target="Code" class="method-signature"
+ onclick="popupCode('GameTest.src/M000025.html');return false;">
+ <span class="method-name">test_apply_moves!</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <div id="method-M000021" class="method-detail">
+ <a name="M000021"></a>
+
+ <div class="method-heading">
+ <a href="GameTest.src/M000021.html" target="Code" class="method-signature"
+ onclick="popupCode('GameTest.src/M000021.html');return false;">
+ <span class="method-name">test_captures</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <div id="method-M000026" class="method-detail">
+ <a name="M000026"></a>
+
+ <div class="method-heading">
+ <a href="GameTest.src/M000026.html" target="Code" class="method-signature"
+ onclick="popupCode('GameTest.src/M000026.html');return false;">
+ <span class="method-name">test_eliminations</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <div id="method-M000024" class="method-detail">
+ <a name="M000024"></a>
+
+ <div class="method-heading">
+ <a href="GameTest.src/M000024.html" target="Code" class="method-signature"
+ onclick="popupCode('GameTest.src/M000024.html');return false;">
+ <span class="method-name">test_game</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <div id="method-M000018" class="method-detail">
+ <a name="M000018"></a>
+
+ <div class="method-heading">
+ <a href="GameTest.src/M000018.html" target="Code" class="method-signature"
+ onclick="popupCode('GameTest.src/M000018.html');return false;">
+ <span class="method-name">test_game_init</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <div id="method-M000017" class="method-detail">
+ <a name="M000017"></a>
+
+ <div class="method-heading">
+ <a href="GameTest.src/M000017.html" target="Code" class="method-signature"
+ onclick="popupCode('GameTest.src/M000017.html');return false;">
+ <span class="method-name">test_init</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <div id="method-M000023" class="method-detail">
+ <a name="M000023"></a>
+
+ <div class="method-heading">
+ <a href="GameTest.src/M000023.html" target="Code" class="method-signature"
+ onclick="popupCode('GameTest.src/M000023.html');return false;">
+ <span class="method-name">test_move_after_captures</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <div id="method-M000022" class="method-detail">
+ <a name="M000022"></a>
+
+ <div class="method-heading">
+ <a href="GameTest.src/M000022.html" target="Code" class="method-signature"
+ onclick="popupCode('GameTest.src/M000022.html');return false;">
+ <span class="method-name">test_no_captures_on_safe_spaces</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <div id="method-M000020" class="method-detail">
+ <a name="M000020"></a>
+
+ <div class="method-heading">
+ <a href="GameTest.src/M000020.html" target="Code" class="method-signature"
+ onclick="popupCode('GameTest.src/M000020.html');return false;">
+ <span class="method-name">test_separate_moves</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <div id="method-M000019" class="method-detail">
+ <a name="M000019"></a>
+
+ <div class="method-heading">
+ <a href="GameTest.src/M000019.html" target="Code" class="method-signature"
+ onclick="popupCode('GameTest.src/M000019.html');return false;">
+ <span class="method-name">test_single_moves_1</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <div id="method-M000027" class="method-detail">
+ <a name="M000027"></a>
+
+ <div class="method-heading">
+ <a href="GameTest.src/M000027.html" target="Code" class="method-signature"
+ onclick="popupCode('GameTest.src/M000027.html');return false;">
+ <span class="method-name">test_undo_move!</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+K 25
+svn:wc:ra_dav:version-url
+V 63
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/GameTest.src
+END
+M000010.html
+K 25
+svn:wc:ra_dav:version-url
+V 76
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/classes/GameTest.src/M000010.html
+END
+M000011.html
+K 25
+svn:wc:ra_dav:version-url
+V 76
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/classes/GameTest.src/M000011.html
+END
+M000020.html
+K 25
+svn:wc:ra_dav:version-url
+V 76
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/GameTest.src/M000020.html
+END
+M000012.html
+K 25
+svn:wc:ra_dav:version-url
+V 76
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/classes/GameTest.src/M000012.html
+END
+M000021.html
+K 25
+svn:wc:ra_dav:version-url
+V 76
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/GameTest.src/M000021.html
+END
+M000013.html
+K 25
+svn:wc:ra_dav:version-url
+V 76
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/classes/GameTest.src/M000013.html
+END
+M000022.html
+K 25
+svn:wc:ra_dav:version-url
+V 76
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/GameTest.src/M000022.html
+END
+M000014.html
+K 25
+svn:wc:ra_dav:version-url
+V 76
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/classes/GameTest.src/M000014.html
+END
+M000023.html
+K 25
+svn:wc:ra_dav:version-url
+V 76
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/GameTest.src/M000023.html
+END
+M000024.html
+K 25
+svn:wc:ra_dav:version-url
+V 76
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/GameTest.src/M000024.html
+END
+M000015.html
+K 25
+svn:wc:ra_dav:version-url
+V 76
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/classes/GameTest.src/M000015.html
+END
+M000025.html
+K 25
+svn:wc:ra_dav:version-url
+V 76
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/GameTest.src/M000025.html
+END
+M000016.html
+K 25
+svn:wc:ra_dav:version-url
+V 76
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/classes/GameTest.src/M000016.html
+END
+M000026.html
+K 25
+svn:wc:ra_dav:version-url
+V 76
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/GameTest.src/M000026.html
+END
+M000017.html
+K 25
+svn:wc:ra_dav:version-url
+V 76
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/GameTest.src/M000017.html
+END
+M000018.html
+K 25
+svn:wc:ra_dav:version-url
+V 76
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/GameTest.src/M000018.html
+END
+M000009.html
+K 25
+svn:wc:ra_dav:version-url
+V 76
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/classes/GameTest.src/M000009.html
+END
+M000027.html
+K 25
+svn:wc:ra_dav:version-url
+V 76
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/GameTest.src/M000027.html
+END
+M000019.html
+K 25
+svn:wc:ra_dav:version-url
+V 76
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/GameTest.src/M000019.html
+END
--- /dev/null
+8
+
+dir
+68
+http://scripts.njae.me.uk/svn/njae/TrapTheCap/trunk/doc/classes/GameTest.src
+http://scripts.njae.me.uk/svn/njae
+
+
+
+2008-10-16T14:11:23.436422Z
+41
+neil
+
+
+svn:special svn:externals svn:needs-lock
+
+
+
+
+
+
+
+
+
+
+
+0ada9808-85ab-4924-adda-5bf89eae3818
+\f
+M000010.html
+file
+
+
+
+
+2008-03-25T11:47:59.000000Z
+41664b5a552ce096824dfe328f1a0419
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+M000011.html
+file
+
+
+
+
+2008-03-25T11:47:59.000000Z
+88dd11dcddcb949ddb41c70328b9971a
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+M000020.html
+file
+
+
+
+
+2008-03-28T15:44:41.000000Z
+c06b9b14b8954730d685f5faebc7fd8b
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000021.html
+file
+
+
+
+
+2008-03-28T15:44:41.000000Z
+0b48c55cce4696afd66cf634568d2fa2
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000012.html
+file
+
+
+
+
+2008-03-25T11:47:59.000000Z
+ce453b284de894e64aaaa0e53da14fd7
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+M000013.html
+file
+
+
+
+
+2008-03-25T11:47:59.000000Z
+710b8c2b3047574ca452860836b5d5b9
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+M000022.html
+file
+
+
+
+
+2008-03-28T15:44:41.000000Z
+5bad73a8a1bae6afcaa0cb8ab8a6fc09
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000023.html
+file
+
+
+
+
+2008-03-28T15:44:41.000000Z
+49f96f995fcbb23ff379a7aef6e69539
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000014.html
+file
+
+
+
+
+2008-03-25T11:47:59.000000Z
+09a0da90f8788992851691777e532180
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+M000024.html
+file
+
+
+
+
+2008-03-28T15:44:41.000000Z
+5c5be77a77266e23c62e451e553c4091
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000015.html
+file
+
+
+
+
+2008-03-25T11:47:59.000000Z
+b5127960370e70d7f9cc49e81c098661
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+M000025.html
+file
+
+
+
+
+2008-03-28T15:44:41.000000Z
+3d4be49bd838bb8577a2453f5eff6d35
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000016.html
+file
+
+
+
+
+2008-03-25T11:48:00.000000Z
+50e9359d54aa4411e49ef92055262b1f
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+M000017.html
+file
+
+
+
+
+2008-03-28T15:44:41.000000Z
+690dbf91a64e38a3b5105b3caf95f786
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000026.html
+file
+
+
+
+
+2008-03-28T15:44:41.000000Z
+e7761375535f8d2a9330cbacba466743
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000018.html
+file
+
+
+
+
+2008-03-28T15:44:41.000000Z
+d4745433ba95bd2bee6586382aeb2665
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000009.html
+file
+
+
+
+
+2008-03-25T11:47:59.000000Z
+55f494fd0b53e9c99c09d26367ecb810
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+M000027.html
+file
+
+
+
+
+2008-03-28T15:44:41.000000Z
+77b0ba6cb4134fe7ccc3440ab63be6df
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000019.html
+file
+
+
+
+
+2008-03-28T15:44:41.000000Z
+32cc66129284aee20987aeca730fa83b
+2008-10-16T14:11:23.436422Z
+41
+\f
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>test_init (GameTest)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File test/game-test.rb, line 7</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_init</span>
+ <span class="ruby-identifier">assert_nothing_raised</span> { <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>) }
+ <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>).<span class="ruby-identifier">history</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>test_game_init (GameTest)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File test/game-test.rb, line 13</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_game_init</span>
+ <span class="ruby-identifier">game</span> = <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>)
+
+ <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>]
+ <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>]
+ <span class="ruby-identifier">pieceB2</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>]
+
+ <span class="ruby-identifier">posA</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>]
+ <span class="ruby-identifier">posB</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'b'</span>]
+ <span class="ruby-identifier">posA3</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>]
+ <span class="ruby-identifier">posA4</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a4'</span>]
+ <span class="ruby-identifier">posA5</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a5'</span>]
+
+ <span class="ruby-identifier">moveA2A</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA</span> , <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-identifier">moveA1A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA1</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveA2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA4</span>)
+ <span class="ruby-identifier">moveA2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveB2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA4</span>)
+
+ <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>test_single_moves_1 (GameTest)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File test/game-test.rb, line 47</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_single_moves_1</span>
+ <span class="ruby-identifier">game</span> = <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>)
+
+ <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>]
+ <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>]
+ <span class="ruby-identifier">pieceB2</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>]
+
+ <span class="ruby-identifier">posA</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>]
+ <span class="ruby-identifier">posB</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'b'</span>]
+ <span class="ruby-identifier">posA3</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>]
+ <span class="ruby-identifier">posA4</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a4'</span>]
+ <span class="ruby-identifier">posA5</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a5'</span>]
+
+ <span class="ruby-identifier">moveA2A</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA</span> , <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-identifier">moveA1A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA1</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveA2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA4</span>)
+ <span class="ruby-identifier">moveA2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveB2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA4</span>)
+
+ <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">assert_raise</span>(<span class="ruby-constant">InvalidMoveError</span>) {<span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveA1A5</span>, <span class="ruby-value str">'b'</span>)}
+
+ <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveA1A5</span>, <span class="ruby-value str">'a'</span>)
+ <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>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>test_separate_moves (GameTest)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File test/game-test.rb, line 105</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_separate_moves</span>
+ <span class="ruby-identifier">game</span> = <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>)
+
+ <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>]
+ <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>]
+ <span class="ruby-identifier">pieceB2</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>]
+
+ <span class="ruby-identifier">posA</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>]
+ <span class="ruby-identifier">posB</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'b'</span>]
+ <span class="ruby-identifier">posA3</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>]
+ <span class="ruby-identifier">posA4</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a4'</span>]
+ <span class="ruby-identifier">posA5</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a5'</span>]
+
+ <span class="ruby-identifier">moveA2A</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA</span> , <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-identifier">moveA1A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA1</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveA2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA4</span>)
+ <span class="ruby-identifier">moveA2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveB2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA4</span>)
+
+ <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveA1A5</span>, <span class="ruby-value str">'a'</span>)
+ <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>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveB2A3</span>, <span class="ruby-value str">'b'</span>)
+ <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">2</span>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>test_captures (GameTest)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File test/game-test.rb, line 164</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_captures</span>
+ <span class="ruby-identifier">game</span> = <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>)
+
+ <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>]
+ <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>]
+ <span class="ruby-identifier">pieceB2</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>]
+
+ <span class="ruby-identifier">posA</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>]
+ <span class="ruby-identifier">posB</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'b'</span>]
+ <span class="ruby-identifier">posA3</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>]
+ <span class="ruby-identifier">posA4</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a4'</span>]
+ <span class="ruby-identifier">posA5</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a5'</span>]
+
+ <span class="ruby-identifier">moveA2A</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA</span> , <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-identifier">moveA1A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA1</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveA2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA4</span>)
+ <span class="ruby-identifier">moveA2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveB2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA4</span>)
+
+ <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveA1A5</span>, <span class="ruby-value str">'a'</span>)
+ <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>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveB2A5</span>, <span class="ruby-value str">'b'</span>)
+ <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">2</span>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'a5'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>test_no_captures_on_safe_spaces (GameTest)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File test/game-test.rb, line 223</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_no_captures_on_safe_spaces</span>
+ <span class="ruby-identifier">game</span> = <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>)
+
+ <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>]
+ <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>]
+ <span class="ruby-identifier">pieceB2</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>]
+
+ <span class="ruby-identifier">posA</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>]
+ <span class="ruby-identifier">posB</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'b'</span>]
+ <span class="ruby-identifier">posA3</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>]
+ <span class="ruby-identifier">posA4</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a4'</span>]
+ <span class="ruby-identifier">posA5</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a5'</span>]
+
+ <span class="ruby-identifier">moveA2A</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA</span> , <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-identifier">moveA1A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA1</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveA2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA4</span>)
+ <span class="ruby-identifier">moveA2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveB2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA4</span>)
+
+ <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveA2A4</span>, <span class="ruby-value str">'a'</span>)
+ <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>
+ <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>]
+ <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>
+ <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>, []
+ <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">'a4'</span>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveB2A4</span>, <span class="ruby-value str">'b'</span>)
+ <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">2</span>
+ <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>]
+ <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>
+ <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>, []
+ <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">'a4'</span>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'a4'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>test_move_after_captures (GameTest)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File test/game-test.rb, line 280</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_move_after_captures</span>
+ <span class="ruby-identifier">game</span> = <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>)
+
+ <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>]
+ <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>]
+ <span class="ruby-identifier">pieceB2</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>]
+
+ <span class="ruby-identifier">posA</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>]
+ <span class="ruby-identifier">posB</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'b'</span>]
+ <span class="ruby-identifier">posA3</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>]
+ <span class="ruby-identifier">posA4</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a4'</span>]
+ <span class="ruby-identifier">posA5</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a5'</span>]
+
+ <span class="ruby-identifier">moveA2A</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA</span> , <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-identifier">moveA1A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA1</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveA2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA4</span>)
+ <span class="ruby-identifier">moveA2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveB2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA4</span>)
+
+ <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveA1A5</span>, <span class="ruby-value str">'a'</span>)
+ <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>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveB2A5</span>, <span class="ruby-value str">'b'</span>)
+ <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">2</span>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'a5'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveA2A4</span>, <span class="ruby-value str">'a'</span>)
+ <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">3</span>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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">'a4'</span>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'a5'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveB2A3</span>, <span class="ruby-value str">'b'</span>)
+ <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">4</span>
+ <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>]
+ <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>
+ <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>, []
+ <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">'a4'</span>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>test_game (GameTest)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File test/game-test.rb, line 365</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_game</span>
+ <span class="ruby-identifier">game</span> = <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>)
+
+ <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>]
+ <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>]
+ <span class="ruby-identifier">pieceB2</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>]
+
+ <span class="ruby-identifier">posA</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>]
+ <span class="ruby-identifier">posB</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'b'</span>]
+ <span class="ruby-identifier">posA3</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>]
+ <span class="ruby-identifier">posA4</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a4'</span>]
+ <span class="ruby-identifier">posA5</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a5'</span>]
+
+ <span class="ruby-identifier">moveA2A</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA</span> , <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-identifier">moveA1A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA1</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveA1A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA1</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveA2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA4</span>)
+ <span class="ruby-identifier">moveA2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveB2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA4</span>)
+
+ <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveA1A5</span>, <span class="ruby-value str">'a'</span>)
+ <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>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveB2A3</span>, <span class="ruby-value str">'b'</span>)
+ <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">2</span>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveA2A4</span>, <span class="ruby-value str">'a'</span>)
+ <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">3</span>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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">'a4'</span>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveB2A5</span>, <span class="ruby-value str">'b'</span>)
+ <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">4</span>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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">'a4'</span>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'a5'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
+
+ <span class="ruby-identifier">assert_raise</span>(<span class="ruby-constant">InvalidMoveError</span>) {<span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveA1A3</span>, <span class="ruby-value str">'a'</span>)}
+ <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">4</span>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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">'a4'</span>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'a5'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveA2A3</span>, <span class="ruby-value str">'a'</span>)
+ <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>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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">'a3'</span>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'a5'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveB2A4</span>, <span class="ruby-value str">'b'</span>)
+ <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>
+ <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">'a4'</span>]
+ <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>
+ <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>, []
+ <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">'a3'</span>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'a4'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveA2A4</span>, <span class="ruby-value str">'a'</span>)
+ <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">7</span>
+ <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">'a4'</span>]
+ <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>
+ <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>, []
+ <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">'a4'</span>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'a4'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveB2A3</span>, <span class="ruby-value str">'b'</span>)
+ <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>
+ <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>]
+ <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>
+ <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>, []
+ <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">'a4'</span>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveA2A3</span>, <span class="ruby-value str">'a'</span>)
+ <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>
+ <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>]
+ <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>
+ <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>, []
+ <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">'a3'</span>]
+ <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>
+ <span class="ruby-identifier">assert</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>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert</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>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceB2</span>)
+ <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>.<span class="ruby-identifier">length</span>, <span class="ruby-value">2</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">true</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveA2A</span>, <span class="ruby-value str">'a'</span>)
+ <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">10</span>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">true</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>test_init (GameTest)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File test/libttc_test.rb, line 7</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_init</span>
+ <span class="ruby-identifier">assert_nothing_raised</span> { <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>) }
+ <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>).<span class="ruby-identifier">history</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>test_game_init (GameTest)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File test/libttc_test.rb, line 13</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_game_init</span>
+ <span class="ruby-identifier">game</span> = <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>)
+
+ <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>]
+ <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>]
+ <span class="ruby-identifier">pieceB2</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>]
+
+ <span class="ruby-identifier">posA</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>]
+ <span class="ruby-identifier">posB</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'b'</span>]
+ <span class="ruby-identifier">posA3</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>]
+ <span class="ruby-identifier">posA4</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a4'</span>]
+ <span class="ruby-identifier">posA5</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a5'</span>]
+
+ <span class="ruby-identifier">moveA2A</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA</span> , <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-identifier">moveA1A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA1</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveA2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA4</span>)
+ <span class="ruby-identifier">moveA2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveB2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA4</span>)
+
+ <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>test_single_moves_1 (GameTest)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File test/libttc_test.rb, line 47</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_single_moves_1</span>
+ <span class="ruby-identifier">game</span> = <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>)
+
+ <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>]
+ <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>]
+ <span class="ruby-identifier">pieceB2</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>]
+
+ <span class="ruby-identifier">posA</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>]
+ <span class="ruby-identifier">posB</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'b'</span>]
+ <span class="ruby-identifier">posA3</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>]
+ <span class="ruby-identifier">posA4</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a4'</span>]
+ <span class="ruby-identifier">posA5</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a5'</span>]
+
+ <span class="ruby-identifier">moveA2A</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA</span> , <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-identifier">moveA1A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA1</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveA2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA4</span>)
+ <span class="ruby-identifier">moveA2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveB2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA4</span>)
+
+ <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">assert_raise</span>(<span class="ruby-constant">InvalidMoveError</span>) {<span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">moveA1A5</span>, <span class="ruby-value str">'b'</span>)}
+
+ <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">moveA1A5</span>, <span class="ruby-value str">'a'</span>)
+ <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>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>test_separate_moves (GameTest)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File test/libttc_test.rb, line 105</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_separate_moves</span>
+ <span class="ruby-identifier">game</span> = <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>)
+
+ <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>]
+ <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>]
+ <span class="ruby-identifier">pieceB2</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>]
+
+ <span class="ruby-identifier">posA</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>]
+ <span class="ruby-identifier">posB</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'b'</span>]
+ <span class="ruby-identifier">posA3</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>]
+ <span class="ruby-identifier">posA4</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a4'</span>]
+ <span class="ruby-identifier">posA5</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a5'</span>]
+
+ <span class="ruby-identifier">moveA2A</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA</span> , <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-identifier">moveA1A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA1</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveA2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA4</span>)
+ <span class="ruby-identifier">moveA2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveB2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA4</span>)
+
+ <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">moveA1A5</span>, <span class="ruby-value str">'a'</span>)
+ <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>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">moveB2A3</span>, <span class="ruby-value str">'b'</span>)
+ <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">2</span>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>test_captures (GameTest)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File test/libttc_test.rb, line 164</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_captures</span>
+ <span class="ruby-identifier">game</span> = <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>)
+
+ <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>]
+ <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>]
+ <span class="ruby-identifier">pieceB2</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>]
+
+ <span class="ruby-identifier">posA</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>]
+ <span class="ruby-identifier">posB</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'b'</span>]
+ <span class="ruby-identifier">posA3</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>]
+ <span class="ruby-identifier">posA4</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a4'</span>]
+ <span class="ruby-identifier">posA5</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a5'</span>]
+
+ <span class="ruby-identifier">moveA2A</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA</span> , <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-identifier">moveA1A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA1</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveA2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA4</span>)
+ <span class="ruby-identifier">moveA2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveB2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA4</span>)
+
+ <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">moveA1A5</span>, <span class="ruby-value str">'a'</span>)
+ <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>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">moveB2A5</span>, <span class="ruby-value str">'b'</span>)
+ <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">2</span>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'a5'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>test_no_captures_on_safe_spaces (GameTest)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File test/libttc_test.rb, line 223</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_no_captures_on_safe_spaces</span>
+ <span class="ruby-identifier">game</span> = <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>)
+
+ <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>]
+ <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>]
+ <span class="ruby-identifier">pieceB2</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>]
+
+ <span class="ruby-identifier">posA</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>]
+ <span class="ruby-identifier">posB</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'b'</span>]
+ <span class="ruby-identifier">posA3</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>]
+ <span class="ruby-identifier">posA4</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a4'</span>]
+ <span class="ruby-identifier">posA5</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a5'</span>]
+
+ <span class="ruby-identifier">moveA2A</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA</span> , <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-identifier">moveA1A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA1</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveA2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA4</span>)
+ <span class="ruby-identifier">moveA2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveB2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA4</span>)
+
+ <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">moveA2A4</span>, <span class="ruby-value str">'a'</span>)
+ <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>
+ <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>]
+ <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>
+ <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>, []
+ <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">'a4'</span>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">moveB2A4</span>, <span class="ruby-value str">'b'</span>)
+ <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">2</span>
+ <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>]
+ <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>
+ <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>, []
+ <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">'a4'</span>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'a4'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>test_move_after_captures (GameTest)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File test/libttc_test.rb, line 280</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_move_after_captures</span>
+ <span class="ruby-identifier">game</span> = <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>)
+
+ <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>]
+ <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>]
+ <span class="ruby-identifier">pieceB2</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>]
+
+ <span class="ruby-identifier">posA</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>]
+ <span class="ruby-identifier">posB</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'b'</span>]
+ <span class="ruby-identifier">posA3</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>]
+ <span class="ruby-identifier">posA4</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a4'</span>]
+ <span class="ruby-identifier">posA5</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a5'</span>]
+
+ <span class="ruby-identifier">moveA2A</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA</span> , <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-identifier">moveA1A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA1</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveA2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA4</span>)
+ <span class="ruby-identifier">moveA2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveB2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA4</span>)
+
+ <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">moveA1A5</span>, <span class="ruby-value str">'a'</span>)
+ <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>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">moveB2A5</span>, <span class="ruby-value str">'b'</span>)
+ <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">2</span>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'a5'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">moveA2A4</span>, <span class="ruby-value str">'a'</span>)
+ <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">3</span>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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">'a4'</span>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'a5'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">moveB2A3</span>, <span class="ruby-value str">'b'</span>)
+ <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">4</span>
+ <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>]
+ <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>
+ <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>, []
+ <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">'a4'</span>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>test_game (GameTest)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File test/libttc_test.rb, line 365</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_game</span>
+ <span class="ruby-identifier">game</span> = <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>)
+
+ <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>]
+ <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>]
+ <span class="ruby-identifier">pieceB2</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>]
+
+ <span class="ruby-identifier">posA</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>]
+ <span class="ruby-identifier">posB</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'b'</span>]
+ <span class="ruby-identifier">posA3</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>]
+ <span class="ruby-identifier">posA4</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a4'</span>]
+ <span class="ruby-identifier">posA5</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a5'</span>]
+
+ <span class="ruby-identifier">moveA2A</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA</span> , <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-identifier">moveA1A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA1</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveA1A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA1</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveA2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA4</span>)
+ <span class="ruby-identifier">moveA2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveB2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA4</span>)
+
+ <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">moveA1A5</span>, <span class="ruby-value str">'a'</span>)
+ <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>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">moveB2A3</span>, <span class="ruby-value str">'b'</span>)
+ <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">2</span>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">moveA2A4</span>, <span class="ruby-value str">'a'</span>)
+ <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">3</span>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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">'a4'</span>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">moveB2A5</span>, <span class="ruby-value str">'b'</span>)
+ <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">4</span>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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">'a4'</span>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'a5'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
+
+ <span class="ruby-identifier">assert_raise</span>(<span class="ruby-constant">InvalidMoveError</span>) {<span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">moveA1A3</span>, <span class="ruby-value str">'a'</span>)}
+ <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">4</span>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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">'a4'</span>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'a5'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">moveA2A3</span>, <span class="ruby-value str">'a'</span>)
+ <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>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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">'a3'</span>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'a5'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">moveB2A4</span>, <span class="ruby-value str">'b'</span>)
+ <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>
+ <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">'a4'</span>]
+ <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>
+ <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>, []
+ <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">'a3'</span>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'a4'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">moveA2A4</span>, <span class="ruby-value str">'a'</span>)
+ <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">7</span>
+ <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">'a4'</span>]
+ <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>
+ <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>, []
+ <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">'a4'</span>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'a4'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">moveB2A3</span>, <span class="ruby-value str">'b'</span>)
+ <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>
+ <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>]
+ <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>
+ <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>, []
+ <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">'a4'</span>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">moveA2A3</span>, <span class="ruby-value str">'a'</span>)
+ <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>
+ <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>]
+ <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>
+ <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>, []
+ <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">'a3'</span>]
+ <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>
+ <span class="ruby-identifier">assert</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>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert</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>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceB2</span>)
+ <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>.<span class="ruby-identifier">length</span>, <span class="ruby-value">2</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">true</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">moveA2A</span>, <span class="ruby-value str">'a'</span>)
+ <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">10</span>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">true</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>test_apply_moves! (GameTest)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File test/libttc_test.rb, line 539</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_apply_moves!</span>
+ <span class="ruby-identifier">game</span> = <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">3</span>)
+ <span class="ruby-identifier">move_set</span> = [<span class="ruby-value str">'A1 A2'</span>, <span class="ruby-value str">'C1 C2'</span>, <span class="ruby-value str">'E1 E2'</span>]
+ <span class="ruby-identifier">assert_nothing_raised</span> { <span class="ruby-identifier">move_set</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>) } }
+ <span class="ruby-identifier">move_set_m</span> = <span class="ruby-identifier">move_set</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>) }
+ <span class="ruby-identifier">assert_nothing_raised</span> { <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_moves!</span> <span class="ruby-identifier">move_set_m</span> }
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>test_eliminations (GameTest)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File test/libttc_test.rb, line 547</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_eliminations</span>
+ <span class="ruby-identifier">game</span> = <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">3</span>, <span class="ruby-value">6</span>, <span class="ruby-value">6</span>, <span class="ruby-value">6</span>, <span class="ruby-value">2</span>)
+
+ <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>]
+ <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>]
+ <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>]
+ <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>]
+ <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>]
+ <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>]
+
+ <span class="ruby-identifier">posAC5</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>]
+ <span class="ruby-identifier">posBC5</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'bc5'</span>]
+ <span class="ruby-identifier">posCC5</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>]
+ <span class="ruby-identifier">posEC5</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>]
+ <span class="ruby-identifier">posAC6</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>]
+
+ <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>,
+ <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>
+ <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>
+ <span class="ruby-identifier">move_set3</span> = [<span class="ruby-value str">'A2 AC6'</span>] <span class="ruby-comment cmt"># E1+C1+A1 captured by A2</span>
+ <span class="ruby-identifier">move_set4</span> = [<span class="ruby-value str">'C2 AC6'</span>] <span class="ruby-comment cmt"># A2+E1+C1+A1 captured by C2. Player A now eliminated</span>
+ <span class="ruby-identifier">move_set5</span> = [<span class="ruby-value str">'E2 BC5'</span>]
+ <span class="ruby-identifier">move_set6</span> = [<span class="ruby-value str">'C2 BC5'</span>] <span class="ruby-comment cmt"># C2 (plus stack) captures E2. Player E now eliminated</span>
+
+ <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>
+
+ <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>)}
+ <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>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>)
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>
+
+ <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>)}
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>)
+ <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>)
+ <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>]
+ <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>
+ <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>, []
+ <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>
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_moves!</span> <span class="ruby-identifier">move_set3</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>)}
+ <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>]
+ <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>
+ <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>, []
+ <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">'ac6'</span>]
+ <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>
+ <span class="ruby-identifier">assert</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>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert</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>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceC1</span>)
+ <span class="ruby-identifier">assert</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>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceE1</span>)
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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">true</span>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_moves!</span> <span class="ruby-identifier">move_set4</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>)}
+ <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>]
+ <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>
+ <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>, []
+ <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">'ac6'</span>]
+ <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">true</span>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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">'ac6'</span>]
+ <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>
+ <span class="ruby-identifier">assert</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>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert</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>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA2</span>)
+ <span class="ruby-identifier">assert</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>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceC1</span>)
+ <span class="ruby-identifier">assert</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>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceE1</span>)
+ <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>]
+ <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">true</span>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_moves!</span> <span class="ruby-identifier">move_set5</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>)}
+ <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>]
+ <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>
+ <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>, []
+ <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">'ac6'</span>]
+ <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">true</span>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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">'ac6'</span>]
+ <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>
+ <span class="ruby-identifier">assert</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>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert</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>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA2</span>)
+ <span class="ruby-identifier">assert</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>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceC1</span>)
+ <span class="ruby-identifier">assert</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>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceE1</span>)
+ <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>]
+ <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">true</span>
+ <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>, []
+ <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">'bc5'</span>]
+ <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>
+ <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>, []
+ <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>
+
+ <span class="ruby-identifier">assert_raise</span> (<span class="ruby-constant">GameWonNotice</span>) { <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_moves!</span> <span class="ruby-identifier">move_set6</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>)} }
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>test_undo_move! (GameTest)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File test/libttc_test.rb, line 710</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_undo_move!</span>
+ <span class="ruby-identifier">game</span> = <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">3</span>)
+
+ <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>]
+ <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>]
+ <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>]
+ <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>]
+ <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>]
+ <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>]
+
+ <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">undo_move!</span>
+ <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>
+
+ <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>) }
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">undo_move!</span>
+ <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>
+
+ <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>,
+ <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>
+ <span class="ruby-identifier">move_set1a</span> = [<span class="ruby-value str">'C1 AC6'</span>]
+ <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>
+ <span class="ruby-identifier">move_set2a</span> = [<span class="ruby-value str">'E1 AC6'</span>]
+
+ <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>)}
+ <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>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>)
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">undo_move!</span>
+ <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>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>
+
+ <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>)}
+ <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>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>)
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>
+
+ <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>)}
+ <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>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>)
+ <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>)
+ <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>]
+ <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>
+ <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>, []
+ <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>
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">undo_move!</span>
+ <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>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>
+ <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>)
+
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>
+
+ <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>
+ <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>]
+
+
+ <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>)}
+ <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>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>)
+ <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>)
+ <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>]
+ <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>
+ <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>, []
+ <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>
+
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>test_init (GameTest)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File test/game-test.rb, line 7</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_init</span>
+ <span class="ruby-identifier">assert_nothing_raised</span> { <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>) }
+ <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>).<span class="ruby-identifier">history</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>test_game_init (GameTest)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File test/game-test.rb, line 13</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_game_init</span>
+ <span class="ruby-identifier">game</span> = <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>)
+
+ <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>]
+ <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>]
+ <span class="ruby-identifier">pieceB2</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>]
+
+ <span class="ruby-identifier">posA</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>]
+ <span class="ruby-identifier">posB</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'b'</span>]
+ <span class="ruby-identifier">posA3</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>]
+ <span class="ruby-identifier">posA4</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a4'</span>]
+ <span class="ruby-identifier">posA5</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a5'</span>]
+
+ <span class="ruby-identifier">moveA2A</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA</span> , <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-identifier">moveA1A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA1</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveA2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA4</span>)
+ <span class="ruby-identifier">moveA2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveB2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA4</span>)
+
+ <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>test_single_moves_1 (GameTest)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File test/game-test.rb, line 47</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_single_moves_1</span>
+ <span class="ruby-identifier">game</span> = <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>)
+
+ <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>]
+ <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>]
+ <span class="ruby-identifier">pieceB2</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>]
+
+ <span class="ruby-identifier">posA</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>]
+ <span class="ruby-identifier">posB</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'b'</span>]
+ <span class="ruby-identifier">posA3</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>]
+ <span class="ruby-identifier">posA4</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a4'</span>]
+ <span class="ruby-identifier">posA5</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a5'</span>]
+
+ <span class="ruby-identifier">moveA2A</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA</span> , <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-identifier">moveA1A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA1</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveA2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA4</span>)
+ <span class="ruby-identifier">moveA2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveB2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA4</span>)
+
+ <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">assert_raise</span>(<span class="ruby-constant">InvalidMoveError</span>) {<span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveA1A5</span>, <span class="ruby-value str">'b'</span>)}
+
+ <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveA1A5</span>, <span class="ruby-value str">'a'</span>)
+ <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>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>test_separate_moves (GameTest)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File test/game-test.rb, line 105</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_separate_moves</span>
+ <span class="ruby-identifier">game</span> = <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>)
+
+ <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>]
+ <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>]
+ <span class="ruby-identifier">pieceB2</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>]
+
+ <span class="ruby-identifier">posA</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>]
+ <span class="ruby-identifier">posB</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'b'</span>]
+ <span class="ruby-identifier">posA3</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>]
+ <span class="ruby-identifier">posA4</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a4'</span>]
+ <span class="ruby-identifier">posA5</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a5'</span>]
+
+ <span class="ruby-identifier">moveA2A</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA</span> , <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-identifier">moveA1A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA1</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveA2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA4</span>)
+ <span class="ruby-identifier">moveA2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveB2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA4</span>)
+
+ <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveA1A5</span>, <span class="ruby-value str">'a'</span>)
+ <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>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveB2A3</span>, <span class="ruby-value str">'b'</span>)
+ <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">2</span>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>test_captures (GameTest)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File test/game-test.rb, line 164</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_captures</span>
+ <span class="ruby-identifier">game</span> = <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>)
+
+ <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>]
+ <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>]
+ <span class="ruby-identifier">pieceB2</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>]
+
+ <span class="ruby-identifier">posA</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>]
+ <span class="ruby-identifier">posB</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'b'</span>]
+ <span class="ruby-identifier">posA3</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>]
+ <span class="ruby-identifier">posA4</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a4'</span>]
+ <span class="ruby-identifier">posA5</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a5'</span>]
+
+ <span class="ruby-identifier">moveA2A</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA</span> , <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-identifier">moveA1A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA1</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveA2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA4</span>)
+ <span class="ruby-identifier">moveA2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveB2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA4</span>)
+
+ <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveA1A5</span>, <span class="ruby-value str">'a'</span>)
+ <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>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveB2A5</span>, <span class="ruby-value str">'b'</span>)
+ <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">2</span>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'a5'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>test_no_captures_on_safe_spaces (GameTest)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File test/game-test.rb, line 223</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_no_captures_on_safe_spaces</span>
+ <span class="ruby-identifier">game</span> = <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>)
+
+ <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>]
+ <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>]
+ <span class="ruby-identifier">pieceB2</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>]
+
+ <span class="ruby-identifier">posA</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>]
+ <span class="ruby-identifier">posB</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'b'</span>]
+ <span class="ruby-identifier">posA3</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>]
+ <span class="ruby-identifier">posA4</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a4'</span>]
+ <span class="ruby-identifier">posA5</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a5'</span>]
+
+ <span class="ruby-identifier">moveA2A</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA</span> , <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-identifier">moveA1A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA1</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveA2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA4</span>)
+ <span class="ruby-identifier">moveA2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveB2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA4</span>)
+
+ <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveA2A4</span>, <span class="ruby-value str">'a'</span>)
+ <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>
+ <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>]
+ <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>
+ <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>, []
+ <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">'a4'</span>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveB2A4</span>, <span class="ruby-value str">'b'</span>)
+ <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">2</span>
+ <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>]
+ <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>
+ <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>, []
+ <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">'a4'</span>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'a4'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>test_move_after_captures (GameTest)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File test/game-test.rb, line 280</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_move_after_captures</span>
+ <span class="ruby-identifier">game</span> = <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>)
+
+ <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>]
+ <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>]
+ <span class="ruby-identifier">pieceB2</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>]
+
+ <span class="ruby-identifier">posA</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>]
+ <span class="ruby-identifier">posB</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'b'</span>]
+ <span class="ruby-identifier">posA3</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>]
+ <span class="ruby-identifier">posA4</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a4'</span>]
+ <span class="ruby-identifier">posA5</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a5'</span>]
+
+ <span class="ruby-identifier">moveA2A</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA</span> , <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-identifier">moveA1A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA1</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveA2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA4</span>)
+ <span class="ruby-identifier">moveA2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveB2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA4</span>)
+
+ <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveA1A5</span>, <span class="ruby-value str">'a'</span>)
+ <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>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveB2A5</span>, <span class="ruby-value str">'b'</span>)
+ <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">2</span>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'a5'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveA2A4</span>, <span class="ruby-value str">'a'</span>)
+ <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">3</span>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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">'a4'</span>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'a5'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveB2A3</span>, <span class="ruby-value str">'b'</span>)
+ <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">4</span>
+ <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>]
+ <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>
+ <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>, []
+ <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">'a4'</span>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>test_game (GameTest)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File test/game-test.rb, line 365</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_game</span>
+ <span class="ruby-identifier">game</span> = <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>)
+
+ <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>]
+ <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>]
+ <span class="ruby-identifier">pieceB2</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>]
+
+ <span class="ruby-identifier">posA</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>]
+ <span class="ruby-identifier">posB</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'b'</span>]
+ <span class="ruby-identifier">posA3</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>]
+ <span class="ruby-identifier">posA4</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a4'</span>]
+ <span class="ruby-identifier">posA5</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a5'</span>]
+
+ <span class="ruby-identifier">moveA2A</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA</span> , <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-identifier">moveA1A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA1</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveA1A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA1</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveA2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA4</span>)
+ <span class="ruby-identifier">moveA2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveB2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA4</span>)
+
+ <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveA1A5</span>, <span class="ruby-value str">'a'</span>)
+ <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>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveB2A3</span>, <span class="ruby-value str">'b'</span>)
+ <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">2</span>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveA2A4</span>, <span class="ruby-value str">'a'</span>)
+ <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">3</span>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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">'a4'</span>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveB2A5</span>, <span class="ruby-value str">'b'</span>)
+ <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">4</span>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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">'a4'</span>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'a5'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
+
+ <span class="ruby-identifier">assert_raise</span>(<span class="ruby-constant">InvalidMoveError</span>) {<span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveA1A3</span>, <span class="ruby-value str">'a'</span>)}
+ <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">4</span>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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">'a4'</span>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'a5'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveA2A3</span>, <span class="ruby-value str">'a'</span>)
+ <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>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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">'a3'</span>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'a5'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveB2A4</span>, <span class="ruby-value str">'b'</span>)
+ <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>
+ <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">'a4'</span>]
+ <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>
+ <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>, []
+ <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">'a3'</span>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'a4'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveA2A4</span>, <span class="ruby-value str">'a'</span>)
+ <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">7</span>
+ <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">'a4'</span>]
+ <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>
+ <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>, []
+ <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">'a4'</span>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'a4'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveB2A3</span>, <span class="ruby-value str">'b'</span>)
+ <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>
+ <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>]
+ <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>
+ <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>, []
+ <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">'a4'</span>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveA2A3</span>, <span class="ruby-value str">'a'</span>)
+ <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>
+ <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>]
+ <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>
+ <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>, []
+ <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">'a3'</span>]
+ <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>
+ <span class="ruby-identifier">assert</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>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert</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>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceB2</span>)
+ <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>.<span class="ruby-identifier">length</span>, <span class="ruby-value">2</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">true</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move</span>(<span class="ruby-identifier">moveA2A</span>, <span class="ruby-value str">'a'</span>)
+ <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">10</span>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">true</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>test_init (GameTest)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File test/libttc_test.rb, line 7</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_init</span>
+ <span class="ruby-identifier">assert_nothing_raised</span> { <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>) }
+ <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>).<span class="ruby-identifier">history</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>test_game_init (GameTest)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File test/libttc_test.rb, line 13</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_game_init</span>
+ <span class="ruby-identifier">game</span> = <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>)
+
+ <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>]
+ <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>]
+ <span class="ruby-identifier">pieceB2</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>]
+
+ <span class="ruby-identifier">posA</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>]
+ <span class="ruby-identifier">posB</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'b'</span>]
+ <span class="ruby-identifier">posA3</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>]
+ <span class="ruby-identifier">posA4</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a4'</span>]
+ <span class="ruby-identifier">posA5</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a5'</span>]
+
+ <span class="ruby-identifier">moveA2A</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA</span> , <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-identifier">moveA1A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA1</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveA2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA4</span>)
+ <span class="ruby-identifier">moveA2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveB2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA4</span>)
+
+ <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>test_single_moves_1 (GameTest)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File test/libttc_test.rb, line 47</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_single_moves_1</span>
+ <span class="ruby-identifier">game</span> = <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>)
+
+ <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>]
+ <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>]
+ <span class="ruby-identifier">pieceB2</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>]
+
+ <span class="ruby-identifier">posA</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>]
+ <span class="ruby-identifier">posB</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'b'</span>]
+ <span class="ruby-identifier">posA3</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>]
+ <span class="ruby-identifier">posA4</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a4'</span>]
+ <span class="ruby-identifier">posA5</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a5'</span>]
+
+ <span class="ruby-identifier">moveA2A</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA</span> , <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-identifier">moveA1A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA1</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveA2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA4</span>)
+ <span class="ruby-identifier">moveA2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveB2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA4</span>)
+
+ <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">assert_raise</span>(<span class="ruby-constant">InvalidMoveError</span>) {<span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">moveA1A5</span>, <span class="ruby-value str">'b'</span>)}
+
+ <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">moveA1A5</span>, <span class="ruby-value str">'a'</span>)
+ <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>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>test_separate_moves (GameTest)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File test/libttc_test.rb, line 105</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_separate_moves</span>
+ <span class="ruby-identifier">game</span> = <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>)
+
+ <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>]
+ <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>]
+ <span class="ruby-identifier">pieceB2</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>]
+
+ <span class="ruby-identifier">posA</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>]
+ <span class="ruby-identifier">posB</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'b'</span>]
+ <span class="ruby-identifier">posA3</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>]
+ <span class="ruby-identifier">posA4</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a4'</span>]
+ <span class="ruby-identifier">posA5</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a5'</span>]
+
+ <span class="ruby-identifier">moveA2A</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA</span> , <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-identifier">moveA1A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA1</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveA2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA4</span>)
+ <span class="ruby-identifier">moveA2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveB2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA4</span>)
+
+ <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">moveA1A5</span>, <span class="ruby-value str">'a'</span>)
+ <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>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">moveB2A3</span>, <span class="ruby-value str">'b'</span>)
+ <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">2</span>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>test_captures (GameTest)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File test/libttc_test.rb, line 164</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_captures</span>
+ <span class="ruby-identifier">game</span> = <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>)
+
+ <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>]
+ <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>]
+ <span class="ruby-identifier">pieceB2</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>]
+
+ <span class="ruby-identifier">posA</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>]
+ <span class="ruby-identifier">posB</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'b'</span>]
+ <span class="ruby-identifier">posA3</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>]
+ <span class="ruby-identifier">posA4</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a4'</span>]
+ <span class="ruby-identifier">posA5</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a5'</span>]
+
+ <span class="ruby-identifier">moveA2A</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA</span> , <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-identifier">moveA1A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA1</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveA2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA4</span>)
+ <span class="ruby-identifier">moveA2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveB2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA4</span>)
+
+ <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">moveA1A5</span>, <span class="ruby-value str">'a'</span>)
+ <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>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">moveB2A5</span>, <span class="ruby-value str">'b'</span>)
+ <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">2</span>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'a5'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>test_no_captures_on_safe_spaces (GameTest)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File test/libttc_test.rb, line 223</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_no_captures_on_safe_spaces</span>
+ <span class="ruby-identifier">game</span> = <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>)
+
+ <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>]
+ <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>]
+ <span class="ruby-identifier">pieceB2</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>]
+
+ <span class="ruby-identifier">posA</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>]
+ <span class="ruby-identifier">posB</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'b'</span>]
+ <span class="ruby-identifier">posA3</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>]
+ <span class="ruby-identifier">posA4</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a4'</span>]
+ <span class="ruby-identifier">posA5</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a5'</span>]
+
+ <span class="ruby-identifier">moveA2A</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA</span> , <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-identifier">moveA1A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA1</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveA2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA4</span>)
+ <span class="ruby-identifier">moveA2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveB2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA4</span>)
+
+ <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">moveA2A4</span>, <span class="ruby-value str">'a'</span>)
+ <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>
+ <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>]
+ <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>
+ <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>, []
+ <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">'a4'</span>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">moveB2A4</span>, <span class="ruby-value str">'b'</span>)
+ <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">2</span>
+ <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>]
+ <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>
+ <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>, []
+ <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">'a4'</span>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'a4'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>test_move_after_captures (GameTest)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File test/libttc_test.rb, line 280</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_move_after_captures</span>
+ <span class="ruby-identifier">game</span> = <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>)
+
+ <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>]
+ <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>]
+ <span class="ruby-identifier">pieceB2</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>]
+
+ <span class="ruby-identifier">posA</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>]
+ <span class="ruby-identifier">posB</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'b'</span>]
+ <span class="ruby-identifier">posA3</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>]
+ <span class="ruby-identifier">posA4</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a4'</span>]
+ <span class="ruby-identifier">posA5</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a5'</span>]
+
+ <span class="ruby-identifier">moveA2A</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA</span> , <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-identifier">moveA1A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA1</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveA2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA4</span>)
+ <span class="ruby-identifier">moveA2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveB2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA4</span>)
+
+ <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">moveA1A5</span>, <span class="ruby-value str">'a'</span>)
+ <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>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">moveB2A5</span>, <span class="ruby-value str">'b'</span>)
+ <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">2</span>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'a5'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">moveA2A4</span>, <span class="ruby-value str">'a'</span>)
+ <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">3</span>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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">'a4'</span>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'a5'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">moveB2A3</span>, <span class="ruby-value str">'b'</span>)
+ <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">4</span>
+ <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>]
+ <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>
+ <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>, []
+ <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">'a4'</span>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>test_game (GameTest)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File test/libttc_test.rb, line 365</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_game</span>
+ <span class="ruby-identifier">game</span> = <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>,<span class="ruby-value">6</span>)
+
+ <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>]
+ <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>]
+ <span class="ruby-identifier">pieceB2</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>]
+
+ <span class="ruby-identifier">posA</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>]
+ <span class="ruby-identifier">posB</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'b'</span>]
+ <span class="ruby-identifier">posA3</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>]
+ <span class="ruby-identifier">posA4</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a4'</span>]
+ <span class="ruby-identifier">posA5</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'a5'</span>]
+
+ <span class="ruby-identifier">moveA2A</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA</span> , <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-identifier">moveA1A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA1</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveA1A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA1</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveA2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA4</span>)
+ <span class="ruby-identifier">moveA2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceA2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A5</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA5</span>)
+ <span class="ruby-identifier">moveB2A3</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA3</span>)
+ <span class="ruby-identifier">moveB2A4</span> = <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">pieceB2</span>, <span class="ruby-identifier">posA4</span>)
+
+ <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">moveA1A5</span>, <span class="ruby-value str">'a'</span>)
+ <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>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'b'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">moveB2A3</span>, <span class="ruby-value str">'b'</span>)
+ <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">2</span>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">moveA2A4</span>, <span class="ruby-value str">'a'</span>)
+ <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">3</span>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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">'a4'</span>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">moveB2A5</span>, <span class="ruby-value str">'b'</span>)
+ <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">4</span>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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">'a4'</span>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'a5'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
+
+ <span class="ruby-identifier">assert_raise</span>(<span class="ruby-constant">InvalidMoveError</span>) {<span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">moveA1A3</span>, <span class="ruby-value str">'a'</span>)}
+ <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">4</span>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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">'a4'</span>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'a5'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">moveA2A3</span>, <span class="ruby-value str">'a'</span>)
+ <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>
+ <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">'a5'</span>]
+ <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>
+ <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>, []
+ <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">'a3'</span>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'a5'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">moveB2A4</span>, <span class="ruby-value str">'b'</span>)
+ <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>
+ <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">'a4'</span>]
+ <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>
+ <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>, []
+ <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">'a3'</span>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'a4'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">moveA2A4</span>, <span class="ruby-value str">'a'</span>)
+ <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">7</span>
+ <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">'a4'</span>]
+ <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>
+ <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>, []
+ <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">'a4'</span>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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">'a4'</span>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">moveB2A3</span>, <span class="ruby-value str">'b'</span>)
+ <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>
+ <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>]
+ <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>
+ <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>, []
+ <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">'a4'</span>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">false</span>
+ <span class="ruby-identifier">assert</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span>, <span class="ruby-value">1</span>
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">moveA2A3</span>, <span class="ruby-value str">'a'</span>)
+ <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>
+ <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>]
+ <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>
+ <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>, []
+ <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">'a3'</span>]
+ <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>
+ <span class="ruby-identifier">assert</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>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert</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>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceB2</span>)
+ <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>.<span class="ruby-identifier">length</span>, <span class="ruby-value">2</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">true</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span>(<span class="ruby-identifier">moveA2A</span>, <span class="ruby-value str">'a'</span>)
+ <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">10</span>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</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>]
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">captured</span>, <span class="ruby-keyword kw">true</span>
+ <span class="ruby-identifier">assert_equal</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-value str">'b2'</span>].<span class="ruby-identifier">contains</span>, []
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>test_apply_moves! (GameTest)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File test/libttc_test.rb, line 539</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_apply_moves!</span>
+ <span class="ruby-identifier">game</span> = <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">3</span>)
+ <span class="ruby-identifier">move_set</span> = [<span class="ruby-value str">'A1 A2'</span>, <span class="ruby-value str">'C1 C2'</span>, <span class="ruby-value str">'E1 E2'</span>]
+ <span class="ruby-identifier">assert_nothing_raised</span> { <span class="ruby-identifier">move_set</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>) } }
+ <span class="ruby-identifier">move_set_m</span> = <span class="ruby-identifier">move_set</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>) }
+ <span class="ruby-identifier">assert_nothing_raised</span> { <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_moves!</span> <span class="ruby-identifier">move_set_m</span> }
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>test_eliminations (GameTest)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File test/libttc_test.rb, line 547</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_eliminations</span>
+ <span class="ruby-identifier">game</span> = <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">3</span>, <span class="ruby-value">6</span>, <span class="ruby-value">6</span>, <span class="ruby-value">6</span>, <span class="ruby-value">2</span>)
+
+ <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>]
+ <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>]
+ <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>]
+ <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>]
+ <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>]
+ <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>]
+
+ <span class="ruby-identifier">posAC5</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>]
+ <span class="ruby-identifier">posBC5</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-value str">'bc5'</span>]
+ <span class="ruby-identifier">posCC5</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>]
+ <span class="ruby-identifier">posEC5</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>]
+ <span class="ruby-identifier">posAC6</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>]
+
+ <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>,
+ <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>
+ <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>
+ <span class="ruby-identifier">move_set3</span> = [<span class="ruby-value str">'A2 AC6'</span>] <span class="ruby-comment cmt"># E1+C1+A1 captured by A2</span>
+ <span class="ruby-identifier">move_set4</span> = [<span class="ruby-value str">'C2 AC6'</span>] <span class="ruby-comment cmt"># A2+E1+C1+A1 captured by C2. Player A now eliminated</span>
+ <span class="ruby-identifier">move_set5</span> = [<span class="ruby-value str">'E2 BC5'</span>]
+ <span class="ruby-identifier">move_set6</span> = [<span class="ruby-value str">'C2 BC5'</span>] <span class="ruby-comment cmt"># C2 (plus stack) captures E2. Player E now eliminated</span>
+
+ <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>
+
+ <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>)}
+ <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>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>)
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>
+
+ <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>)}
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>)
+ <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>)
+ <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>]
+ <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>
+ <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>, []
+ <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>
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_moves!</span> <span class="ruby-identifier">move_set3</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>)}
+ <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>]
+ <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>
+ <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>, []
+ <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">'ac6'</span>]
+ <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>
+ <span class="ruby-identifier">assert</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>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert</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>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceC1</span>)
+ <span class="ruby-identifier">assert</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>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceE1</span>)
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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">true</span>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_moves!</span> <span class="ruby-identifier">move_set4</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>)}
+ <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>]
+ <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>
+ <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>, []
+ <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">'ac6'</span>]
+ <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">true</span>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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">'ac6'</span>]
+ <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>
+ <span class="ruby-identifier">assert</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>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert</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>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA2</span>)
+ <span class="ruby-identifier">assert</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>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceC1</span>)
+ <span class="ruby-identifier">assert</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>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceE1</span>)
+ <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>]
+ <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">true</span>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_moves!</span> <span class="ruby-identifier">move_set5</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>)}
+ <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>]
+ <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>
+ <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>, []
+ <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">'ac6'</span>]
+ <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">true</span>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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">'ac6'</span>]
+ <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>
+ <span class="ruby-identifier">assert</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>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA1</span>)
+ <span class="ruby-identifier">assert</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>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceA2</span>)
+ <span class="ruby-identifier">assert</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>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceC1</span>)
+ <span class="ruby-identifier">assert</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>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">pieceE1</span>)
+ <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>]
+ <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">true</span>
+ <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>, []
+ <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">'bc5'</span>]
+ <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>
+ <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>, []
+ <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>
+
+ <span class="ruby-identifier">assert_raise</span> (<span class="ruby-constant">GameWonNotice</span>) { <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_moves!</span> <span class="ruby-identifier">move_set6</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>)} }
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>test_undo_move! (GameTest)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File test/libttc_test.rb, line 710</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">test_undo_move!</span>
+ <span class="ruby-identifier">game</span> = <span class="ruby-constant">Game</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">3</span>)
+
+ <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>]
+ <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>]
+ <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>]
+ <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>]
+ <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>]
+ <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>]
+
+ <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">undo_move!</span>
+ <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>
+
+ <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>) }
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">undo_move!</span>
+ <span class="ruby-identifier">assert_equal</span> [], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">history</span>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>
+
+ <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>,
+ <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>
+ <span class="ruby-identifier">move_set1a</span> = [<span class="ruby-value str">'C1 AC6'</span>]
+ <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>
+ <span class="ruby-identifier">move_set2a</span> = [<span class="ruby-value str">'E1 AC6'</span>]
+
+ <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>)}
+ <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>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>)
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">undo_move!</span>
+ <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>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>
+
+ <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>)}
+ <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>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>)
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>
+
+ <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>)}
+ <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>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>)
+ <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>)
+ <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>]
+ <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>
+ <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>, []
+ <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>
+
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">undo_move!</span>
+ <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>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>
+ <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>)
+
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>
+
+ <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>
+ <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>]
+
+
+ <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>)}
+ <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>
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>, []
+ <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>]
+ <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>
+ <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>)
+ <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>)
+ <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>]
+ <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>
+ <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>, []
+ <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>
+
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Class: GameWonInHistoryError</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="classHeader">
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Class</strong></td>
+ <td class="class-name-in-header">GameWonInHistoryError</td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>In:</strong></td>
+ <td>
+ <a href="../files/src/ttc_rb.html">
+ src/ttc.rb
+ </a>
+ <br />
+ </td>
+ </tr>
+
+ <tr class="top-aligned-row">
+ <td><strong>Parent:</strong></td>
+ <td>
+ StandardError
+ </td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+
+
+ </div>
+
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Class: GameWonNotice</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="classHeader">
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Class</strong></td>
+ <td class="class-name-in-header">GameWonNotice</td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>In:</strong></td>
+ <td>
+ <a href="../files/lib/libttc_rb.html">
+ lib/libttc.rb
+ </a>
+ <br />
+ </td>
+ </tr>
+
+ <tr class="top-aligned-row">
+ <td><strong>Parent:</strong></td>
+ <td>
+ StandardError
+ </td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <p>
+<a href="Game.html">Game</a> is won when only one player has uncaptured
+pieces
+</p>
+
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Class: Genome</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="classHeader">
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Class</strong></td>
+ <td class="class-name-in-header">Genome</td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>In:</strong></td>
+ <td>
+ <a href="../files/lib/libgenetics_rb.html">
+ lib/libgenetics.rb
+ </a>
+ <br />
+ <a href="../files/lib/libpplayer_rb.html">
+ lib/libpplayer.rb
+ </a>
+ <br />
+ </td>
+ </tr>
+
+ <tr class="top-aligned-row">
+ <td><strong>Parent:</strong></td>
+ <td>
+ Object
+ </td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <p>
+A single genome in a population
+</p>
+
+ </div>
+
+
+ </div>
+
+ <div id="method-list">
+ <h3 class="section-bar">Methods</h3>
+
+ <div class="name-list">
+ <a href="#M000004">crossover</a>
+ <a href="#M000002">mutate</a>
+ <a href="#M000003">mutate!</a>
+ <a href="#M000001">new</a>
+ <a href="#M000005">to_potential_player</a>
+ </div>
+ </div>
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+ <div id="attribute-list">
+ <h3 class="section-bar">Attributes</h3>
+
+ <div class="name-list">
+ <table>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">genome</td>
+ <td class="context-item-value"> [RW] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ </table>
+ </div>
+ </div>
+
+
+
+ <!-- if method_list -->
+ <div id="methods">
+ <h3 class="section-bar">Public Class methods</h3>
+
+ <div id="method-M000001" class="method-detail">
+ <a name="M000001"></a>
+
+ <div class="method-heading">
+ <a href="Genome.src/M000001.html" target="Code" class="method-signature"
+ onclick="popupCode('Genome.src/M000001.html');return false;">
+ <span class="method-name">new</span><span class="method-args">(bitstring_or_length)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Create a random genome of the given length
+</p>
+ </div>
+ </div>
+
+ <h3 class="section-bar">Public Instance methods</h3>
+
+ <div id="method-M000004" class="method-detail">
+ <a name="M000004"></a>
+
+ <div class="method-heading">
+ <a href="Genome.src/M000004.html" target="Code" class="method-signature"
+ onclick="popupCode('Genome.src/M000004.html');return false;">
+ <span class="method-name">crossover</span><span class="method-args">(other_genome, crossover_point)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Crossover two genomes at the given point
+</p>
+ </div>
+ </div>
+
+ <div id="method-M000002" class="method-detail">
+ <a name="M000002"></a>
+
+ <div class="method-heading">
+ <a href="Genome.src/M000002.html" target="Code" class="method-signature"
+ onclick="popupCode('Genome.src/M000002.html');return false;">
+ <span class="method-name">mutate</span><span class="method-args">(mutation_probability = 0.05)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Mutate a genome with the given rate per bit
+</p>
+ </div>
+ </div>
+
+ <div id="method-M000003" class="method-detail">
+ <a name="M000003"></a>
+
+ <div class="method-heading">
+ <a href="Genome.src/M000003.html" target="Code" class="method-signature"
+ onclick="popupCode('Genome.src/M000003.html');return false;">
+ <span class="method-name">mutate!</span><span class="method-args">(mutation_probability = 0.05)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Mutate a genome in-place with the given rate per bit
+</p>
+ </div>
+ </div>
+
+ <div id="method-M000005" class="method-detail">
+ <a name="M000005"></a>
+
+ <div class="method-heading">
+ <a href="Genome.src/M000005.html" target="Code" class="method-signature"
+ onclick="popupCode('Genome.src/M000005.html');return false;">
+ <span class="method-name">to_potential_player</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Create a potential player from a genome
+</p>
+ </div>
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+K 25
+svn:wc:ra_dav:version-url
+V 61
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Genome.src
+END
+M000001.html
+K 25
+svn:wc:ra_dav:version-url
+V 74
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Genome.src/M000001.html
+END
+M000002.html
+K 25
+svn:wc:ra_dav:version-url
+V 74
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Genome.src/M000002.html
+END
+M000003.html
+K 25
+svn:wc:ra_dav:version-url
+V 74
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Genome.src/M000003.html
+END
+M000004.html
+K 25
+svn:wc:ra_dav:version-url
+V 74
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Genome.src/M000004.html
+END
+M000005.html
+K 25
+svn:wc:ra_dav:version-url
+V 74
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Genome.src/M000005.html
+END
--- /dev/null
+8
+
+dir
+68
+http://scripts.njae.me.uk/svn/njae/TrapTheCap/trunk/doc/classes/Genome.src
+http://scripts.njae.me.uk/svn/njae
+
+
+
+2008-10-16T14:11:23.436422Z
+41
+
+
+
+svn:special svn:externals svn:needs-lock
+\f
+M000001.html
+file
+
+
+
+
+2008-04-23T19:33:07.000000Z
+4da286327eca24da7a742049021bbcd0
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000002.html
+file
+
+
+
+
+2008-04-23T19:33:07.000000Z
+205ad88e7b17bd199054e2836209fcd3
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000003.html
+file
+
+
+
+
+2008-04-23T19:33:07.000000Z
+82200bb7f70720fda05beff258c8a3f8
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000004.html
+file
+
+
+
+
+2008-04-23T19:33:07.000000Z
+73d8bfdd6014a17bf9b588a0567dc95a
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000005.html
+file
+
+
+
+
+2008-04-23T19:33:07.000000Z
+b6e5cf5d5537e99bcbd762c110e79307
+2008-10-16T14:11:23.436422Z
+41
+\f
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (Genome)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libgenetics.rb, line 17</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">bitstring_or_length</span>)
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">bitstring_or_length</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Fixnum</span>
+ <span class="ruby-ivar">@genome</span> = []
+ (<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-identifier">bitstring_or_length</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
+ <span class="ruby-ivar">@genome</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">rand</span>(<span class="ruby-value">2</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-ivar">@genome</span> = <span class="ruby-identifier">bitstring_or_length</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>mutate (Genome)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libgenetics.rb, line 29</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mutate</span>(<span class="ruby-identifier">mutation_probability</span> = <span class="ruby-value">0</span><span class="ruby-value">.05</span>)
+ <span class="ruby-identifier">new_genome</span> = <span class="ruby-constant">Genome</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@genome</span>.<span class="ruby-identifier">length</span>)
+ (<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-ivar">@genome</span>.<span class="ruby-identifier">length</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rand</span>(<span class="ruby-value">1</span>) <span class="ruby-operator"><</span> <span class="ruby-identifier">mutation_probability</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@genome</span>[<span class="ruby-identifier">i</span>] <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
+ <span class="ruby-identifier">new_genome</span>.<span class="ruby-identifier">genome</span>[<span class="ruby-identifier">i</span>] = <span class="ruby-value">1</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">new_genome</span>.<span class="ruby-identifier">genome</span>[<span class="ruby-identifier">i</span>] = <span class="ruby-value">0</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">new_genome</span>.<span class="ruby-identifier">genome</span>[<span class="ruby-identifier">i</span>] = <span class="ruby-ivar">@genome</span>[<span class="ruby-identifier">i</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">new_genome</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>mutate! (Genome)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libgenetics.rb, line 46</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mutate!</span>(<span class="ruby-identifier">mutation_probability</span> = <span class="ruby-value">0</span><span class="ruby-value">.05</span>)
+ (<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-ivar">@genome</span>.<span class="ruby-identifier">length</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rand</span>(<span class="ruby-value">1</span>) <span class="ruby-operator"><</span> <span class="ruby-identifier">mutation_probability</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@genome</span>[<span class="ruby-identifier">i</span>] <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
+ <span class="ruby-ivar">@genome</span>[<span class="ruby-identifier">i</span>] = <span class="ruby-value">1</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-ivar">@genome</span>[<span class="ruby-identifier">i</span>] = <span class="ruby-value">0</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-ivar">@genome</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>crossover (Genome)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libgenetics.rb, line 60</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">crossover</span>(<span class="ruby-identifier">other_genome</span>, <span class="ruby-identifier">crossover_point</span>)
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"Different size genomes"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@genome</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">other_genome</span>.<span class="ruby-identifier">genome</span>.<span class="ruby-identifier">length</span>
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"Our of bounds crossover point"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">crossover_point</span> <span class="ruby-operator"><</span> <span class="ruby-value">0</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">crossover_point</span> <span class="ruby-operator">></span> <span class="ruby-ivar">@genome</span>.<span class="ruby-identifier">length</span>
+ <span class="ruby-identifier">child1</span> = <span class="ruby-constant">Genome</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">0</span>)
+ <span class="ruby-identifier">child2</span> = <span class="ruby-constant">Genome</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">0</span>)
+ <span class="ruby-identifier">child1</span>.<span class="ruby-identifier">genome</span> = <span class="ruby-ivar">@genome</span>[<span class="ruby-value">0</span>, <span class="ruby-identifier">crossover_point</span>] <span class="ruby-operator">+</span> <span class="ruby-identifier">other_genome</span>.<span class="ruby-identifier">genome</span>[<span class="ruby-identifier">crossover_point</span>, <span class="ruby-ivar">@genome</span>.<span class="ruby-identifier">length</span>]
+ <span class="ruby-identifier">child1</span>.<span class="ruby-identifier">genome</span> = <span class="ruby-identifier">other_genome</span>.<span class="ruby-identifier">genome</span>[<span class="ruby-value">0</span>, <span class="ruby-identifier">crossover_point</span>] <span class="ruby-operator">+</span> <span class="ruby-ivar">@genome</span>[<span class="ruby-identifier">crossover_point</span>, <span class="ruby-ivar">@genome</span>.<span class="ruby-identifier">length</span>]
+ [<span class="ruby-identifier">child1</span>, <span class="ruby-identifier">child2</span>]
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_potential_player (Genome)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libpplayer.rb, line 96</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_potential_player</span>
+ <span class="ruby-identifier">friend_pull</span> = <span class="ruby-ivar">@genome</span>[<span class="ruby-value">0</span>, <span class="ruby-value">4</span>].<span class="ruby-identifier">gray_decode</span>.<span class="ruby-identifier">to_decimal</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-operator">/</span> <span class="ruby-value">4</span>
+ <span class="ruby-identifier">enemy_pull</span> = <span class="ruby-ivar">@genome</span>[<span class="ruby-value">4</span>, <span class="ruby-value">4</span>].<span class="ruby-identifier">gray_decode</span>.<span class="ruby-identifier">to_decimal</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-operator">/</span> <span class="ruby-value">4</span>
+ <span class="ruby-identifier">base_pull</span> = <span class="ruby-ivar">@genome</span>[<span class="ruby-value">8</span>, <span class="ruby-value">4</span>].<span class="ruby-identifier">gray_decode</span>.<span class="ruby-identifier">to_decimal</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-operator">/</span> <span class="ruby-value">4</span>
+ <span class="ruby-identifier">safe_bonus</span> = <span class="ruby-ivar">@genome</span>[<span class="ruby-value">12</span>, <span class="ruby-value">4</span>].<span class="ruby-identifier">gray_decode</span>.<span class="ruby-identifier">to_decimal</span>
+ <span class="ruby-identifier">capture_bonus</span> = <span class="ruby-ivar">@genome</span>[<span class="ruby-value">16</span>, <span class="ruby-value">4</span>].<span class="ruby-identifier">gray_decode</span>.<span class="ruby-identifier">to_decimal</span>
+ <span class="ruby-constant">Potential_player</span>.<span class="ruby-identifier">new</span>({<span class="ruby-identifier">:friend_pull</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">friend_pull</span>,
+ <span class="ruby-identifier">:enemy_pull</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">enemy_pull</span>, <span class="ruby-identifier">:base_pull</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">base_pull</span>,
+ <span class="ruby-identifier">:safe_bonus</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">safe_bonus</span>, <span class="ruby-identifier">:capture_bonus</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">capture_bonus</span>})
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (Genome)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libgenetics.rb, line 17</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">bitstring_or_length</span>)
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">bitstring_or_length</span>.<span class="ruby-identifier">class</span> <span class="ruby-operator">==</span> <span class="ruby-constant">Fixnum</span>
+ <span class="ruby-ivar">@genome</span> = []
+ (<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-identifier">bitstring_or_length</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
+ <span class="ruby-ivar">@genome</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">rand</span>(<span class="ruby-value">2</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-ivar">@genome</span> = <span class="ruby-identifier">bitstring_or_length</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>mutate (Genome)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libgenetics.rb, line 29</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mutate</span>(<span class="ruby-identifier">mutation_probability</span> = <span class="ruby-value">0</span><span class="ruby-value">.05</span>)
+ <span class="ruby-identifier">new_genome</span> = <span class="ruby-constant">Genome</span>.<span class="ruby-identifier">new</span>(<span class="ruby-ivar">@genome</span>.<span class="ruby-identifier">length</span>)
+ (<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-ivar">@genome</span>.<span class="ruby-identifier">length</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rand</span>(<span class="ruby-value">1</span>) <span class="ruby-operator"><</span> <span class="ruby-identifier">mutation_probability</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@genome</span>[<span class="ruby-identifier">i</span>] <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
+ <span class="ruby-identifier">new_genome</span>.<span class="ruby-identifier">genome</span>[<span class="ruby-identifier">i</span>] = <span class="ruby-value">1</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">new_genome</span>.<span class="ruby-identifier">genome</span>[<span class="ruby-identifier">i</span>] = <span class="ruby-value">0</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">new_genome</span>.<span class="ruby-identifier">genome</span>[<span class="ruby-identifier">i</span>] = <span class="ruby-ivar">@genome</span>[<span class="ruby-identifier">i</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">new_genome</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>mutate! (Genome)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libgenetics.rb, line 46</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mutate!</span>(<span class="ruby-identifier">mutation_probability</span> = <span class="ruby-value">0</span><span class="ruby-value">.05</span>)
+ (<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-ivar">@genome</span>.<span class="ruby-identifier">length</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rand</span>(<span class="ruby-value">1</span>) <span class="ruby-operator"><</span> <span class="ruby-identifier">mutation_probability</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@genome</span>[<span class="ruby-identifier">i</span>] <span class="ruby-operator">==</span> <span class="ruby-value">0</span>
+ <span class="ruby-ivar">@genome</span>[<span class="ruby-identifier">i</span>] = <span class="ruby-value">1</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-ivar">@genome</span>[<span class="ruby-identifier">i</span>] = <span class="ruby-value">0</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-ivar">@genome</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>crossover (Genome)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libgenetics.rb, line 60</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">crossover</span>(<span class="ruby-identifier">other_genome</span>, <span class="ruby-identifier">crossover_point</span>)
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"Different size genomes"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@genome</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">other_genome</span>.<span class="ruby-identifier">genome</span>.<span class="ruby-identifier">length</span>
+ <span class="ruby-identifier">raise</span> <span class="ruby-constant">ArgumentError</span>, <span class="ruby-value str">"Our of bounds crossover point"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">crossover_point</span> <span class="ruby-operator"><</span> <span class="ruby-value">0</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">crossover_point</span> <span class="ruby-operator">></span> <span class="ruby-ivar">@genome</span>.<span class="ruby-identifier">length</span>
+ <span class="ruby-identifier">child1</span> = <span class="ruby-constant">Genome</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">0</span>)
+ <span class="ruby-identifier">child2</span> = <span class="ruby-constant">Genome</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">0</span>)
+ <span class="ruby-identifier">child1</span>.<span class="ruby-identifier">genome</span> = <span class="ruby-ivar">@genome</span>[<span class="ruby-value">0</span>, <span class="ruby-identifier">crossover_point</span>] <span class="ruby-operator">+</span> <span class="ruby-identifier">other_genome</span>.<span class="ruby-identifier">genome</span>[<span class="ruby-identifier">crossover_point</span>, <span class="ruby-ivar">@genome</span>.<span class="ruby-identifier">length</span>]
+ <span class="ruby-identifier">child1</span>.<span class="ruby-identifier">genome</span> = <span class="ruby-identifier">other_genome</span>.<span class="ruby-identifier">genome</span>[<span class="ruby-value">0</span>, <span class="ruby-identifier">crossover_point</span>] <span class="ruby-operator">+</span> <span class="ruby-ivar">@genome</span>[<span class="ruby-identifier">crossover_point</span>, <span class="ruby-ivar">@genome</span>.<span class="ruby-identifier">length</span>]
+ [<span class="ruby-identifier">child1</span>, <span class="ruby-identifier">child2</span>]
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_potential_player (Genome)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libpplayer.rb, line 96</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_potential_player</span>
+ <span class="ruby-identifier">friend_pull</span> = <span class="ruby-ivar">@genome</span>[<span class="ruby-value">0</span>, <span class="ruby-value">4</span>].<span class="ruby-identifier">gray_decode</span>.<span class="ruby-identifier">to_decimal</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-operator">/</span> <span class="ruby-value">4</span>
+ <span class="ruby-identifier">enemy_pull</span> = <span class="ruby-ivar">@genome</span>[<span class="ruby-value">4</span>, <span class="ruby-value">4</span>].<span class="ruby-identifier">gray_decode</span>.<span class="ruby-identifier">to_decimal</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-operator">/</span> <span class="ruby-value">4</span>
+ <span class="ruby-identifier">base_pull</span> = <span class="ruby-ivar">@genome</span>[<span class="ruby-value">8</span>, <span class="ruby-value">4</span>].<span class="ruby-identifier">gray_decode</span>.<span class="ruby-identifier">to_decimal</span>.<span class="ruby-identifier">to_f</span> <span class="ruby-operator">/</span> <span class="ruby-value">4</span>
+ <span class="ruby-identifier">safe_bonus</span> = <span class="ruby-ivar">@genome</span>[<span class="ruby-value">12</span>, <span class="ruby-value">4</span>].<span class="ruby-identifier">gray_decode</span>.<span class="ruby-identifier">to_decimal</span>
+ <span class="ruby-identifier">capture_bonus</span> = <span class="ruby-ivar">@genome</span>[<span class="ruby-value">16</span>, <span class="ruby-value">4</span>].<span class="ruby-identifier">gray_decode</span>.<span class="ruby-identifier">to_decimal</span>
+ <span class="ruby-constant">Potential_player</span>.<span class="ruby-identifier">new</span>({<span class="ruby-identifier">:friend_pull</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">friend_pull</span>,
+ <span class="ruby-identifier">:enemy_pull</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">enemy_pull</span>, <span class="ruby-identifier">:base_pull</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">base_pull</span>,
+ <span class="ruby-identifier">:safe_bonus</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">safe_bonus</span>, <span class="ruby-identifier">:capture_bonus</span> =<span class="ruby-operator">></span> <span class="ruby-identifier">capture_bonus</span>})
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Class: IO</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="classHeader">
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Class</strong></td>
+ <td class="class-name-in-header">IO</td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>In:</strong></td>
+ <td>
+ <a href="../files/lib/libttc_rb.html">
+ lib/libttc.rb
+ </a>
+ <br />
+ </td>
+ </tr>
+
+ <tr class="top-aligned-row">
+ <td><strong>Parent:</strong></td>
+ <td>
+ Object
+ </td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <p>
+Read a game description file and convert it into a <a
+href="Game.html">Game</a> object and set of <a href="Move.html">Move</a>
+objects. Note that <a href="Game.html#M000046">Game.read_game</a> method
+returns multiple values, so this one does too.
+</p>
+
+ </div>
+
+
+ </div>
+
+ <div id="method-list">
+ <h3 class="section-bar">Methods</h3>
+
+ <div class="name-list">
+ <a href="#M000031">read_game</a>
+ </div>
+ </div>
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+ <div id="methods">
+ <h3 class="section-bar">Public Class methods</h3>
+
+ <div id="method-M000031" class="method-detail">
+ <a name="M000031"></a>
+
+ <div class="method-heading">
+ <a href="IO.src/M000031.html" target="Code" class="method-signature"
+ onclick="popupCode('IO.src/M000031.html');return false;">
+ <span class="method-name">read_game</span><span class="method-args">(filename)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+K 25
+svn:wc:ra_dav:version-url
+V 57
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/IO.src
+END
+M000031.html
+K 25
+svn:wc:ra_dav:version-url
+V 70
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/IO.src/M000031.html
+END
+M000007.html
+K 25
+svn:wc:ra_dav:version-url
+V 70
+/svn/njae/!svn/ver/24/TrapTheCap/trunk/doc/classes/IO.src/M000007.html
+END
+M000017.html
+K 25
+svn:wc:ra_dav:version-url
+V 70
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/classes/IO.src/M000017.html
+END
--- /dev/null
+8
+
+dir
+68
+http://scripts.njae.me.uk/svn/njae/TrapTheCap/trunk/doc/classes/IO.src
+http://scripts.njae.me.uk/svn/njae
+
+
+
+2008-10-16T14:11:23.436422Z
+41
+neil
+
+
+svn:special svn:externals svn:needs-lock
+
+
+
+
+
+
+
+
+
+
+
+0ada9808-85ab-4924-adda-5bf89eae3818
+\f
+M000031.html
+file
+
+
+
+
+2008-03-28T15:44:41.000000Z
+af2b4fd07ed39eb2d35c653b2a5b7045
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000007.html
+file
+
+
+
+
+2008-03-25T12:43:37.000000Z
+ec9e5266c0301d36db9eb2a68b19175c
+2008-03-28T15:47:09.723420Z
+24
+neil
+\f
+M000017.html
+file
+
+
+
+
+2008-03-25T11:48:00.000000Z
+70d6fea878ec9938ce0a457e5f0b6d8b
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>read_game (IO)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 533</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-constant">IO</span>.<span class="ruby-identifier">read_game</span>(<span class="ruby-identifier">filename</span>)
+ <span class="ruby-identifier">gamelines</span> = <span class="ruby-constant">IO</span>.<span class="ruby-identifier">readlines</span>(<span class="ruby-identifier">filename</span>)
+ <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Game</span>.<span class="ruby-identifier">read_game</span>(<span class="ruby-identifier">gamelines</span>)
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>read_game (IO)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 515</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-constant">IO</span>.<span class="ruby-identifier">read_game</span>(<span class="ruby-identifier">filename</span>)
+ <span class="ruby-identifier">gamelines</span> = <span class="ruby-constant">IO</span>.<span class="ruby-identifier">readlines</span>(<span class="ruby-identifier">filename</span>)
+ <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Game</span>.<span class="ruby-identifier">read_game</span>(<span class="ruby-identifier">gamelines</span>)
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>read_game (IO)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 611</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-constant">IO</span>.<span class="ruby-identifier">read_game</span>(<span class="ruby-identifier">filename</span>)
+ <span class="ruby-identifier">gamelines</span> = <span class="ruby-constant">IO</span>.<span class="ruby-identifier">readlines</span>(<span class="ruby-identifier">filename</span>)
+ <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Game</span>.<span class="ruby-identifier">read_game</span>(<span class="ruby-identifier">gamelines</span>)
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>read_game (IO)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 533</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-constant">IO</span>.<span class="ruby-identifier">read_game</span>(<span class="ruby-identifier">filename</span>)
+ <span class="ruby-identifier">gamelines</span> = <span class="ruby-constant">IO</span>.<span class="ruby-identifier">readlines</span>(<span class="ruby-identifier">filename</span>)
+ <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Game</span>.<span class="ruby-identifier">read_game</span>(<span class="ruby-identifier">gamelines</span>)
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>read_game (IO)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 515</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-constant">IO</span>.<span class="ruby-identifier">read_game</span>(<span class="ruby-identifier">filename</span>)
+ <span class="ruby-identifier">gamelines</span> = <span class="ruby-constant">IO</span>.<span class="ruby-identifier">readlines</span>(<span class="ruby-identifier">filename</span>)
+ <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Game</span>.<span class="ruby-identifier">read_game</span>(<span class="ruby-identifier">gamelines</span>)
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>read_game (IO)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 611</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-constant">IO</span>.<span class="ruby-identifier">read_game</span>(<span class="ruby-identifier">filename</span>)
+ <span class="ruby-identifier">gamelines</span> = <span class="ruby-constant">IO</span>.<span class="ruby-identifier">readlines</span>(<span class="ruby-identifier">filename</span>)
+ <span class="ruby-keyword kw">return</span> <span class="ruby-constant">Game</span>.<span class="ruby-identifier">read_game</span>(<span class="ruby-identifier">gamelines</span>)
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Class: InvalidCaptureError</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="classHeader">
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Class</strong></td>
+ <td class="class-name-in-header">InvalidCaptureError</td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>In:</strong></td>
+ <td>
+ <a href="../files/lib/libttc_rb.html">
+ lib/libttc.rb
+ </a>
+ <br />
+ </td>
+ </tr>
+
+ <tr class="top-aligned-row">
+ <td><strong>Parent:</strong></td>
+ <td>
+ StandardError
+ </td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <p>
+Pieces can only capture pieces that they‘re on.
+</p>
+
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Class: InvalidMoveError</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="classHeader">
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Class</strong></td>
+ <td class="class-name-in-header">InvalidMoveError</td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>In:</strong></td>
+ <td>
+ <a href="../files/lib/libttc_rb.html">
+ lib/libttc.rb
+ </a>
+ <br />
+ </td>
+ </tr>
+
+ <tr class="top-aligned-row">
+ <td><strong>Parent:</strong></td>
+ <td>
+ StandardError
+ </td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <p>
+Moves can only be [1..6] spaces
+</p>
+
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Class: InvalidMoveInHistoryError</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="classHeader">
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Class</strong></td>
+ <td class="class-name-in-header">InvalidMoveInHistoryError</td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>In:</strong></td>
+ <td>
+ <a href="../files/src/ttc_rb.html">
+ src/ttc.rb
+ </a>
+ <br />
+ </td>
+ </tr>
+
+ <tr class="top-aligned-row">
+ <td><strong>Parent:</strong></td>
+ <td>
+ StandardError
+ </td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+
+
+ </div>
+
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Class: InvalidRobotError</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="classHeader">
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Class</strong></td>
+ <td class="class-name-in-header">InvalidRobotError</td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>In:</strong></td>
+ <td>
+ <a href="../files/src/ttc_rb.html">
+ src/ttc.rb
+ </a>
+ <br />
+ </td>
+ </tr>
+
+ <tr class="top-aligned-row">
+ <td><strong>Parent:</strong></td>
+ <td>
+ StandardError
+ </td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+
+
+ </div>
+
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Class: Move</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="classHeader">
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Class</strong></td>
+ <td class="class-name-in-header">Move</td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>In:</strong></td>
+ <td>
+ <a href="../files/lib/libttc_rb.html">
+ lib/libttc.rb
+ </a>
+ <br />
+ </td>
+ </tr>
+
+ <tr class="top-aligned-row">
+ <td><strong>Parent:</strong></td>
+ <td>
+ Object
+ </td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <p>
+A move in a game
+</p>
+
+ </div>
+
+
+ </div>
+
+ <div id="method-list">
+ <h3 class="section-bar">Methods</h3>
+
+ <div class="name-list">
+ <a href="#M000032">new</a>
+ <a href="#M000034">to_s</a>
+ <a href="#M000035">to_str</a>
+ <a href="#M000033">via_base?</a>
+ </div>
+ </div>
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+ <div id="attribute-list">
+ <h3 class="section-bar">Attributes</h3>
+
+ <div class="name-list">
+ <table>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">destination</td>
+ <td class="context-item-value"> [R] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">piece</td>
+ <td class="context-item-value"> [R] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ </table>
+ </div>
+ </div>
+
+
+
+ <!-- if method_list -->
+ <div id="methods">
+ <h3 class="section-bar">Public Class methods</h3>
+
+ <div id="method-M000032" class="method-detail">
+ <a name="M000032"></a>
+
+ <div class="method-heading">
+ <a href="Move.src/M000032.html" target="Code" class="method-signature"
+ onclick="popupCode('Move.src/M000032.html');return false;">
+ <span class="method-name">new</span><span class="method-args">(piece, destination, via_base = false)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <h3 class="section-bar">Public Instance methods</h3>
+
+ <div id="method-M000034" class="method-detail">
+ <a name="M000034"></a>
+
+ <div class="method-heading">
+ <a href="Move.src/M000034.html" target="Code" class="method-signature"
+ onclick="popupCode('Move.src/M000034.html');return false;">
+ <span class="method-name">to_s</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Write a move to a string Note the inverse, <a
+href="String.html#M000053">String#to_move</a>, is defined below
+</p>
+ </div>
+ </div>
+
+ <div id="method-M000035" class="method-detail">
+ <a name="M000035"></a>
+
+ <div class="method-heading">
+ <a href="Move.src/M000035.html" target="Code" class="method-signature"
+ onclick="popupCode('Move.src/M000035.html');return false;">
+ <span class="method-name">to_str</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <div id="method-M000033" class="method-detail">
+ <a name="M000033"></a>
+
+ <div class="method-heading">
+ <a href="Move.src/M000033.html" target="Code" class="method-signature"
+ onclick="popupCode('Move.src/M000033.html');return false;">
+ <span class="method-name">via_base?</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+K 25
+svn:wc:ra_dav:version-url
+V 59
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Move.src
+END
+M000010.html
+K 25
+svn:wc:ra_dav:version-url
+V 72
+/svn/njae/!svn/ver/24/TrapTheCap/trunk/doc/classes/Move.src/M000010.html
+END
+M000020.html
+K 25
+svn:wc:ra_dav:version-url
+V 72
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/classes/Move.src/M000020.html
+END
+M000032.html
+K 25
+svn:wc:ra_dav:version-url
+V 72
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Move.src/M000032.html
+END
+M000033.html
+K 25
+svn:wc:ra_dav:version-url
+V 72
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Move.src/M000033.html
+END
+M000034.html
+K 25
+svn:wc:ra_dav:version-url
+V 72
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Move.src/M000034.html
+END
+M000008.html
+K 25
+svn:wc:ra_dav:version-url
+V 72
+/svn/njae/!svn/ver/24/TrapTheCap/trunk/doc/classes/Move.src/M000008.html
+END
+M000035.html
+K 25
+svn:wc:ra_dav:version-url
+V 72
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Move.src/M000035.html
+END
+M000018.html
+K 25
+svn:wc:ra_dav:version-url
+V 72
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/classes/Move.src/M000018.html
+END
+M000009.html
+K 25
+svn:wc:ra_dav:version-url
+V 72
+/svn/njae/!svn/ver/24/TrapTheCap/trunk/doc/classes/Move.src/M000009.html
+END
+M000019.html
+K 25
+svn:wc:ra_dav:version-url
+V 72
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/classes/Move.src/M000019.html
+END
--- /dev/null
+8
+
+dir
+68
+http://scripts.njae.me.uk/svn/njae/TrapTheCap/trunk/doc/classes/Move.src
+http://scripts.njae.me.uk/svn/njae
+
+
+
+2008-10-16T14:11:23.436422Z
+41
+neil
+
+
+svn:special svn:externals svn:needs-lock
+
+
+
+
+
+
+
+
+
+
+
+0ada9808-85ab-4924-adda-5bf89eae3818
+\f
+M000010.html
+file
+
+
+
+
+2008-03-25T12:43:37.000000Z
+7753cacf5224a23689207a18edccad02
+2008-03-28T15:47:09.723420Z
+24
+neil
+\f
+M000020.html
+file
+
+
+
+
+2008-03-25T11:48:00.000000Z
+f51b24f805dd4e97456643dd6e164193
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+M000032.html
+file
+
+
+
+
+2008-03-28T15:44:41.000000Z
+4c945a4b5bf69dc51e92e83d73b70c52
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000033.html
+file
+
+
+
+
+2008-03-28T15:44:41.000000Z
+7a692bc02ef2fea0bf12b64d4865bc27
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000034.html
+file
+
+
+
+
+2008-03-28T15:44:41.000000Z
+9c83912d256d6eee20c8fe3366d553b8
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000008.html
+file
+
+
+
+
+2008-03-25T12:43:37.000000Z
+162b46fe423c2a23b1bddab449e5376f
+2008-03-28T15:47:09.723420Z
+24
+neil
+\f
+M000035.html
+file
+
+
+
+
+2008-03-28T15:44:41.000000Z
+ac4172fd876ee8b7e3525bef6061b74a
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000018.html
+file
+
+
+
+
+2008-03-25T11:48:00.000000Z
+895659c1944b11e86eee9275873bf451
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+M000009.html
+file
+
+
+
+
+2008-03-25T12:43:37.000000Z
+2446ea3e0e5cb3327148f9856cdce341
+2008-03-28T15:47:09.723420Z
+24
+neil
+\f
+M000019.html
+file
+
+
+
+
+2008-03-25T11:48:00.000000Z
+79aa324191e9a591ccde8698ac38b137
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (Move)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 272</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">piece</span>, <span class="ruby-identifier">destination</span>, <span class="ruby-identifier">via_base</span> = <span class="ruby-keyword kw">false</span>)
+ <span class="ruby-ivar">@piece</span> = <span class="ruby-identifier">piece</span>
+ <span class="ruby-ivar">@destination</span> = <span class="ruby-identifier">destination</span>
+ <span class="ruby-ivar">@via_base</span> = <span class="ruby-identifier">via_base</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>via_base? (Move)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 278</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">via_base?</span>
+ <span class="ruby-ivar">@via_base</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_s (Move)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 284</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@via_base</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@destination</span>.<span class="ruby-identifier">base?</span>
+ <span class="ruby-ivar">@piece</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">" "</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@destination</span>.<span class="ruby-identifier">to_s</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-ivar">@piece</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">" "</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">+</span> <span class="ruby-value str">" "</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@destination</span>.<span class="ruby-identifier">to_s</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-ivar">@piece</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">" "</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@destination</span>.<span class="ruby-identifier">to_s</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (Move)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 261</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">piece</span>, <span class="ruby-identifier">destination</span>, <span class="ruby-identifier">via_base</span> = <span class="ruby-keyword kw">false</span>)
+ <span class="ruby-ivar">@piece</span> = <span class="ruby-identifier">piece</span>
+ <span class="ruby-ivar">@destination</span> = <span class="ruby-identifier">destination</span>
+ <span class="ruby-ivar">@via_base</span> = <span class="ruby-identifier">via_base</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>via_base? (Move)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 267</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">via_base?</span>
+ <span class="ruby-ivar">@via_base</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_s (Move)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 273</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@via_base</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@destination</span>.<span class="ruby-identifier">base?</span>
+ <span class="ruby-ivar">@piece</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">" "</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@destination</span>.<span class="ruby-identifier">to_s</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-ivar">@piece</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">" "</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">+</span> <span class="ruby-value str">" "</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@destination</span>.<span class="ruby-identifier">to_s</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-ivar">@piece</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">" "</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@destination</span>.<span class="ruby-identifier">to_s</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (Move)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 285</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">piece</span>, <span class="ruby-identifier">destination</span>, <span class="ruby-identifier">via_base</span> = <span class="ruby-keyword kw">false</span>)
+ <span class="ruby-ivar">@piece</span> = <span class="ruby-identifier">piece</span>
+ <span class="ruby-ivar">@destination</span> = <span class="ruby-identifier">destination</span>
+ <span class="ruby-ivar">@via_base</span> = <span class="ruby-identifier">via_base</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>via_base? (Move)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 291</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">via_base?</span>
+ <span class="ruby-ivar">@via_base</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_s (Move)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 297</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@via_base</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@destination</span>.<span class="ruby-identifier">base?</span>
+ <span class="ruby-ivar">@piece</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">" "</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@destination</span>.<span class="ruby-identifier">to_s</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-ivar">@piece</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">" "</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">+</span> <span class="ruby-value str">" "</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@destination</span>.<span class="ruby-identifier">to_s</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-ivar">@piece</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">" "</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@destination</span>.<span class="ruby-identifier">to_s</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_str (Move)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 309</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_str</span>
+ <span class="ruby-identifier">to_s</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (Move)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 272</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">piece</span>, <span class="ruby-identifier">destination</span>, <span class="ruby-identifier">via_base</span> = <span class="ruby-keyword kw">false</span>)
+ <span class="ruby-ivar">@piece</span> = <span class="ruby-identifier">piece</span>
+ <span class="ruby-ivar">@destination</span> = <span class="ruby-identifier">destination</span>
+ <span class="ruby-ivar">@via_base</span> = <span class="ruby-identifier">via_base</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>via_base? (Move)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 278</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">via_base?</span>
+ <span class="ruby-ivar">@via_base</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_s (Move)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 284</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@via_base</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@destination</span>.<span class="ruby-identifier">base?</span>
+ <span class="ruby-ivar">@piece</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">" "</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@destination</span>.<span class="ruby-identifier">to_s</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-ivar">@piece</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">" "</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">+</span> <span class="ruby-value str">" "</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@destination</span>.<span class="ruby-identifier">to_s</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-ivar">@piece</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">" "</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@destination</span>.<span class="ruby-identifier">to_s</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (Move)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 261</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">piece</span>, <span class="ruby-identifier">destination</span>, <span class="ruby-identifier">via_base</span> = <span class="ruby-keyword kw">false</span>)
+ <span class="ruby-ivar">@piece</span> = <span class="ruby-identifier">piece</span>
+ <span class="ruby-ivar">@destination</span> = <span class="ruby-identifier">destination</span>
+ <span class="ruby-ivar">@via_base</span> = <span class="ruby-identifier">via_base</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>via_base? (Move)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 267</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">via_base?</span>
+ <span class="ruby-ivar">@via_base</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_s (Move)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 273</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@via_base</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@destination</span>.<span class="ruby-identifier">base?</span>
+ <span class="ruby-ivar">@piece</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">" "</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@destination</span>.<span class="ruby-identifier">to_s</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-ivar">@piece</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">" "</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">+</span> <span class="ruby-value str">" "</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@destination</span>.<span class="ruby-identifier">to_s</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-ivar">@piece</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">" "</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@destination</span>.<span class="ruby-identifier">to_s</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (Move)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 285</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">piece</span>, <span class="ruby-identifier">destination</span>, <span class="ruby-identifier">via_base</span> = <span class="ruby-keyword kw">false</span>)
+ <span class="ruby-ivar">@piece</span> = <span class="ruby-identifier">piece</span>
+ <span class="ruby-ivar">@destination</span> = <span class="ruby-identifier">destination</span>
+ <span class="ruby-ivar">@via_base</span> = <span class="ruby-identifier">via_base</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>via_base? (Move)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 291</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">via_base?</span>
+ <span class="ruby-ivar">@via_base</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_s (Move)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 297</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@via_base</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@destination</span>.<span class="ruby-identifier">base?</span>
+ <span class="ruby-ivar">@piece</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">" "</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@destination</span>.<span class="ruby-identifier">to_s</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-ivar">@piece</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">" "</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">+</span> <span class="ruby-value str">" "</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@destination</span>.<span class="ruby-identifier">to_s</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-ivar">@piece</span>.<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">" "</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@destination</span>.<span class="ruby-identifier">to_s</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_str (Move)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 309</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_str</span>
+ <span class="ruby-identifier">to_s</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Class: NoInputFileError</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="classHeader">
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Class</strong></td>
+ <td class="class-name-in-header">NoInputFileError</td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>In:</strong></td>
+ <td>
+ <a href="../files/src/ttc_rb.html">
+ src/ttc.rb
+ </a>
+ <br />
+ </td>
+ </tr>
+
+ <tr class="top-aligned-row">
+ <td><strong>Parent:</strong></td>
+ <td>
+ StandardError
+ </td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+
+
+ </div>
+
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Class: Piece</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="classHeader">
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Class</strong></td>
+ <td class="class-name-in-header">Piece</td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>In:</strong></td>
+ <td>
+ <a href="../files/lib/libttc_rb.html">
+ lib/libttc.rb
+ </a>
+ <br />
+ </td>
+ </tr>
+
+ <tr class="top-aligned-row">
+ <td><strong>Parent:</strong></td>
+ <td>
+ Object
+ </td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <p>
+Each piece on the board is an object
+</p>
+
+ </div>
+
+
+ </div>
+
+ <div id="method-list">
+ <h3 class="section-bar">Methods</h3>
+
+ <div class="name-list">
+ <a href="#M000052">capture</a>
+ <a href="#M000051">move_to</a>
+ <a href="#M000048">name</a>
+ <a href="#M000047">new</a>
+ <a href="#M000049">to_s</a>
+ <a href="#M000050">to_str</a>
+ </div>
+ </div>
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+ <div id="attribute-list">
+ <h3 class="section-bar">Attributes</h3>
+
+ <div class="name-list">
+ <table>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">captured</td>
+ <td class="context-item-value"> [RW] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">colour</td>
+ <td class="context-item-value"> [R] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">contains</td>
+ <td class="context-item-value"> [RW] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">position</td>
+ <td class="context-item-value"> [RW] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ </table>
+ </div>
+ </div>
+
+
+
+ <!-- if method_list -->
+ <div id="methods">
+ <h3 class="section-bar">Public Class methods</h3>
+
+ <div id="method-M000047" class="method-detail">
+ <a name="M000047"></a>
+
+ <div class="method-heading">
+ <a href="Piece.src/M000047.html" target="Code" class="method-signature"
+ onclick="popupCode('Piece.src/M000047.html');return false;">
+ <span class="method-name">new</span><span class="method-args">(number, position, colour)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <h3 class="section-bar">Public Instance methods</h3>
+
+ <div id="method-M000052" class="method-detail">
+ <a name="M000052"></a>
+
+ <div class="method-heading">
+ <a href="Piece.src/M000052.html" target="Code" class="method-signature"
+ onclick="popupCode('Piece.src/M000052.html');return false;">
+ <span class="method-name">capture</span><span class="method-args">(other_piece)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Caputre another piece
+</p>
+ </div>
+ </div>
+
+ <div id="method-M000051" class="method-detail">
+ <a name="M000051"></a>
+
+ <div class="method-heading">
+ <a href="Piece.src/M000051.html" target="Code" class="method-signature"
+ onclick="popupCode('Piece.src/M000051.html');return false;">
+ <span class="method-name">move_to</span><span class="method-args">(new_position)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <div id="method-M000048" class="method-detail">
+ <a name="M000048"></a>
+
+ <div class="method-heading">
+ <a href="Piece.src/M000048.html" target="Code" class="method-signature"
+ onclick="popupCode('Piece.src/M000048.html');return false;">
+ <span class="method-name">name</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <div id="method-M000049" class="method-detail">
+ <a name="M000049"></a>
+
+ <div class="method-heading">
+ <a href="Piece.src/M000049.html" target="Code" class="method-signature"
+ onclick="popupCode('Piece.src/M000049.html');return false;">
+ <span class="method-name">to_s</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <div id="method-M000050" class="method-detail">
+ <a name="M000050"></a>
+
+ <div class="method-heading">
+ <a href="Piece.src/M000050.html" target="Code" class="method-signature"
+ onclick="popupCode('Piece.src/M000050.html');return false;">
+ <span class="method-name">to_str</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+K 25
+svn:wc:ra_dav:version-url
+V 60
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Piece.src
+END
+M000020.html
+K 25
+svn:wc:ra_dav:version-url
+V 73
+/svn/njae/!svn/ver/24/TrapTheCap/trunk/doc/classes/Piece.src/M000020.html
+END
+M000030.html
+K 25
+svn:wc:ra_dav:version-url
+V 73
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/classes/Piece.src/M000030.html
+END
+M000021.html
+K 25
+svn:wc:ra_dav:version-url
+V 73
+/svn/njae/!svn/ver/24/TrapTheCap/trunk/doc/classes/Piece.src/M000021.html
+END
+M000031.html
+K 25
+svn:wc:ra_dav:version-url
+V 73
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/classes/Piece.src/M000031.html
+END
+M000022.html
+K 25
+svn:wc:ra_dav:version-url
+V 73
+/svn/njae/!svn/ver/24/TrapTheCap/trunk/doc/classes/Piece.src/M000022.html
+END
+M000032.html
+K 25
+svn:wc:ra_dav:version-url
+V 73
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/classes/Piece.src/M000032.html
+END
+M000050.html
+K 25
+svn:wc:ra_dav:version-url
+V 73
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Piece.src/M000050.html
+END
+M000051.html
+K 25
+svn:wc:ra_dav:version-url
+V 73
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Piece.src/M000051.html
+END
+M000052.html
+K 25
+svn:wc:ra_dav:version-url
+V 73
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Piece.src/M000052.html
+END
+M000018.html
+K 25
+svn:wc:ra_dav:version-url
+V 73
+/svn/njae/!svn/ver/24/TrapTheCap/trunk/doc/classes/Piece.src/M000018.html
+END
+M000028.html
+K 25
+svn:wc:ra_dav:version-url
+V 73
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/classes/Piece.src/M000028.html
+END
+M000019.html
+K 25
+svn:wc:ra_dav:version-url
+V 73
+/svn/njae/!svn/ver/24/TrapTheCap/trunk/doc/classes/Piece.src/M000019.html
+END
+M000029.html
+K 25
+svn:wc:ra_dav:version-url
+V 73
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/classes/Piece.src/M000029.html
+END
+M000047.html
+K 25
+svn:wc:ra_dav:version-url
+V 73
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Piece.src/M000047.html
+END
+M000048.html
+K 25
+svn:wc:ra_dav:version-url
+V 73
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Piece.src/M000048.html
+END
+M000049.html
+K 25
+svn:wc:ra_dav:version-url
+V 73
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Piece.src/M000049.html
+END
--- /dev/null
+8
+
+dir
+68
+http://scripts.njae.me.uk/svn/njae/TrapTheCap/trunk/doc/classes/Piece.src
+http://scripts.njae.me.uk/svn/njae
+
+
+
+2008-10-16T14:11:23.436422Z
+41
+neil
+
+
+svn:special svn:externals svn:needs-lock
+
+
+
+
+
+
+
+
+
+
+
+0ada9808-85ab-4924-adda-5bf89eae3818
+\f
+M000020.html
+file
+
+
+
+
+2008-03-25T12:43:37.000000Z
+516609c05816da96ec69d7d4a6751241
+2008-03-28T15:47:09.723420Z
+24
+neil
+\f
+M000030.html
+file
+
+
+
+
+2008-03-25T11:48:00.000000Z
+07e2db4c8070cb086797e7814a39a5de
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+M000021.html
+file
+
+
+
+
+2008-03-25T12:43:37.000000Z
+fc60fa123a6694e491e9fcf762dca74a
+2008-03-28T15:47:09.723420Z
+24
+neil
+\f
+M000031.html
+file
+
+
+
+
+2008-03-25T11:48:00.000000Z
+ed7a8a64462d4848b23e68de6f49a14f
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+M000022.html
+file
+
+
+
+
+2008-03-25T12:43:37.000000Z
+c32da391f0e26064f9623fda8fdc06bb
+2008-03-28T15:47:09.723420Z
+24
+neil
+\f
+M000032.html
+file
+
+
+
+
+2008-03-25T11:48:00.000000Z
+f8de4105bdcf700ae1d93d83e4cfb308
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+M000050.html
+file
+
+
+
+
+2008-03-28T15:44:42.000000Z
+10a504d07cbce5caae25630f82048069
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000051.html
+file
+
+
+
+
+2008-03-28T15:44:42.000000Z
+d876b0d20adfa7b8dee14e9f19910a8f
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000052.html
+file
+
+
+
+
+2008-03-28T15:44:42.000000Z
+5c7c848d7d5eafc6751d590ad1f930d2
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000018.html
+file
+
+
+
+
+2008-03-25T12:43:37.000000Z
+795c5d80b0f48d5bc1229ddab01654cf
+2008-03-28T15:47:09.723420Z
+24
+neil
+\f
+M000028.html
+file
+
+
+
+
+2008-03-25T11:48:00.000000Z
+eb377a89525ee4de2a2ad22164ba947b
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+M000019.html
+file
+
+
+
+
+2008-03-25T12:43:37.000000Z
+3befe68a477b27596ed5712212e46d45
+2008-03-28T15:47:09.723420Z
+24
+neil
+\f
+M000029.html
+file
+
+
+
+
+2008-03-25T11:48:00.000000Z
+dde4d37af603faeba2e7c4c6a0f85292
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+M000047.html
+file
+
+
+
+
+2008-03-28T15:44:42.000000Z
+f76d8ad67b857750ed404694a16605ec
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000048.html
+file
+
+
+
+
+2008-03-28T15:44:42.000000Z
+1d3086ac7edc8b5ab67b54d3a6b08038
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000049.html
+file
+
+
+
+
+2008-03-28T15:44:42.000000Z
+67c51d585206abb03669d0fdc6cc6f53
+2008-10-16T14:11:23.436422Z
+41
+\f
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (Piece)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 231</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">number</span>, <span class="ruby-identifier">position</span>, <span class="ruby-identifier">colour</span>)
+ <span class="ruby-ivar">@number</span> = <span class="ruby-identifier">number</span>
+ <span class="ruby-ivar">@position</span> = <span class="ruby-identifier">position</span>
+ <span class="ruby-ivar">@colour</span> = <span class="ruby-identifier">colour</span>
+ <span class="ruby-ivar">@captured</span> = <span class="ruby-keyword kw">false</span>
+ <span class="ruby-ivar">@contains</span> = []
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>name (Piece)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 239</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">name</span>
+ <span class="ruby-ivar">@colour</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@number</span>.<span class="ruby-identifier">to_s</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_s (Piece)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 243</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">name</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>move_to (Piece)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 247</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">move_to</span>(<span class="ruby-identifier">new_position</span>)
+ <span class="ruby-ivar">@position</span> = <span class="ruby-identifier">new_position</span>
+ <span class="ruby-ivar">@contains</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">move_to</span>(<span class="ruby-identifier">new_position</span>)}
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>capture (Piece)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 253</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">capture</span>(<span class="ruby-identifier">other_piece</span>)
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@position</span> = <span class="ruby-identifier">other_piece</span>.<span class="ruby-identifier">position</span>
+ <span class="ruby-ivar">@contains</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">other_piece</span>
+ <span class="ruby-ivar">@contains</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">other_piece</span>.<span class="ruby-identifier">contains</span>
+ <span class="ruby-identifier">other_piece</span>.<span class="ruby-identifier">contains</span> = []
+ <span class="ruby-identifier">other_piece</span>.<span class="ruby-identifier">captured</span> = <span class="ruby-keyword kw">true</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidCaptureError</span>,
+ <span class="ruby-node">"Piece #{self.name} cannot capture #{other_piece.name}: different locations"</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (Piece)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 221</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">number</span>, <span class="ruby-identifier">position</span>, <span class="ruby-identifier">colour</span>)
+ <span class="ruby-ivar">@number</span> = <span class="ruby-identifier">number</span>
+ <span class="ruby-ivar">@position</span> = <span class="ruby-identifier">position</span>
+ <span class="ruby-ivar">@colour</span> = <span class="ruby-identifier">colour</span>
+ <span class="ruby-ivar">@captured</span> = <span class="ruby-keyword kw">false</span>
+ <span class="ruby-ivar">@contains</span> = []
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>name (Piece)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 229</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">name</span>
+ <span class="ruby-ivar">@colour</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@number</span>.<span class="ruby-identifier">to_s</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_s (Piece)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 233</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">name</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>move_to (Piece)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 237</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">move_to</span>(<span class="ruby-identifier">new_position</span>)
+ <span class="ruby-ivar">@position</span> = <span class="ruby-identifier">new_position</span>
+ <span class="ruby-ivar">@contains</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">move_to</span>(<span class="ruby-identifier">new_position</span>)}
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>capture (Piece)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 243</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">capture</span>(<span class="ruby-identifier">other_piece</span>)
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@position</span> = <span class="ruby-identifier">other_piece</span>.<span class="ruby-identifier">position</span>
+ <span class="ruby-ivar">@contains</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">other_piece</span>
+ <span class="ruby-ivar">@contains</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">other_piece</span>.<span class="ruby-identifier">contains</span>
+ <span class="ruby-identifier">other_piece</span>.<span class="ruby-identifier">contains</span> = []
+ <span class="ruby-identifier">other_piece</span>.<span class="ruby-identifier">captured</span> = <span class="ruby-keyword kw">true</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidCaptureError</span>, <span class="ruby-node">"Piece #{self.name} cannot capture #{other_piece.name}: different locations"</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (Piece)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 240</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">number</span>, <span class="ruby-identifier">position</span>, <span class="ruby-identifier">colour</span>)
+ <span class="ruby-ivar">@number</span> = <span class="ruby-identifier">number</span>
+ <span class="ruby-ivar">@position</span> = <span class="ruby-identifier">position</span>
+ <span class="ruby-ivar">@colour</span> = <span class="ruby-identifier">colour</span>
+ <span class="ruby-ivar">@captured</span> = <span class="ruby-keyword kw">false</span>
+ <span class="ruby-ivar">@contains</span> = []
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>name (Piece)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 248</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">name</span>
+ <span class="ruby-ivar">@colour</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@number</span>.<span class="ruby-identifier">to_s</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_s (Piece)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 252</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">name</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_str (Piece)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 256</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_str</span>
+ <span class="ruby-identifier">to_s</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>move_to (Piece)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 260</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">move_to</span>(<span class="ruby-identifier">new_position</span>)
+ <span class="ruby-ivar">@position</span> = <span class="ruby-identifier">new_position</span>
+ <span class="ruby-ivar">@contains</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">move_to</span>(<span class="ruby-identifier">new_position</span>)}
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>capture (Piece)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 266</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">capture</span>(<span class="ruby-identifier">other_piece</span>)
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@position</span> = <span class="ruby-identifier">other_piece</span>.<span class="ruby-identifier">position</span>
+ <span class="ruby-ivar">@contains</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">other_piece</span>
+ <span class="ruby-ivar">@contains</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">other_piece</span>.<span class="ruby-identifier">contains</span>
+ <span class="ruby-identifier">other_piece</span>.<span class="ruby-identifier">contains</span> = []
+ <span class="ruby-identifier">other_piece</span>.<span class="ruby-identifier">captured</span> = <span class="ruby-keyword kw">true</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidCaptureError</span>,
+ <span class="ruby-node">"Piece #{self.name} cannot capture #{other_piece.name}: different locations"</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (Piece)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 231</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">number</span>, <span class="ruby-identifier">position</span>, <span class="ruby-identifier">colour</span>)
+ <span class="ruby-ivar">@number</span> = <span class="ruby-identifier">number</span>
+ <span class="ruby-ivar">@position</span> = <span class="ruby-identifier">position</span>
+ <span class="ruby-ivar">@colour</span> = <span class="ruby-identifier">colour</span>
+ <span class="ruby-ivar">@captured</span> = <span class="ruby-keyword kw">false</span>
+ <span class="ruby-ivar">@contains</span> = []
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>name (Piece)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 239</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">name</span>
+ <span class="ruby-ivar">@colour</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@number</span>.<span class="ruby-identifier">to_s</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_s (Piece)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 243</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">name</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>move_to (Piece)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 247</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">move_to</span>(<span class="ruby-identifier">new_position</span>)
+ <span class="ruby-ivar">@position</span> = <span class="ruby-identifier">new_position</span>
+ <span class="ruby-ivar">@contains</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">move_to</span>(<span class="ruby-identifier">new_position</span>)}
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>capture (Piece)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 253</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">capture</span>(<span class="ruby-identifier">other_piece</span>)
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@position</span> = <span class="ruby-identifier">other_piece</span>.<span class="ruby-identifier">position</span>
+ <span class="ruby-ivar">@contains</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">other_piece</span>
+ <span class="ruby-ivar">@contains</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">other_piece</span>.<span class="ruby-identifier">contains</span>
+ <span class="ruby-identifier">other_piece</span>.<span class="ruby-identifier">contains</span> = []
+ <span class="ruby-identifier">other_piece</span>.<span class="ruby-identifier">captured</span> = <span class="ruby-keyword kw">true</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidCaptureError</span>,
+ <span class="ruby-node">"Piece #{self.name} cannot capture #{other_piece.name}: different locations"</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (Piece)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 221</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">number</span>, <span class="ruby-identifier">position</span>, <span class="ruby-identifier">colour</span>)
+ <span class="ruby-ivar">@number</span> = <span class="ruby-identifier">number</span>
+ <span class="ruby-ivar">@position</span> = <span class="ruby-identifier">position</span>
+ <span class="ruby-ivar">@colour</span> = <span class="ruby-identifier">colour</span>
+ <span class="ruby-ivar">@captured</span> = <span class="ruby-keyword kw">false</span>
+ <span class="ruby-ivar">@contains</span> = []
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>name (Piece)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 229</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">name</span>
+ <span class="ruby-ivar">@colour</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@number</span>.<span class="ruby-identifier">to_s</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_s (Piece)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 233</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">name</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>move_to (Piece)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 237</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">move_to</span>(<span class="ruby-identifier">new_position</span>)
+ <span class="ruby-ivar">@position</span> = <span class="ruby-identifier">new_position</span>
+ <span class="ruby-ivar">@contains</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">move_to</span>(<span class="ruby-identifier">new_position</span>)}
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>capture (Piece)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 243</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">capture</span>(<span class="ruby-identifier">other_piece</span>)
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@position</span> = <span class="ruby-identifier">other_piece</span>.<span class="ruby-identifier">position</span>
+ <span class="ruby-ivar">@contains</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">other_piece</span>
+ <span class="ruby-ivar">@contains</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">other_piece</span>.<span class="ruby-identifier">contains</span>
+ <span class="ruby-identifier">other_piece</span>.<span class="ruby-identifier">contains</span> = []
+ <span class="ruby-identifier">other_piece</span>.<span class="ruby-identifier">captured</span> = <span class="ruby-keyword kw">true</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidCaptureError</span>, <span class="ruby-node">"Piece #{self.name} cannot capture #{other_piece.name}: different locations"</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (Piece)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 240</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">number</span>, <span class="ruby-identifier">position</span>, <span class="ruby-identifier">colour</span>)
+ <span class="ruby-ivar">@number</span> = <span class="ruby-identifier">number</span>
+ <span class="ruby-ivar">@position</span> = <span class="ruby-identifier">position</span>
+ <span class="ruby-ivar">@colour</span> = <span class="ruby-identifier">colour</span>
+ <span class="ruby-ivar">@captured</span> = <span class="ruby-keyword kw">false</span>
+ <span class="ruby-ivar">@contains</span> = []
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>name (Piece)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 248</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">name</span>
+ <span class="ruby-ivar">@colour</span> <span class="ruby-operator">+</span> <span class="ruby-ivar">@number</span>.<span class="ruby-identifier">to_s</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_s (Piece)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 252</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">name</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_str (Piece)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 256</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_str</span>
+ <span class="ruby-identifier">to_s</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>move_to (Piece)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 260</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">move_to</span>(<span class="ruby-identifier">new_position</span>)
+ <span class="ruby-ivar">@position</span> = <span class="ruby-identifier">new_position</span>
+ <span class="ruby-ivar">@contains</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">c</span><span class="ruby-operator">|</span> <span class="ruby-identifier">c</span>.<span class="ruby-identifier">move_to</span>(<span class="ruby-identifier">new_position</span>)}
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>capture (Piece)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 266</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">capture</span>(<span class="ruby-identifier">other_piece</span>)
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@position</span> = <span class="ruby-identifier">other_piece</span>.<span class="ruby-identifier">position</span>
+ <span class="ruby-ivar">@contains</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">other_piece</span>
+ <span class="ruby-ivar">@contains</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">other_piece</span>.<span class="ruby-identifier">contains</span>
+ <span class="ruby-identifier">other_piece</span>.<span class="ruby-identifier">contains</span> = []
+ <span class="ruby-identifier">other_piece</span>.<span class="ruby-identifier">captured</span> = <span class="ruby-keyword kw">true</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidCaptureError</span>,
+ <span class="ruby-node">"Piece #{self.name} cannot capture #{other_piece.name}: different locations"</span>)
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Class: Population</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="classHeader">
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Class</strong></td>
+ <td class="class-name-in-header">Population</td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>In:</strong></td>
+ <td>
+ <a href="../files/src/selection_rb.html">
+ src/selection.rb
+ </a>
+ <br />
+ <a href="../files/lib/libgenetics_rb.html">
+ lib/libgenetics.rb
+ </a>
+ <br />
+ </td>
+ </tr>
+
+ <tr class="top-aligned-row">
+ <td><strong>Parent:</strong></td>
+ <td>
+ Object
+ </td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <p>
+A population of genomes
+</p>
+
+ </div>
+
+
+ </div>
+
+ <div id="method-list">
+ <h3 class="section-bar">Methods</h3>
+
+ <div class="name-list">
+ <a href="#M000019">crossover</a>
+ <a href="#M000021">make_next_generation</a>
+ <a href="#M000020">mutation</a>
+ <a href="#M000018">new</a>
+ <a href="#M000016">tournament_select_one</a>
+ <a href="#M000017">tournament_select_population</a>
+ </div>
+ </div>
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+ <div id="attribute-list">
+ <h3 class="section-bar">Attributes</h3>
+
+ <div class="name-list">
+ <table>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">individuals</td>
+ <td class="context-item-value"> [RW] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ </table>
+ </div>
+ </div>
+
+
+
+ <!-- if method_list -->
+ <div id="methods">
+ <h3 class="section-bar">Public Class methods</h3>
+
+ <div id="method-M000018" class="method-detail">
+ <a name="M000018"></a>
+
+ <div class="method-heading">
+ <a href="Population.src/M000018.html" target="Code" class="method-signature"
+ onclick="popupCode('Population.src/M000018.html');return false;">
+ <span class="method-name">new</span><span class="method-args">(population_size, genome_length)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Create a population of a given size
+</p>
+ </div>
+ </div>
+
+ <h3 class="section-bar">Public Instance methods</h3>
+
+ <div id="method-M000019" class="method-detail">
+ <a name="M000019"></a>
+
+ <div class="method-heading">
+ <a href="Population.src/M000019.html" target="Code" class="method-signature"
+ onclick="popupCode('Population.src/M000019.html');return false;">
+ <span class="method-name">crossover</span><span class="method-args">(crossover_rate)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Perform the <a href="Population.html#M000019">crossover</a> step in a
+population, giving a <a href="Population.html#M000018">new</a> population
+</p>
+ </div>
+ </div>
+
+ <div id="method-M000021" class="method-detail">
+ <a name="M000021"></a>
+
+ <div class="method-heading">
+ <a href="Population.src/M000021.html" target="Code" class="method-signature"
+ onclick="popupCode('Population.src/M000021.html');return false;">
+ <span class="method-name">make_next_generation</span><span class="method-args">(tournament_winner_success_rate = 0.8, game_length = 1000, crossover_rate = 0.7, mutation_rate = 0.05)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <div id="method-M000020" class="method-detail">
+ <a name="M000020"></a>
+
+ <div class="method-heading">
+ <a href="Population.src/M000020.html" target="Code" class="method-signature"
+ onclick="popupCode('Population.src/M000020.html');return false;">
+ <span class="method-name">mutation</span><span class="method-args">(mutation_rate)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Perform the <a href="Population.html#M000020">mutation</a> step in a
+population, giving a <a href="Population.html#M000018">new</a> population
+</p>
+ </div>
+ </div>
+
+ <div id="method-M000016" class="method-detail">
+ <a name="M000016"></a>
+
+ <div class="method-heading">
+ <a href="Population.src/M000016.html" target="Code" class="method-signature"
+ onclick="popupCode('Population.src/M000016.html');return false;">
+ <span class="method-name">tournament_select_one</span><span class="method-args">(winner_success_chance = 0.8, max_game_length= 1000, verbose = false)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Use tournament selection to pick an individual for the next generation
+</p>
+ </div>
+ </div>
+
+ <div id="method-M000017" class="method-detail">
+ <a name="M000017"></a>
+
+ <div class="method-heading">
+ <a href="Population.src/M000017.html" target="Code" class="method-signature"
+ onclick="popupCode('Population.src/M000017.html');return false;">
+ <span class="method-name">tournament_select_population</span><span class="method-args">(winner_success_chance = 0.8, max_game_length = 1000, verbose = false)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Select a <a href="Population.html#M000018">new</a> population the same size
+as the current population
+</p>
+ </div>
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+K 25
+svn:wc:ra_dav:version-url
+V 65
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Population.src
+END
+M000010.html
+K 25
+svn:wc:ra_dav:version-url
+V 78
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Population.src/M000010.html
+END
+M000011.html
+K 25
+svn:wc:ra_dav:version-url
+V 78
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Population.src/M000011.html
+END
+M000020.html
+K 25
+svn:wc:ra_dav:version-url
+V 78
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Population.src/M000020.html
+END
+M000021.html
+K 25
+svn:wc:ra_dav:version-url
+V 78
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Population.src/M000021.html
+END
+M000030.html
+K 25
+svn:wc:ra_dav:version-url
+V 78
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Population.src/M000030.html
+END
+M000016.html
+K 25
+svn:wc:ra_dav:version-url
+V 78
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Population.src/M000016.html
+END
+M000008.html
+K 25
+svn:wc:ra_dav:version-url
+V 78
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Population.src/M000008.html
+END
+M000017.html
+K 25
+svn:wc:ra_dav:version-url
+V 78
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Population.src/M000017.html
+END
+M000009.html
+K 25
+svn:wc:ra_dav:version-url
+V 78
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Population.src/M000009.html
+END
+M000018.html
+K 25
+svn:wc:ra_dav:version-url
+V 78
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Population.src/M000018.html
+END
+M000019.html
+K 25
+svn:wc:ra_dav:version-url
+V 78
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Population.src/M000019.html
+END
+M000028.html
+K 25
+svn:wc:ra_dav:version-url
+V 78
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Population.src/M000028.html
+END
+M000029.html
+K 25
+svn:wc:ra_dav:version-url
+V 78
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Population.src/M000029.html
+END
--- /dev/null
+8
+
+dir
+68
+http://scripts.njae.me.uk/svn/njae/TrapTheCap/trunk/doc/classes/Population.src
+http://scripts.njae.me.uk/svn/njae
+
+
+
+2008-10-16T14:11:23.436422Z
+41
+
+
+
+svn:special svn:externals svn:needs-lock
+\f
+M000010.html
+file
+
+
+
+
+2008-04-23T19:30:16.000000Z
+019ab7a1fdbfa21cb1d1e099e30e83d4
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000011.html
+file
+
+
+
+
+2008-04-23T19:30:16.000000Z
+d9375cd19cc9e4eed9923490a93bbee9
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000020.html
+file
+
+
+
+
+2008-04-23T19:33:07.000000Z
+ff58dc326311308b5be2933597839fd8
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000030.html
+file
+
+
+
+
+2008-03-28T15:44:41.000000Z
+7930819389ab638d7f116d48ed2481e0
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000021.html
+file
+
+
+
+
+2008-04-23T19:33:07.000000Z
+c57461174cee0d995caea75051c072fa
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000016.html
+file
+
+
+
+
+2008-04-23T19:33:07.000000Z
+a12e0b906737bae7d960c30635dd3a24
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000008.html
+file
+
+
+
+
+2008-04-23T19:30:16.000000Z
+f1a767bb69dc09826e84d4e10eb9cdc3
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000017.html
+file
+
+
+
+
+2008-04-23T19:33:07.000000Z
+2ec7de1679e94df72526d8d00dc15432
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000009.html
+file
+
+
+
+
+2008-04-23T19:30:16.000000Z
+b733591471885caa25a5593fcd0c484c
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000018.html
+file
+
+
+
+
+2008-04-23T19:33:07.000000Z
+76f8efaf5681eb58cf9ad1cbfadbcc69
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000019.html
+file
+
+
+
+
+2008-04-23T19:33:07.000000Z
+511f9a56e18cfa02eb03dde24adb02bb
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000028.html
+file
+
+
+
+
+2008-03-28T15:44:41.000000Z
+19cdb4b6accab6582bc702063a246e43
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000029.html
+file
+
+
+
+
+2008-03-28T15:44:41.000000Z
+bfa85d17b971e9eb4af3079b68ec6e7c
+2008-10-16T14:11:23.436422Z
+41
+\f
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (Population)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libgenetics.rb, line 132</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">population_size</span>, <span class="ruby-identifier">genome_length</span>)
+ <span class="ruby-ivar">@individuals</span> = []
+ <span class="ruby-value">1</span>.<span class="ruby-identifier">upto</span>(<span class="ruby-identifier">population_size</span>) { <span class="ruby-ivar">@individuals</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Genome</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">genome_length</span>) }
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>crossover (Population)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libgenetics.rb, line 138</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">crossover</span>(<span class="ruby-identifier">crossover_rate</span>)
+ <span class="ruby-identifier">parents</span> = <span class="ruby-ivar">@individuals</span>.<span class="ruby-identifier">dup</span> <span class="ruby-comment cmt"># genomes that haven't been parents yet</span>
+ <span class="ruby-identifier">next_population</span> = <span class="ruby-constant">Population</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">0</span>)
+ <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">parents</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">1</span>
+ <span class="ruby-identifier">parent1</span> = <span class="ruby-identifier">parents</span>.<span class="ruby-identifier">delete_at</span>(<span class="ruby-identifier">rand</span>(<span class="ruby-identifier">parents</span>.<span class="ruby-identifier">length</span>))
+ <span class="ruby-identifier">parent2</span> = <span class="ruby-identifier">parents</span>.<span class="ruby-identifier">delete_at</span>(<span class="ruby-identifier">rand</span>(<span class="ruby-identifier">parents</span>.<span class="ruby-identifier">length</span>))
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rand</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">crossover_rate</span>
+ <span class="ruby-identifier">child1</span>, <span class="ruby-identifier">child2</span> = <span class="ruby-identifier">parent1</span>.<span class="ruby-identifier">crossover</span> <span class="ruby-identifier">parent2</span>, <span class="ruby-identifier">rand</span>(<span class="ruby-identifier">parent1</span>.<span class="ruby-identifier">genome</span>.<span class="ruby-identifier">length</span>)
+ <span class="ruby-identifier">next_population</span>.<span class="ruby-identifier">individuals</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">child1</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">child2</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">next_population</span>.<span class="ruby-identifier">individuals</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">parent1</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">parent2</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">next_population</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">parents</span> <span class="ruby-comment cmt"># pick up any parents that didn't get a chance to mate</span>
+ <span class="ruby-identifier">next_population</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>mutation (Population)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libgenetics.rb, line 156</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mutation</span>(<span class="ruby-identifier">mutation_rate</span>)
+ <span class="ruby-identifier">parents</span> = <span class="ruby-ivar">@individuals</span>.<span class="ruby-identifier">dup</span> <span class="ruby-comment cmt"># genomes that haven't been parents yet</span>
+ <span class="ruby-identifier">next_population</span> = <span class="ruby-constant">Population</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">0</span>)
+ <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">parents</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
+ <span class="ruby-identifier">parent</span> = <span class="ruby-identifier">parents</span>.<span class="ruby-identifier">pop</span>
+ <span class="ruby-identifier">child</span> = <span class="ruby-identifier">parent</span>.<span class="ruby-identifier">mutate</span> <span class="ruby-identifier">mutation_rate</span>
+ <span class="ruby-identifier">next_population</span>.<span class="ruby-identifier">individuals</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">child</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">next_population</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>make_next_generation (Population)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libgenetics.rb, line 167</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">make_next_generation</span>(<span class="ruby-identifier">tournament_winner_success_rate</span> = <span class="ruby-value">0</span><span class="ruby-value">.8</span>, <span class="ruby-identifier">game_length</span> = <span class="ruby-value">1000</span>, <span class="ruby-identifier">crossover_rate</span> = <span class="ruby-value">0</span><span class="ruby-value">.7</span>, <span class="ruby-identifier">mutation_rate</span> = <span class="ruby-value">0</span><span class="ruby-value">.05</span>)
+ <span class="ruby-ivar">@individuals</span> = <span class="ruby-identifier">tournament_select_population</span>(<span class="ruby-identifier">tournament_winner_success_rate</span>, <span class="ruby-identifier">game_length</span>, <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-ivar">@individuals</span> = <span class="ruby-identifier">crossover</span>(<span class="ruby-identifier">crossover_rate</span>)
+ <span class="ruby-ivar">@individuals</span> = <span class="ruby-identifier">mutation</span>(<span class="ruby-identifier">mutation_rate</span>)
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>tournament_select_one (Population)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File src/selection.rb, line 19</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">tournament_select_one</span>(<span class="ruby-identifier">winner_success_chance</span> = <span class="ruby-value">0</span><span class="ruby-value">.8</span>, <span class="ruby-identifier">max_game_length</span>= <span class="ruby-value">1000</span>, <span class="ruby-identifier">verbose</span> = <span class="ruby-keyword kw">false</span>)
+ <span class="ruby-identifier">player_count</span> = <span class="ruby-identifier">rand</span>(<span class="ruby-value">5</span>) <span class="ruby-operator">+</span> <span class="ruby-value">2</span>
+ <span class="ruby-identifier">pool_size</span> = <span class="ruby-ivar">@individuals</span>.<span class="ruby-identifier">length</span>
+ <span class="ruby-identifier">players</span> = []
+ <span class="ruby-value">1</span>.<span class="ruby-identifier">upto</span>(<span class="ruby-identifier">player_count</span>) { <span class="ruby-identifier">players</span> <span class="ruby-operator"><<</span> <span class="ruby-ivar">@individuals</span>[<span class="ruby-identifier">rand</span>(<span class="ruby-identifier">pool_size</span>)].<span class="ruby-identifier">to_potential_player</span> }
+ <span class="ruby-identifier">game</span> = <span class="ruby-constant">GameHandler</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">players</span>, <span class="ruby-identifier">max_game_length</span>, <span class="ruby-keyword kw">false</span>, <span class="ruby-keyword kw">false</span>)
+ <span class="ruby-identifier">winner</span>, <span class="ruby-identifier">length</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">play</span>
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">"Winner = #{winner} in #{length} moves. Game had #{player_count} players"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">verbose</span>
+ <span class="ruby-comment cmt"># If the game was a draw, or the winner is unlucky, pick a parent at random</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">winner</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:draw</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">rand</span> <span class="ruby-operator">></span> <span class="ruby-identifier">winner_success_chance</span>
+ <span class="ruby-identifier">successful_player</span> = <span class="ruby-identifier">players</span>[<span class="ruby-identifier">rand</span>(<span class="ruby-identifier">player_count</span>)]
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">successful_player</span> = <span class="ruby-identifier">winner</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">successful_player</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>tournament_select_population (Population)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File src/selection.rb, line 37</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">tournament_select_population</span>(<span class="ruby-identifier">winner_success_chance</span> = <span class="ruby-value">0</span><span class="ruby-value">.8</span>, <span class="ruby-identifier">max_game_length</span> = <span class="ruby-value">1000</span>, <span class="ruby-identifier">verbose</span> = <span class="ruby-keyword kw">false</span>)
+ <span class="ruby-identifier">new_population</span> = []
+ <span class="ruby-value">1</span>.<span class="ruby-identifier">upto</span>(<span class="ruby-ivar">@individuals</span>.<span class="ruby-identifier">length</span>) <span class="ruby-keyword kw">do</span>
+ <span class="ruby-identifier">new_population</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">tournament_select_one</span>(<span class="ruby-identifier">winner_success_chance</span>, <span class="ruby-identifier">max_game_length</span>, <span class="ruby-identifier">verbose</span>).<span class="ruby-identifier">to_genome</span>
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">"Created #{new_population.length} indivduals"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">verbose</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">new_population</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (Population)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libgenetics.rb, line 135</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">population_size</span>, <span class="ruby-identifier">genome_length</span>)
+ <span class="ruby-ivar">@individuals</span> = []
+ <span class="ruby-value">1</span>.<span class="ruby-identifier">upto</span>(<span class="ruby-identifier">population_size</span>) { <span class="ruby-ivar">@individuals</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Genome</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">genome_length</span>) }
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>crossover (Population)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libgenetics.rb, line 141</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">crossover</span>(<span class="ruby-identifier">crossover_rate</span>)
+ <span class="ruby-identifier">parents</span> = <span class="ruby-ivar">@individuals</span>.<span class="ruby-identifier">dup</span> <span class="ruby-comment cmt"># genomes that haven't been parents yet</span>
+ <span class="ruby-identifier">next_population</span> = <span class="ruby-constant">Population</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">0</span>)
+ <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">parents</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">1</span>
+ <span class="ruby-identifier">parent1</span> = <span class="ruby-identifier">parents</span>.<span class="ruby-identifier">delete_at</span>(<span class="ruby-identifier">rand</span>(<span class="ruby-identifier">parents</span>.<span class="ruby-identifier">length</span>))
+ <span class="ruby-identifier">parent2</span> = <span class="ruby-identifier">parents</span>.<span class="ruby-identifier">delete_at</span>(<span class="ruby-identifier">rand</span>(<span class="ruby-identifier">parents</span>.<span class="ruby-identifier">length</span>))
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rand</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">crossover_rate</span>
+ <span class="ruby-identifier">child1</span>, <span class="ruby-identifier">child2</span> = <span class="ruby-identifier">parent1</span>.<span class="ruby-identifier">crossover</span> <span class="ruby-identifier">parent2</span>, <span class="ruby-identifier">rand</span>(<span class="ruby-identifier">parent1</span>.<span class="ruby-identifier">genome</span>.<span class="ruby-identifier">length</span>)
+ <span class="ruby-identifier">next_population</span>.<span class="ruby-identifier">individuals</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">child1</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">child2</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">next_population</span>.<span class="ruby-identifier">individuals</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">parent1</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">parent2</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">next_population</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">parents</span> <span class="ruby-comment cmt"># pick up any parents that didn't get a chance to mate</span>
+ <span class="ruby-identifier">next_population</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>mutation (Population)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libgenetics.rb, line 159</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mutation</span>(<span class="ruby-identifier">mutation_rate</span>)
+ <span class="ruby-identifier">parents</span> = <span class="ruby-ivar">@individuals</span>.<span class="ruby-identifier">dup</span> <span class="ruby-comment cmt"># genomes that haven't been parents yet</span>
+ <span class="ruby-identifier">next_population</span> = <span class="ruby-constant">Population</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">0</span>)
+ <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">parents</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
+ <span class="ruby-identifier">parent</span> = <span class="ruby-identifier">parents</span>.<span class="ruby-identifier">pop</span>
+ <span class="ruby-identifier">child</span> = <span class="ruby-identifier">parent</span>.<span class="ruby-identifier">mutate</span> <span class="ruby-identifier">mutation_rate</span>
+ <span class="ruby-identifier">next_population</span>.<span class="ruby-identifier">individuals</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">child</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">next_population</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>make_next_generation (Population)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libgenetics.rb, line 170</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">make_next_generation</span>(<span class="ruby-identifier">tournament_winner_success_rate</span> = <span class="ruby-value">0</span><span class="ruby-value">.8</span>, <span class="ruby-identifier">game_length</span> = <span class="ruby-value">1000</span>, <span class="ruby-identifier">crossover_rate</span> = <span class="ruby-value">0</span><span class="ruby-value">.7</span>, <span class="ruby-identifier">mutation_rate</span> = <span class="ruby-value">0</span><span class="ruby-value">.05</span>)
+ <span class="ruby-ivar">@individuals</span> = <span class="ruby-identifier">tournament_select_population</span>(<span class="ruby-identifier">tournament_winner_success_rate</span>, <span class="ruby-identifier">game_length</span>, <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-ivar">@individuals</span> = <span class="ruby-identifier">crossover</span>(<span class="ruby-identifier">crossover_rate</span>)
+ <span class="ruby-ivar">@individuals</span> = <span class="ruby-identifier">mutation</span>(<span class="ruby-identifier">mutation_rate</span>)
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (Population)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libgenetics.rb, line 71</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">population_size</span>, <span class="ruby-identifier">genome_length</span>)
+ <span class="ruby-ivar">@individuals</span> = []
+ <span class="ruby-value">1</span>.<span class="ruby-identifier">upto</span>(<span class="ruby-identifier">population_size</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@individuals</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Genome</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">genome_length</span>) }
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>crossover (Population)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libgenetics.rb, line 77</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">crossover</span>(<span class="ruby-identifier">crossover_rate</span>)
+ <span class="ruby-identifier">parents</span> = <span class="ruby-ivar">@individuals</span>.<span class="ruby-identifier">dup</span> <span class="ruby-comment cmt"># genomes that haven't been parents yet</span>
+ <span class="ruby-identifier">next_population</span> = <span class="ruby-constant">Population</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">0</span>)
+ <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">parents</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">1</span>
+ <span class="ruby-identifier">parent1</span> = <span class="ruby-identifier">parents</span>.<span class="ruby-identifier">delete_at</span>(<span class="ruby-identifier">rand</span>(<span class="ruby-identifier">parents</span>.<span class="ruby-identifier">length</span>))
+ <span class="ruby-identifier">parent2</span> = <span class="ruby-identifier">parents</span>.<span class="ruby-identifier">delete_at</span>(<span class="ruby-identifier">rand</span>(<span class="ruby-identifier">parents</span>.<span class="ruby-identifier">length</span>))
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rand</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">crossover_rate</span>
+ <span class="ruby-identifier">child1</span>, <span class="ruby-identifier">child2</span> = <span class="ruby-identifier">parent1</span>.<span class="ruby-identifier">crossover</span> <span class="ruby-identifier">parent2</span>, <span class="ruby-identifier">rand</span>(<span class="ruby-identifier">parent1</span>.<span class="ruby-identifier">genome</span>.<span class="ruby-identifier">length</span>)
+ <span class="ruby-identifier">next_population</span>.<span class="ruby-identifier">individuals</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">child1</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">child2</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">next_population</span>.<span class="ruby-identifier">individuals</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">parent1</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">parent2</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">next_population</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">parents</span> <span class="ruby-comment cmt"># pick up any parents that didn't get a chance to mate</span>
+ <span class="ruby-identifier">next_population</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>mutation (Population)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libgenetics.rb, line 95</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mutation</span>(<span class="ruby-identifier">mutation_rate</span>)
+ <span class="ruby-identifier">parents</span> = <span class="ruby-ivar">@individuals</span>.<span class="ruby-identifier">dup</span> <span class="ruby-comment cmt"># genomes that haven't been parents yet</span>
+ <span class="ruby-identifier">next_population</span> = <span class="ruby-constant">Population</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">0</span>)
+ <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">parents</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
+ <span class="ruby-identifier">parent</span> = <span class="ruby-identifier">parents</span>.<span class="ruby-identifier">pop</span>
+ <span class="ruby-identifier">child</span> = <span class="ruby-identifier">parent</span>.<span class="ruby-identifier">mutate</span> <span class="ruby-identifier">mutation_rate</span>
+ <span class="ruby-identifier">next_population</span>.<span class="ruby-identifier">individuals</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">child</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">next_population</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (Population)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libgenetics.rb, line 132</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">population_size</span>, <span class="ruby-identifier">genome_length</span>)
+ <span class="ruby-ivar">@individuals</span> = []
+ <span class="ruby-value">1</span>.<span class="ruby-identifier">upto</span>(<span class="ruby-identifier">population_size</span>) { <span class="ruby-ivar">@individuals</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Genome</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">genome_length</span>) }
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>crossover (Population)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libgenetics.rb, line 138</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">crossover</span>(<span class="ruby-identifier">crossover_rate</span>)
+ <span class="ruby-identifier">parents</span> = <span class="ruby-ivar">@individuals</span>.<span class="ruby-identifier">dup</span> <span class="ruby-comment cmt"># genomes that haven't been parents yet</span>
+ <span class="ruby-identifier">next_population</span> = <span class="ruby-constant">Population</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">0</span>)
+ <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">parents</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">1</span>
+ <span class="ruby-identifier">parent1</span> = <span class="ruby-identifier">parents</span>.<span class="ruby-identifier">delete_at</span>(<span class="ruby-identifier">rand</span>(<span class="ruby-identifier">parents</span>.<span class="ruby-identifier">length</span>))
+ <span class="ruby-identifier">parent2</span> = <span class="ruby-identifier">parents</span>.<span class="ruby-identifier">delete_at</span>(<span class="ruby-identifier">rand</span>(<span class="ruby-identifier">parents</span>.<span class="ruby-identifier">length</span>))
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rand</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">crossover_rate</span>
+ <span class="ruby-identifier">child1</span>, <span class="ruby-identifier">child2</span> = <span class="ruby-identifier">parent1</span>.<span class="ruby-identifier">crossover</span> <span class="ruby-identifier">parent2</span>, <span class="ruby-identifier">rand</span>(<span class="ruby-identifier">parent1</span>.<span class="ruby-identifier">genome</span>.<span class="ruby-identifier">length</span>)
+ <span class="ruby-identifier">next_population</span>.<span class="ruby-identifier">individuals</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">child1</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">child2</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">next_population</span>.<span class="ruby-identifier">individuals</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">parent1</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">parent2</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">next_population</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">parents</span> <span class="ruby-comment cmt"># pick up any parents that didn't get a chance to mate</span>
+ <span class="ruby-identifier">next_population</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>mutation (Population)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libgenetics.rb, line 156</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mutation</span>(<span class="ruby-identifier">mutation_rate</span>)
+ <span class="ruby-identifier">parents</span> = <span class="ruby-ivar">@individuals</span>.<span class="ruby-identifier">dup</span> <span class="ruby-comment cmt"># genomes that haven't been parents yet</span>
+ <span class="ruby-identifier">next_population</span> = <span class="ruby-constant">Population</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">0</span>)
+ <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">parents</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
+ <span class="ruby-identifier">parent</span> = <span class="ruby-identifier">parents</span>.<span class="ruby-identifier">pop</span>
+ <span class="ruby-identifier">child</span> = <span class="ruby-identifier">parent</span>.<span class="ruby-identifier">mutate</span> <span class="ruby-identifier">mutation_rate</span>
+ <span class="ruby-identifier">next_population</span>.<span class="ruby-identifier">individuals</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">child</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">next_population</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>make_next_generation (Population)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libgenetics.rb, line 167</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">make_next_generation</span>(<span class="ruby-identifier">tournament_winner_success_rate</span> = <span class="ruby-value">0</span><span class="ruby-value">.8</span>, <span class="ruby-identifier">game_length</span> = <span class="ruby-value">1000</span>, <span class="ruby-identifier">crossover_rate</span> = <span class="ruby-value">0</span><span class="ruby-value">.7</span>, <span class="ruby-identifier">mutation_rate</span> = <span class="ruby-value">0</span><span class="ruby-value">.05</span>)
+ <span class="ruby-ivar">@individuals</span> = <span class="ruby-identifier">tournament_select_population</span>(<span class="ruby-identifier">tournament_winner_success_rate</span>, <span class="ruby-identifier">game_length</span>, <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-ivar">@individuals</span> = <span class="ruby-identifier">crossover</span>(<span class="ruby-identifier">crossover_rate</span>)
+ <span class="ruby-ivar">@individuals</span> = <span class="ruby-identifier">mutation</span>(<span class="ruby-identifier">mutation_rate</span>)
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>tournament_select_one (Population)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File src/selection.rb, line 19</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">tournament_select_one</span>(<span class="ruby-identifier">winner_success_chance</span> = <span class="ruby-value">0</span><span class="ruby-value">.8</span>, <span class="ruby-identifier">max_game_length</span>= <span class="ruby-value">1000</span>, <span class="ruby-identifier">verbose</span> = <span class="ruby-keyword kw">false</span>)
+ <span class="ruby-identifier">player_count</span> = <span class="ruby-identifier">rand</span>(<span class="ruby-value">5</span>) <span class="ruby-operator">+</span> <span class="ruby-value">2</span>
+ <span class="ruby-identifier">pool_size</span> = <span class="ruby-ivar">@individuals</span>.<span class="ruby-identifier">length</span>
+ <span class="ruby-identifier">players</span> = []
+ <span class="ruby-value">1</span>.<span class="ruby-identifier">upto</span>(<span class="ruby-identifier">player_count</span>) { <span class="ruby-identifier">players</span> <span class="ruby-operator"><<</span> <span class="ruby-ivar">@individuals</span>[<span class="ruby-identifier">rand</span>(<span class="ruby-identifier">pool_size</span>)].<span class="ruby-identifier">to_potential_player</span> }
+ <span class="ruby-identifier">game</span> = <span class="ruby-constant">GameHandler</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">players</span>, <span class="ruby-identifier">max_game_length</span>, <span class="ruby-keyword kw">false</span>, <span class="ruby-keyword kw">false</span>)
+ <span class="ruby-identifier">winner</span>, <span class="ruby-identifier">length</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">play</span>
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">"Winner = #{winner} in #{length} moves. Game had #{player_count} players"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">verbose</span>
+ <span class="ruby-comment cmt"># If the game was a draw, or the winner is unlucky, pick a parent at random</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">winner</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">:draw</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">rand</span> <span class="ruby-operator">></span> <span class="ruby-identifier">winner_success_chance</span>
+ <span class="ruby-identifier">successful_player</span> = <span class="ruby-identifier">players</span>[<span class="ruby-identifier">rand</span>(<span class="ruby-identifier">player_count</span>)]
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">successful_player</span> = <span class="ruby-identifier">winner</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">successful_player</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>tournament_select_population (Population)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File src/selection.rb, line 37</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">tournament_select_population</span>(<span class="ruby-identifier">winner_success_chance</span> = <span class="ruby-value">0</span><span class="ruby-value">.8</span>, <span class="ruby-identifier">max_game_length</span> = <span class="ruby-value">1000</span>, <span class="ruby-identifier">verbose</span> = <span class="ruby-keyword kw">false</span>)
+ <span class="ruby-identifier">new_population</span> = []
+ <span class="ruby-value">1</span>.<span class="ruby-identifier">upto</span>(<span class="ruby-ivar">@individuals</span>.<span class="ruby-identifier">length</span>) <span class="ruby-keyword kw">do</span>
+ <span class="ruby-identifier">new_population</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">tournament_select_one</span>(<span class="ruby-identifier">winner_success_chance</span>, <span class="ruby-identifier">max_game_length</span>, <span class="ruby-identifier">verbose</span>).<span class="ruby-identifier">to_genome</span>
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">"Created #{new_population.length} indivduals"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">verbose</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">new_population</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (Population)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libgenetics.rb, line 135</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">population_size</span>, <span class="ruby-identifier">genome_length</span>)
+ <span class="ruby-ivar">@individuals</span> = []
+ <span class="ruby-value">1</span>.<span class="ruby-identifier">upto</span>(<span class="ruby-identifier">population_size</span>) { <span class="ruby-ivar">@individuals</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Genome</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">genome_length</span>) }
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>crossover (Population)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libgenetics.rb, line 141</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">crossover</span>(<span class="ruby-identifier">crossover_rate</span>)
+ <span class="ruby-identifier">parents</span> = <span class="ruby-ivar">@individuals</span>.<span class="ruby-identifier">dup</span> <span class="ruby-comment cmt"># genomes that haven't been parents yet</span>
+ <span class="ruby-identifier">next_population</span> = <span class="ruby-constant">Population</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">0</span>)
+ <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">parents</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">1</span>
+ <span class="ruby-identifier">parent1</span> = <span class="ruby-identifier">parents</span>.<span class="ruby-identifier">delete_at</span>(<span class="ruby-identifier">rand</span>(<span class="ruby-identifier">parents</span>.<span class="ruby-identifier">length</span>))
+ <span class="ruby-identifier">parent2</span> = <span class="ruby-identifier">parents</span>.<span class="ruby-identifier">delete_at</span>(<span class="ruby-identifier">rand</span>(<span class="ruby-identifier">parents</span>.<span class="ruby-identifier">length</span>))
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rand</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">crossover_rate</span>
+ <span class="ruby-identifier">child1</span>, <span class="ruby-identifier">child2</span> = <span class="ruby-identifier">parent1</span>.<span class="ruby-identifier">crossover</span> <span class="ruby-identifier">parent2</span>, <span class="ruby-identifier">rand</span>(<span class="ruby-identifier">parent1</span>.<span class="ruby-identifier">genome</span>.<span class="ruby-identifier">length</span>)
+ <span class="ruby-identifier">next_population</span>.<span class="ruby-identifier">individuals</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">child1</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">child2</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">next_population</span>.<span class="ruby-identifier">individuals</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">parent1</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">parent2</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">next_population</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">parents</span> <span class="ruby-comment cmt"># pick up any parents that didn't get a chance to mate</span>
+ <span class="ruby-identifier">next_population</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>mutation (Population)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libgenetics.rb, line 159</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mutation</span>(<span class="ruby-identifier">mutation_rate</span>)
+ <span class="ruby-identifier">parents</span> = <span class="ruby-ivar">@individuals</span>.<span class="ruby-identifier">dup</span> <span class="ruby-comment cmt"># genomes that haven't been parents yet</span>
+ <span class="ruby-identifier">next_population</span> = <span class="ruby-constant">Population</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">0</span>)
+ <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">parents</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
+ <span class="ruby-identifier">parent</span> = <span class="ruby-identifier">parents</span>.<span class="ruby-identifier">pop</span>
+ <span class="ruby-identifier">child</span> = <span class="ruby-identifier">parent</span>.<span class="ruby-identifier">mutate</span> <span class="ruby-identifier">mutation_rate</span>
+ <span class="ruby-identifier">next_population</span>.<span class="ruby-identifier">individuals</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">child</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">next_population</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>make_next_generation (Population)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libgenetics.rb, line 170</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">make_next_generation</span>(<span class="ruby-identifier">tournament_winner_success_rate</span> = <span class="ruby-value">0</span><span class="ruby-value">.8</span>, <span class="ruby-identifier">game_length</span> = <span class="ruby-value">1000</span>, <span class="ruby-identifier">crossover_rate</span> = <span class="ruby-value">0</span><span class="ruby-value">.7</span>, <span class="ruby-identifier">mutation_rate</span> = <span class="ruby-value">0</span><span class="ruby-value">.05</span>)
+ <span class="ruby-ivar">@individuals</span> = <span class="ruby-identifier">tournament_select_population</span>(<span class="ruby-identifier">tournament_winner_success_rate</span>, <span class="ruby-identifier">game_length</span>, <span class="ruby-keyword kw">true</span>)
+ <span class="ruby-ivar">@individuals</span> = <span class="ruby-identifier">crossover</span>(<span class="ruby-identifier">crossover_rate</span>)
+ <span class="ruby-ivar">@individuals</span> = <span class="ruby-identifier">mutation</span>(<span class="ruby-identifier">mutation_rate</span>)
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (Population)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libgenetics.rb, line 71</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">population_size</span>, <span class="ruby-identifier">genome_length</span>)
+ <span class="ruby-ivar">@individuals</span> = []
+ <span class="ruby-value">1</span>.<span class="ruby-identifier">upto</span>(<span class="ruby-identifier">population_size</span>) { <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-ivar">@individuals</span> <span class="ruby-operator"><<</span> <span class="ruby-constant">Genome</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">genome_length</span>) }
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>crossover (Population)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libgenetics.rb, line 77</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">crossover</span>(<span class="ruby-identifier">crossover_rate</span>)
+ <span class="ruby-identifier">parents</span> = <span class="ruby-ivar">@individuals</span>.<span class="ruby-identifier">dup</span> <span class="ruby-comment cmt"># genomes that haven't been parents yet</span>
+ <span class="ruby-identifier">next_population</span> = <span class="ruby-constant">Population</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">0</span>)
+ <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">parents</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">1</span>
+ <span class="ruby-identifier">parent1</span> = <span class="ruby-identifier">parents</span>.<span class="ruby-identifier">delete_at</span>(<span class="ruby-identifier">rand</span>(<span class="ruby-identifier">parents</span>.<span class="ruby-identifier">length</span>))
+ <span class="ruby-identifier">parent2</span> = <span class="ruby-identifier">parents</span>.<span class="ruby-identifier">delete_at</span>(<span class="ruby-identifier">rand</span>(<span class="ruby-identifier">parents</span>.<span class="ruby-identifier">length</span>))
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rand</span> <span class="ruby-operator"><</span> <span class="ruby-identifier">crossover_rate</span>
+ <span class="ruby-identifier">child1</span>, <span class="ruby-identifier">child2</span> = <span class="ruby-identifier">parent1</span>.<span class="ruby-identifier">crossover</span> <span class="ruby-identifier">parent2</span>, <span class="ruby-identifier">rand</span>(<span class="ruby-identifier">parent1</span>.<span class="ruby-identifier">genome</span>.<span class="ruby-identifier">length</span>)
+ <span class="ruby-identifier">next_population</span>.<span class="ruby-identifier">individuals</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">child1</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">child2</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">next_population</span>.<span class="ruby-identifier">individuals</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">parent1</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">parent2</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">next_population</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">parents</span> <span class="ruby-comment cmt"># pick up any parents that didn't get a chance to mate</span>
+ <span class="ruby-identifier">next_population</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>mutation (Population)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libgenetics.rb, line 95</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">mutation</span>(<span class="ruby-identifier">mutation_rate</span>)
+ <span class="ruby-identifier">parents</span> = <span class="ruby-ivar">@individuals</span>.<span class="ruby-identifier">dup</span> <span class="ruby-comment cmt"># genomes that haven't been parents yet</span>
+ <span class="ruby-identifier">next_population</span> = <span class="ruby-constant">Population</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value">0</span>)
+ <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">parents</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">0</span>
+ <span class="ruby-identifier">parent</span> = <span class="ruby-identifier">parents</span>.<span class="ruby-identifier">pop</span>
+ <span class="ruby-identifier">child</span> = <span class="ruby-identifier">parent</span>.<span class="ruby-identifier">mutate</span> <span class="ruby-identifier">mutation_rate</span>
+ <span class="ruby-identifier">next_population</span>.<span class="ruby-identifier">individuals</span> <span class="ruby-operator"><<</span> <span class="ruby-identifier">child</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">next_population</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Class: Position</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="classHeader">
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Class</strong></td>
+ <td class="class-name-in-header">Position</td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>In:</strong></td>
+ <td>
+ <a href="../files/lib/libttc_rb.html">
+ lib/libttc.rb
+ </a>
+ <br />
+ </td>
+ </tr>
+
+ <tr class="top-aligned-row">
+ <td><strong>Parent:</strong></td>
+ <td>
+ Object
+ </td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <p>
+Each possible position for a piece is an object Each neighbour is another
+position object
+</p>
+
+ </div>
+
+
+ </div>
+
+ <div id="method-list">
+ <h3 class="section-bar">Methods</h3>
+
+ <div class="name-list">
+ <a href="#M000012">base?</a>
+ <a href="#M000010">new</a>
+ <a href="#M000011">safe?</a>
+ <a href="#M000013">to_s</a>
+ <a href="#M000014">to_str</a>
+ </div>
+ </div>
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+ <div id="attribute-list">
+ <h3 class="section-bar">Attributes</h3>
+
+ <div class="name-list">
+ <table>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">contains</td>
+ <td class="context-item-value"> [RW] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">neighbours</td>
+ <td class="context-item-value"> [RW] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">place</td>
+ <td class="context-item-value"> [R] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ </table>
+ </div>
+ </div>
+
+
+
+ <!-- if method_list -->
+ <div id="methods">
+ <h3 class="section-bar">Public Class methods</h3>
+
+ <div id="method-M000010" class="method-detail">
+ <a name="M000010"></a>
+
+ <div class="method-heading">
+ <a href="Position.src/M000010.html" target="Code" class="method-signature"
+ onclick="popupCode('Position.src/M000010.html');return false;">
+ <span class="method-name">new</span><span class="method-args">(place, safety, base)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <h3 class="section-bar">Public Instance methods</h3>
+
+ <div id="method-M000012" class="method-detail">
+ <a name="M000012"></a>
+
+ <div class="method-heading">
+ <a href="Position.src/M000012.html" target="Code" class="method-signature"
+ onclick="popupCode('Position.src/M000012.html');return false;">
+ <span class="method-name">base?</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Is this position a <a href="Position.html#M000012">base?</a>
+</p>
+ </div>
+ </div>
+
+ <div id="method-M000011" class="method-detail">
+ <a name="M000011"></a>
+
+ <div class="method-heading">
+ <a href="Position.src/M000011.html" target="Code" class="method-signature"
+ onclick="popupCode('Position.src/M000011.html');return false;">
+ <span class="method-name">safe?</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+is this position a safety one (i.e. no captures allowed)?
+</p>
+ </div>
+ </div>
+
+ <div id="method-M000013" class="method-detail">
+ <a name="M000013"></a>
+
+ <div class="method-heading">
+ <a href="Position.src/M000013.html" target="Code" class="method-signature"
+ onclick="popupCode('Position.src/M000013.html');return false;">
+ <span class="method-name">to_s</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <div id="method-M000014" class="method-detail">
+ <a name="M000014"></a>
+
+ <div class="method-heading">
+ <a href="Position.src/M000014.html" target="Code" class="method-signature"
+ onclick="popupCode('Position.src/M000014.html');return false;">
+ <span class="method-name">to_str</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+K 25
+svn:wc:ra_dav:version-url
+V 63
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Position.src
+END
+M000010.html
+K 25
+svn:wc:ra_dav:version-url
+V 76
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Position.src/M000010.html
+END
+M000011.html
+K 25
+svn:wc:ra_dav:version-url
+V 76
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Position.src/M000011.html
+END
+M000003.html
+K 25
+svn:wc:ra_dav:version-url
+V 76
+/svn/njae/!svn/ver/24/TrapTheCap/trunk/doc/classes/Position.src/M000003.html
+END
+M000012.html
+K 25
+svn:wc:ra_dav:version-url
+V 76
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Position.src/M000012.html
+END
+M000004.html
+K 25
+svn:wc:ra_dav:version-url
+V 76
+/svn/njae/!svn/ver/24/TrapTheCap/trunk/doc/classes/Position.src/M000004.html
+END
+M000013.html
+K 25
+svn:wc:ra_dav:version-url
+V 76
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Position.src/M000013.html
+END
+M000005.html
+K 25
+svn:wc:ra_dav:version-url
+V 76
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/classes/Position.src/M000005.html
+END
+M000014.html
+K 25
+svn:wc:ra_dav:version-url
+V 76
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Position.src/M000014.html
+END
+M000006.html
+K 25
+svn:wc:ra_dav:version-url
+V 76
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/classes/Position.src/M000006.html
+END
+M000007.html
+K 25
+svn:wc:ra_dav:version-url
+V 76
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/classes/Position.src/M000007.html
+END
+M000008.html
+K 25
+svn:wc:ra_dav:version-url
+V 76
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/classes/Position.src/M000008.html
+END
--- /dev/null
+8
+
+dir
+68
+http://scripts.njae.me.uk/svn/njae/TrapTheCap/trunk/doc/classes/Position.src
+http://scripts.njae.me.uk/svn/njae
+
+
+
+2008-10-16T14:11:23.436422Z
+41
+neil
+
+
+svn:special svn:externals svn:needs-lock
+
+
+
+
+
+
+
+
+
+
+
+0ada9808-85ab-4924-adda-5bf89eae3818
+\f
+M000010.html
+file
+
+
+
+
+2008-03-28T15:44:41.000000Z
+70bbe77b1e8ace7c866fe9b5db57a559
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000011.html
+file
+
+
+
+
+2008-03-28T15:44:41.000000Z
+bdb4b68377c7f4ed4048ebc837e76472
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000003.html
+file
+
+
+
+
+2008-03-25T12:43:37.000000Z
+70bbe77b1e8ace7c866fe9b5db57a559
+2008-03-28T15:47:09.723420Z
+24
+neil
+\f
+M000012.html
+file
+
+
+
+
+2008-03-28T15:44:41.000000Z
+57b4a841f7c5d2c5c7fbc362d11b70b6
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000004.html
+file
+
+
+
+
+2008-03-25T12:43:37.000000Z
+bdb4b68377c7f4ed4048ebc837e76472
+2008-03-28T15:47:09.723420Z
+24
+neil
+\f
+M000013.html
+file
+
+
+
+
+2008-03-28T15:44:41.000000Z
+482e56a988543978f1551b1868c81181
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000005.html
+file
+
+
+
+
+2008-03-25T12:43:37.000000Z
+57b4a841f7c5d2c5c7fbc362d11b70b6
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+M000014.html
+file
+
+
+
+
+2008-03-28T15:44:41.000000Z
+cddafce3ea25a58f5cf35d0b83ada3d3
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000006.html
+file
+
+
+
+
+2008-03-25T12:43:37.000000Z
+482e56a988543978f1551b1868c81181
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+M000007.html
+file
+
+
+
+
+2008-03-25T11:47:59.000000Z
+6b16c6742da639f2a0350d0e63709fc2
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+M000008.html
+file
+
+
+
+
+2008-03-25T11:47:59.000000Z
+a44d46d097ae553026b55ebff05e41e3
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (Position)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 56</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">place</span>, <span class="ruby-identifier">safety</span>, <span class="ruby-identifier">base</span>)
+ <span class="ruby-ivar">@place</span> = <span class="ruby-identifier">place</span>
+ <span class="ruby-ivar">@safe</span> = <span class="ruby-identifier">safety</span>
+ <span class="ruby-ivar">@base</span> = <span class="ruby-identifier">base</span>
+ <span class="ruby-ivar">@neighbours</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>safe? (Position)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 64</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">safe?</span>
+ <span class="ruby-ivar">@safe</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>base? (Position)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 69</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">base?</span>
+ <span class="ruby-ivar">@base</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_s (Position)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 73</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
+ <span class="ruby-ivar">@place</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>base? (Position)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 61</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">base?</span>
+ <span class="ruby-ivar">@base</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_s (Position)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 65</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
+ <span class="ruby-ivar">@place</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (Position)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 56</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">place</span>, <span class="ruby-identifier">safety</span>, <span class="ruby-identifier">base</span>)
+ <span class="ruby-ivar">@place</span> = <span class="ruby-identifier">place</span>
+ <span class="ruby-ivar">@safe</span> = <span class="ruby-identifier">safety</span>
+ <span class="ruby-ivar">@base</span> = <span class="ruby-identifier">base</span>
+ <span class="ruby-ivar">@neighbours</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>safe? (Position)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 64</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">safe?</span>
+ <span class="ruby-ivar">@safe</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>base? (Position)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 69</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">base?</span>
+ <span class="ruby-ivar">@base</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_s (Position)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 73</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
+ <span class="ruby-ivar">@place</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_str (Position)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 77</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_str</span>
+ <span class="ruby-identifier">to_s</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (Position)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 56</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">place</span>, <span class="ruby-identifier">safety</span>, <span class="ruby-identifier">base</span>)
+ <span class="ruby-ivar">@place</span> = <span class="ruby-identifier">place</span>
+ <span class="ruby-ivar">@safe</span> = <span class="ruby-identifier">safety</span>
+ <span class="ruby-ivar">@base</span> = <span class="ruby-identifier">base</span>
+ <span class="ruby-ivar">@neighbours</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>safe? (Position)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 64</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">safe?</span>
+ <span class="ruby-ivar">@safe</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>base? (Position)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 69</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">base?</span>
+ <span class="ruby-ivar">@base</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_s (Position)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 73</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
+ <span class="ruby-ivar">@place</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>base? (Position)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 61</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">base?</span>
+ <span class="ruby-ivar">@base</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_s (Position)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 65</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
+ <span class="ruby-ivar">@place</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (Position)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 56</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">place</span>, <span class="ruby-identifier">safety</span>, <span class="ruby-identifier">base</span>)
+ <span class="ruby-ivar">@place</span> = <span class="ruby-identifier">place</span>
+ <span class="ruby-ivar">@safe</span> = <span class="ruby-identifier">safety</span>
+ <span class="ruby-ivar">@base</span> = <span class="ruby-identifier">base</span>
+ <span class="ruby-ivar">@neighbours</span> = <span class="ruby-constant">Array</span>.<span class="ruby-identifier">new</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>safe? (Position)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 64</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">safe?</span>
+ <span class="ruby-ivar">@safe</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>base? (Position)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 69</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">base?</span>
+ <span class="ruby-ivar">@base</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_s (Position)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 73</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
+ <span class="ruby-ivar">@place</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_str (Position)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 77</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_str</span>
+ <span class="ruby-identifier">to_s</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Class: Potential_player</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="classHeader">
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Class</strong></td>
+ <td class="class-name-in-header">Potential_player</td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>In:</strong></td>
+ <td>
+ <a href="../files/lib/libpplayer_rb.html">
+ lib/libpplayer.rb
+ </a>
+ <br />
+ </td>
+ </tr>
+
+ <tr class="top-aligned-row">
+ <td><strong>Parent:</strong></td>
+ <td>
+ Object
+ </td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <p>
+Play Trap the Cap by using potential fields. For each possible move,
+calculate the field strength and pick the move with the lowest potential
+</p>
+
+ </div>
+
+
+ </div>
+
+ <div id="method-list">
+ <h3 class="section-bar">Methods</h3>
+
+ <div class="name-list">
+ <a href="#M000007">best_move</a>
+ <a href="#M000006">new</a>
+ <a href="#M000008">score_position</a>
+ <a href="#M000009">to_bitstring</a>
+ <a href="#M000010">to_genome</a>
+ </div>
+ </div>
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+ <div id="attribute-list">
+ <h3 class="section-bar">Attributes</h3>
+
+ <div class="name-list">
+ <table>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">base_pull</td>
+ <td class="context-item-value"> [R] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">capture_bonus</td>
+ <td class="context-item-value"> [R] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">enemy_pull</td>
+ <td class="context-item-value"> [R] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">friend_pull</td>
+ <td class="context-item-value"> [R] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ <tr class="top-aligned-row context-row">
+ <td class="context-item-name">safe_bonus</td>
+ <td class="context-item-value"> [R] </td>
+ <td class="context-item-desc"></td>
+ </tr>
+ </table>
+ </div>
+ </div>
+
+
+
+ <!-- if method_list -->
+ <div id="methods">
+ <h3 class="section-bar">Public Class methods</h3>
+
+ <div id="method-M000006" class="method-detail">
+ <a name="M000006"></a>
+
+ <div class="method-heading">
+ <a href="Potential_player.src/M000006.html" target="Code" class="method-signature"
+ onclick="popupCode('Potential_player.src/M000006.html');return false;">
+ <span class="method-name">new</span><span class="method-args">(args, verbose = false)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+ <h3 class="section-bar">Public Instance methods</h3>
+
+ <div id="method-M000007" class="method-detail">
+ <a name="M000007"></a>
+
+ <div class="method-heading">
+ <a href="Potential_player.src/M000007.html" target="Code" class="method-signature"
+ onclick="popupCode('Potential_player.src/M000007.html');return false;">
+ <span class="method-name">best_move</span><span class="method-args">(game, die_result)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Find the best move of the possible ones
+</p>
+ </div>
+ </div>
+
+ <div id="method-M000008" class="method-detail">
+ <a name="M000008"></a>
+
+ <div class="method-heading">
+ <a href="Potential_player.src/M000008.html" target="Code" class="method-signature"
+ onclick="popupCode('Potential_player.src/M000008.html');return false;">
+ <span class="method-name">score_position</span><span class="method-args">(game, player)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Calculate the potential score of a position for a given player
+</p>
+ </div>
+ </div>
+
+ <div id="method-M000009" class="method-detail">
+ <a name="M000009"></a>
+
+ <div class="method-heading">
+ <a href="Potential_player.src/M000009.html" target="Code" class="method-signature"
+ onclick="popupCode('Potential_player.src/M000009.html');return false;">
+ <span class="method-name">to_bitstring</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Convert a player to a bitstring
+</p>
+ </div>
+ </div>
+
+ <div id="method-M000010" class="method-detail">
+ <a name="M000010"></a>
+
+ <div class="method-heading">
+ <a href="Potential_player.src/M000010.html" target="Code" class="method-signature"
+ onclick="popupCode('Potential_player.src/M000010.html');return false;">
+ <span class="method-name">to_genome</span><span class="method-args">()</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ <p>
+Convert a player to a genome
+</p>
+ </div>
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+K 25
+svn:wc:ra_dav:version-url
+V 71
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Potential_player.src
+END
+M000010.html
+K 25
+svn:wc:ra_dav:version-url
+V 84
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Potential_player.src/M000010.html
+END
+M000002.html
+K 25
+svn:wc:ra_dav:version-url
+V 84
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Potential_player.src/M000002.html
+END
+M000003.html
+K 25
+svn:wc:ra_dav:version-url
+V 84
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Potential_player.src/M000003.html
+END
+M000004.html
+K 25
+svn:wc:ra_dav:version-url
+V 84
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Potential_player.src/M000004.html
+END
+M000005.html
+K 25
+svn:wc:ra_dav:version-url
+V 84
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Potential_player.src/M000005.html
+END
+M000006.html
+K 25
+svn:wc:ra_dav:version-url
+V 84
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Potential_player.src/M000006.html
+END
+M000007.html
+K 25
+svn:wc:ra_dav:version-url
+V 84
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Potential_player.src/M000007.html
+END
+M000008.html
+K 25
+svn:wc:ra_dav:version-url
+V 84
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Potential_player.src/M000008.html
+END
+M000009.html
+K 25
+svn:wc:ra_dav:version-url
+V 84
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/Potential_player.src/M000009.html
+END
--- /dev/null
+8
+
+dir
+68
+http://scripts.njae.me.uk/svn/njae/TrapTheCap/trunk/doc/classes/Potential_player.src
+http://scripts.njae.me.uk/svn/njae
+
+
+
+2008-10-16T14:11:23.436422Z
+41
+
+
+
+svn:special svn:externals svn:needs-lock
+\f
+M000010.html
+file
+
+
+
+
+2008-04-23T19:33:07.000000Z
+a17a65209784f73ce372eaae6630092a
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000002.html
+file
+
+
+
+
+2008-04-23T19:29:25.000000Z
+149829f922648619748d7f4d1c2e7130
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000003.html
+file
+
+
+
+
+2008-04-23T19:29:25.000000Z
+9b5ecdecaf201d9385ecbdb3ed301b4f
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000004.html
+file
+
+
+
+
+2008-04-23T19:29:25.000000Z
+f47f937d8af031514a674ff62bf37ee9
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000005.html
+file
+
+
+
+
+2008-04-23T19:29:25.000000Z
+735261c857222981035cc28ed6def8e9
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000006.html
+file
+
+
+
+
+2008-04-23T19:33:07.000000Z
+4b3dd51bded36491f7257ccf146416a7
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000007.html
+file
+
+
+
+
+2008-04-23T19:33:07.000000Z
+8f709c92f7983a517a5c0d2e3d324d50
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000008.html
+file
+
+
+
+
+2008-04-23T19:33:07.000000Z
+c730b64ee755a3435f822cd501cc7ab3
+2008-10-16T14:11:23.436422Z
+41
+\f
+M000009.html
+file
+
+
+
+
+2008-04-23T19:33:07.000000Z
+4dd74593d118059f9479f6ae113748fc
+2008-10-16T14:11:23.436422Z
+41
+\f
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (Potential_player)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libpplayer.rb, line 20</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">args</span>, <span class="ruby-identifier">verbose</span> = <span class="ruby-keyword kw">false</span>)
+ <span class="ruby-ivar">@friend_pull</span> = <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:friend_pull</span>] <span class="ruby-operator">||</span> <span class="ruby-value">1</span>
+ <span class="ruby-ivar">@enemy_pull</span> = <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:enemy_pull</span>] <span class="ruby-operator">||</span> <span class="ruby-value">0</span><span class="ruby-value">.5</span>
+ <span class="ruby-ivar">@base_pull</span> = <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:base_pull</span>] <span class="ruby-operator">||</span> <span class="ruby-value">2</span>
+ <span class="ruby-ivar">@safe_bonus</span> = <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:safe_bonus</span>] <span class="ruby-operator">||</span> <span class="ruby-value">8</span>
+ <span class="ruby-ivar">@capture_bonus</span> = <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:capture_bonus</span>] <span class="ruby-operator">||</span> <span class="ruby-value">10</span>
+
+ <span class="ruby-ivar">@verbose</span> = <span class="ruby-identifier">verbose</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>best_move (Potential_player)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libpplayer.rb, line 31</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">best_move</span>(<span class="ruby-identifier">game</span>, <span class="ruby-identifier">die_result</span>)
+ <span class="ruby-identifier">me</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">current_player</span>
+ <span class="ruby-identifier">possible_moves</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">possible_moves</span>(<span class="ruby-identifier">die_result</span>, <span class="ruby-identifier">me</span>)
+ <span class="ruby-identifier">scored_moves</span> = <span class="ruby-identifier">possible_moves</span>.<span class="ruby-identifier">collect</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">begin</span>
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span> <span class="ruby-identifier">m</span>
+ <span class="ruby-identifier">score</span> = <span class="ruby-identifier">score_position</span>(<span class="ruby-identifier">game</span>, <span class="ruby-identifier">me</span>)
+<span class="ruby-comment cmt"># game.undo_move!</span>
+ <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">GameWonNotice</span>
+ <span class="ruby-identifier">score</span> = <span class="ruby-value">10000</span>
+ <span class="ruby-keyword kw">ensure</span>
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">undo_move!</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">"#{m} scores #{score}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@verbose</span>
+ [<span class="ruby-identifier">m</span>, <span class="ruby-identifier">score</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">best_move</span> = (<span class="ruby-identifier">scored_moves</span>.<span class="ruby-identifier">max</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">a</span>, <span class="ruby-identifier">b</span><span class="ruby-operator">|</span> <span class="ruby-identifier">a</span>[<span class="ruby-value">1</span>] <span class="ruby-operator"><=></span> <span class="ruby-identifier">b</span>[<span class="ruby-value">1</span>]})[<span class="ruby-value">0</span>]
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>score_position (Potential_player)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libpplayer.rb, line 51</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">score_position</span>(<span class="ruby-identifier">game</span>, <span class="ruby-identifier">player</span>)
+ <span class="ruby-identifier">score</span> = <span class="ruby-value">0</span>
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>.<span class="ruby-identifier">each_value</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">piece</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">here</span> = <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">player</span>
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>.<span class="ruby-identifier">each_value</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">other_piece</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">other_piece</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">player</span>
+ <span class="ruby-identifier">score</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">here</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">other_piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>] <span class="ruby-operator">*</span> <span class="ruby-ivar">@friend_pull</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">score</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">here</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">other_piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>] <span class="ruby-operator">*</span> <span class="ruby-ivar">@enemy_pull</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">score</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">*</span> <span class="ruby-ivar">@capture_bonus</span>
+ <span class="ruby-identifier">score</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">here</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-identifier">player</span>].<span class="ruby-identifier">place</span>] <span class="ruby-operator">*</span>
+ <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">*</span> <span class="ruby-ivar">@base_pull</span>
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">here</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-identifier">player</span>]
+ <span class="ruby-identifier">score</span> <span class="ruby-operator">+=</span> <span class="ruby-ivar">@safe_bonus</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">score</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_bitstring (Potential_player)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libpplayer.rb, line 75</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_bitstring</span>
+ (<span class="ruby-ivar">@friend_pull</span> <span class="ruby-operator">*</span> <span class="ruby-value">4</span>).<span class="ruby-identifier">to_i</span>.<span class="ruby-identifier">to_bitstring</span>(<span class="ruby-value">4</span>).<span class="ruby-identifier">gray_encode</span> <span class="ruby-operator">+</span>
+ (<span class="ruby-ivar">@enemy_pull</span> <span class="ruby-operator">*</span> <span class="ruby-value">4</span>).<span class="ruby-identifier">to_i</span>.<span class="ruby-identifier">to_bitstring</span>(<span class="ruby-value">4</span>).<span class="ruby-identifier">gray_encode</span> <span class="ruby-operator">+</span>
+ (<span class="ruby-ivar">@base_pull</span> <span class="ruby-operator">*</span> <span class="ruby-value">4</span>).<span class="ruby-identifier">to_i</span>.<span class="ruby-identifier">to_bitstring</span>(<span class="ruby-value">4</span>).<span class="ruby-identifier">gray_encode</span> <span class="ruby-operator">+</span>
+ <span class="ruby-ivar">@safe_bonus</span>.<span class="ruby-identifier">to_bitstring</span>(<span class="ruby-value">4</span>).<span class="ruby-identifier">gray_encode</span> <span class="ruby-operator">+</span>
+ <span class="ruby-ivar">@capture_bonus</span>.<span class="ruby-identifier">to_bitstring</span>(<span class="ruby-value">4</span>).<span class="ruby-identifier">gray_encode</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (Potential_player)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libpplayer.rb, line 23</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">args</span>, <span class="ruby-identifier">verbose</span> = <span class="ruby-keyword kw">false</span>)
+ <span class="ruby-ivar">@friend_pull</span> = <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:friend_pull</span>] <span class="ruby-operator">||</span> <span class="ruby-value">1</span>
+ <span class="ruby-ivar">@enemy_pull</span> = <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:enemy_pull</span>] <span class="ruby-operator">||</span> <span class="ruby-value">0</span><span class="ruby-value">.5</span>
+ <span class="ruby-ivar">@base_pull</span> = <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:base_pull</span>] <span class="ruby-operator">||</span> <span class="ruby-value">2</span>
+ <span class="ruby-ivar">@safe_bonus</span> = <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:safe_bonus</span>] <span class="ruby-operator">||</span> <span class="ruby-value">8</span>
+ <span class="ruby-ivar">@capture_bonus</span> = <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:capture_bonus</span>] <span class="ruby-operator">||</span> <span class="ruby-value">10</span>
+
+ <span class="ruby-ivar">@verbose</span> = <span class="ruby-identifier">verbose</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>best_move (Potential_player)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libpplayer.rb, line 34</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">best_move</span>(<span class="ruby-identifier">game</span>, <span class="ruby-identifier">die_result</span>)
+ <span class="ruby-identifier">me</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">current_player</span>
+ <span class="ruby-identifier">possible_moves</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">possible_moves</span>(<span class="ruby-identifier">die_result</span>, <span class="ruby-identifier">me</span>)
+ <span class="ruby-identifier">scored_moves</span> = <span class="ruby-identifier">possible_moves</span>.<span class="ruby-identifier">collect</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">begin</span>
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span> <span class="ruby-identifier">m</span>
+ <span class="ruby-identifier">score</span> = <span class="ruby-identifier">score_position</span>(<span class="ruby-identifier">game</span>, <span class="ruby-identifier">me</span>)
+<span class="ruby-comment cmt"># game.undo_move!</span>
+ <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">GameWonNotice</span>
+ <span class="ruby-identifier">score</span> = <span class="ruby-value">10000</span>
+ <span class="ruby-keyword kw">ensure</span>
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">undo_move!</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">"#{m} scores #{score}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@verbose</span>
+ [<span class="ruby-identifier">m</span>, <span class="ruby-identifier">score</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">best_move</span> = (<span class="ruby-identifier">scored_moves</span>.<span class="ruby-identifier">max</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">a</span>, <span class="ruby-identifier">b</span><span class="ruby-operator">|</span> <span class="ruby-identifier">a</span>[<span class="ruby-value">1</span>] <span class="ruby-operator"><=></span> <span class="ruby-identifier">b</span>[<span class="ruby-value">1</span>]})[<span class="ruby-value">0</span>]
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>score_position (Potential_player)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libpplayer.rb, line 54</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">score_position</span>(<span class="ruby-identifier">game</span>, <span class="ruby-identifier">player</span>)
+ <span class="ruby-identifier">score</span> = <span class="ruby-value">0</span>
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>.<span class="ruby-identifier">each_value</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">piece</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">here</span> = <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">player</span>
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>.<span class="ruby-identifier">each_value</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">other_piece</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">other_piece</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">player</span>
+ <span class="ruby-identifier">score</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">here</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">other_piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>] <span class="ruby-operator">*</span> <span class="ruby-ivar">@friend_pull</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">score</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">here</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">other_piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>] <span class="ruby-operator">*</span> <span class="ruby-ivar">@enemy_pull</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">score</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">*</span> <span class="ruby-ivar">@capture_bonus</span>
+ <span class="ruby-identifier">score</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">here</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-identifier">player</span>].<span class="ruby-identifier">place</span>] <span class="ruby-operator">*</span>
+ <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">*</span> <span class="ruby-ivar">@base_pull</span>
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">here</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-identifier">player</span>]
+ <span class="ruby-identifier">score</span> <span class="ruby-operator">+=</span> <span class="ruby-ivar">@safe_bonus</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">score</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_bitstring (Potential_player)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libpplayer.rb, line 78</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_bitstring</span>
+ (<span class="ruby-ivar">@friend_pull</span> <span class="ruby-operator">*</span> <span class="ruby-value">4</span>).<span class="ruby-identifier">to_i</span>.<span class="ruby-identifier">to_bitstring</span>(<span class="ruby-value">4</span>).<span class="ruby-identifier">gray_encode</span> <span class="ruby-operator">+</span>
+ (<span class="ruby-ivar">@enemy_pull</span> <span class="ruby-operator">*</span> <span class="ruby-value">4</span>).<span class="ruby-identifier">to_i</span>.<span class="ruby-identifier">to_bitstring</span>(<span class="ruby-value">4</span>).<span class="ruby-identifier">gray_encode</span> <span class="ruby-operator">+</span>
+ (<span class="ruby-ivar">@base_pull</span> <span class="ruby-operator">*</span> <span class="ruby-value">4</span>).<span class="ruby-identifier">to_i</span>.<span class="ruby-identifier">to_bitstring</span>(<span class="ruby-value">4</span>).<span class="ruby-identifier">gray_encode</span> <span class="ruby-operator">+</span>
+ <span class="ruby-ivar">@safe_bonus</span>.<span class="ruby-identifier">to_bitstring</span>(<span class="ruby-value">4</span>).<span class="ruby-identifier">gray_encode</span> <span class="ruby-operator">+</span>
+ <span class="ruby-ivar">@capture_bonus</span>.<span class="ruby-identifier">to_bitstring</span>(<span class="ruby-value">4</span>).<span class="ruby-identifier">gray_encode</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_genome (Potential_player)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libpplayer.rb, line 87</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_genome</span>
+ <span class="ruby-constant">Genome</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_bitstring</span>)
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (Potential_player)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libpplayer.rb, line 20</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">args</span>, <span class="ruby-identifier">verbose</span> = <span class="ruby-keyword kw">false</span>)
+ <span class="ruby-ivar">@friend_pull</span> = <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:friend_pull</span>] <span class="ruby-operator">||</span> <span class="ruby-value">1</span>
+ <span class="ruby-ivar">@enemy_pull</span> = <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:enemy_pull</span>] <span class="ruby-operator">||</span> <span class="ruby-value">0</span><span class="ruby-value">.5</span>
+ <span class="ruby-ivar">@base_pull</span> = <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:base_pull</span>] <span class="ruby-operator">||</span> <span class="ruby-value">2</span>
+ <span class="ruby-ivar">@safe_bonus</span> = <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:safe_bonus</span>] <span class="ruby-operator">||</span> <span class="ruby-value">8</span>
+ <span class="ruby-ivar">@capture_bonus</span> = <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:capture_bonus</span>] <span class="ruby-operator">||</span> <span class="ruby-value">10</span>
+
+ <span class="ruby-ivar">@verbose</span> = <span class="ruby-identifier">verbose</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>best_move (Potential_player)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libpplayer.rb, line 31</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">best_move</span>(<span class="ruby-identifier">game</span>, <span class="ruby-identifier">die_result</span>)
+ <span class="ruby-identifier">me</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">current_player</span>
+ <span class="ruby-identifier">possible_moves</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">possible_moves</span>(<span class="ruby-identifier">die_result</span>, <span class="ruby-identifier">me</span>)
+ <span class="ruby-identifier">scored_moves</span> = <span class="ruby-identifier">possible_moves</span>.<span class="ruby-identifier">collect</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">begin</span>
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span> <span class="ruby-identifier">m</span>
+ <span class="ruby-identifier">score</span> = <span class="ruby-identifier">score_position</span>(<span class="ruby-identifier">game</span>, <span class="ruby-identifier">me</span>)
+<span class="ruby-comment cmt"># game.undo_move!</span>
+ <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">GameWonNotice</span>
+ <span class="ruby-identifier">score</span> = <span class="ruby-value">10000</span>
+ <span class="ruby-keyword kw">ensure</span>
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">undo_move!</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">"#{m} scores #{score}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@verbose</span>
+ [<span class="ruby-identifier">m</span>, <span class="ruby-identifier">score</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">best_move</span> = (<span class="ruby-identifier">scored_moves</span>.<span class="ruby-identifier">max</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">a</span>, <span class="ruby-identifier">b</span><span class="ruby-operator">|</span> <span class="ruby-identifier">a</span>[<span class="ruby-value">1</span>] <span class="ruby-operator"><=></span> <span class="ruby-identifier">b</span>[<span class="ruby-value">1</span>]})[<span class="ruby-value">0</span>]
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>score_position (Potential_player)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libpplayer.rb, line 51</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">score_position</span>(<span class="ruby-identifier">game</span>, <span class="ruby-identifier">player</span>)
+ <span class="ruby-identifier">score</span> = <span class="ruby-value">0</span>
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>.<span class="ruby-identifier">each_value</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">piece</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">here</span> = <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">player</span>
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>.<span class="ruby-identifier">each_value</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">other_piece</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">other_piece</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">player</span>
+ <span class="ruby-identifier">score</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">here</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">other_piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>] <span class="ruby-operator">*</span> <span class="ruby-ivar">@friend_pull</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">score</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">here</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">other_piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>] <span class="ruby-operator">*</span> <span class="ruby-ivar">@enemy_pull</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">score</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">*</span> <span class="ruby-ivar">@capture_bonus</span>
+ <span class="ruby-identifier">score</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">here</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-identifier">player</span>].<span class="ruby-identifier">place</span>] <span class="ruby-operator">*</span>
+ <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">*</span> <span class="ruby-ivar">@base_pull</span>
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">here</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-identifier">player</span>]
+ <span class="ruby-identifier">score</span> <span class="ruby-operator">+=</span> <span class="ruby-ivar">@safe_bonus</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">score</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_bitstring (Potential_player)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libpplayer.rb, line 75</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_bitstring</span>
+ (<span class="ruby-ivar">@friend_pull</span> <span class="ruby-operator">*</span> <span class="ruby-value">4</span>).<span class="ruby-identifier">to_i</span>.<span class="ruby-identifier">to_bitstring</span>(<span class="ruby-value">4</span>).<span class="ruby-identifier">gray_encode</span> <span class="ruby-operator">+</span>
+ (<span class="ruby-ivar">@enemy_pull</span> <span class="ruby-operator">*</span> <span class="ruby-value">4</span>).<span class="ruby-identifier">to_i</span>.<span class="ruby-identifier">to_bitstring</span>(<span class="ruby-value">4</span>).<span class="ruby-identifier">gray_encode</span> <span class="ruby-operator">+</span>
+ (<span class="ruby-ivar">@base_pull</span> <span class="ruby-operator">*</span> <span class="ruby-value">4</span>).<span class="ruby-identifier">to_i</span>.<span class="ruby-identifier">to_bitstring</span>(<span class="ruby-value">4</span>).<span class="ruby-identifier">gray_encode</span> <span class="ruby-operator">+</span>
+ <span class="ruby-ivar">@safe_bonus</span>.<span class="ruby-identifier">to_bitstring</span>(<span class="ruby-value">4</span>).<span class="ruby-identifier">gray_encode</span> <span class="ruby-operator">+</span>
+ <span class="ruby-ivar">@capture_bonus</span>.<span class="ruby-identifier">to_bitstring</span>(<span class="ruby-value">4</span>).<span class="ruby-identifier">gray_encode</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>new (Potential_player)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libpplayer.rb, line 23</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">args</span>, <span class="ruby-identifier">verbose</span> = <span class="ruby-keyword kw">false</span>)
+ <span class="ruby-ivar">@friend_pull</span> = <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:friend_pull</span>] <span class="ruby-operator">||</span> <span class="ruby-value">1</span>
+ <span class="ruby-ivar">@enemy_pull</span> = <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:enemy_pull</span>] <span class="ruby-operator">||</span> <span class="ruby-value">0</span><span class="ruby-value">.5</span>
+ <span class="ruby-ivar">@base_pull</span> = <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:base_pull</span>] <span class="ruby-operator">||</span> <span class="ruby-value">2</span>
+ <span class="ruby-ivar">@safe_bonus</span> = <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:safe_bonus</span>] <span class="ruby-operator">||</span> <span class="ruby-value">8</span>
+ <span class="ruby-ivar">@capture_bonus</span> = <span class="ruby-identifier">args</span>[<span class="ruby-identifier">:capture_bonus</span>] <span class="ruby-operator">||</span> <span class="ruby-value">10</span>
+
+ <span class="ruby-ivar">@verbose</span> = <span class="ruby-identifier">verbose</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>best_move (Potential_player)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libpplayer.rb, line 34</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">best_move</span>(<span class="ruby-identifier">game</span>, <span class="ruby-identifier">die_result</span>)
+ <span class="ruby-identifier">me</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">current_player</span>
+ <span class="ruby-identifier">possible_moves</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">possible_moves</span>(<span class="ruby-identifier">die_result</span>, <span class="ruby-identifier">me</span>)
+ <span class="ruby-identifier">scored_moves</span> = <span class="ruby-identifier">possible_moves</span>.<span class="ruby-identifier">collect</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">m</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">begin</span>
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">apply_move!</span> <span class="ruby-identifier">m</span>
+ <span class="ruby-identifier">score</span> = <span class="ruby-identifier">score_position</span>(<span class="ruby-identifier">game</span>, <span class="ruby-identifier">me</span>)
+<span class="ruby-comment cmt"># game.undo_move!</span>
+ <span class="ruby-keyword kw">rescue</span> <span class="ruby-constant">GameWonNotice</span>
+ <span class="ruby-identifier">score</span> = <span class="ruby-value">10000</span>
+ <span class="ruby-keyword kw">ensure</span>
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">undo_move!</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">puts</span> <span class="ruby-node">"#{m} scores #{score}"</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@verbose</span>
+ [<span class="ruby-identifier">m</span>, <span class="ruby-identifier">score</span>]
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">best_move</span> = (<span class="ruby-identifier">scored_moves</span>.<span class="ruby-identifier">max</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">a</span>, <span class="ruby-identifier">b</span><span class="ruby-operator">|</span> <span class="ruby-identifier">a</span>[<span class="ruby-value">1</span>] <span class="ruby-operator"><=></span> <span class="ruby-identifier">b</span>[<span class="ruby-value">1</span>]})[<span class="ruby-value">0</span>]
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>score_position (Potential_player)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libpplayer.rb, line 54</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">score_position</span>(<span class="ruby-identifier">game</span>, <span class="ruby-identifier">player</span>)
+ <span class="ruby-identifier">score</span> = <span class="ruby-value">0</span>
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>.<span class="ruby-identifier">each_value</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">piece</span><span class="ruby-operator">|</span>
+ <span class="ruby-identifier">here</span> = <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">position</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">player</span>
+ <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>.<span class="ruby-identifier">each_value</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">other_piece</span><span class="ruby-operator">|</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">other_piece</span>.<span class="ruby-identifier">colour</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">player</span>
+ <span class="ruby-identifier">score</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">here</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">other_piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>] <span class="ruby-operator">*</span> <span class="ruby-ivar">@friend_pull</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-identifier">score</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">here</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">other_piece</span>.<span class="ruby-identifier">position</span>.<span class="ruby-identifier">place</span>] <span class="ruby-operator">*</span> <span class="ruby-ivar">@enemy_pull</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">score</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">*</span> <span class="ruby-ivar">@capture_bonus</span>
+ <span class="ruby-identifier">score</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">distance_between</span>[<span class="ruby-identifier">here</span>.<span class="ruby-identifier">place</span>][<span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-identifier">player</span>].<span class="ruby-identifier">place</span>] <span class="ruby-operator">*</span>
+ <span class="ruby-identifier">piece</span>.<span class="ruby-identifier">contains</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">*</span> <span class="ruby-ivar">@base_pull</span>
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">here</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-identifier">player</span>]
+ <span class="ruby-identifier">score</span> <span class="ruby-operator">+=</span> <span class="ruby-ivar">@safe_bonus</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">score</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_bitstring (Potential_player)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libpplayer.rb, line 78</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_bitstring</span>
+ (<span class="ruby-ivar">@friend_pull</span> <span class="ruby-operator">*</span> <span class="ruby-value">4</span>).<span class="ruby-identifier">to_i</span>.<span class="ruby-identifier">to_bitstring</span>(<span class="ruby-value">4</span>).<span class="ruby-identifier">gray_encode</span> <span class="ruby-operator">+</span>
+ (<span class="ruby-ivar">@enemy_pull</span> <span class="ruby-operator">*</span> <span class="ruby-value">4</span>).<span class="ruby-identifier">to_i</span>.<span class="ruby-identifier">to_bitstring</span>(<span class="ruby-value">4</span>).<span class="ruby-identifier">gray_encode</span> <span class="ruby-operator">+</span>
+ (<span class="ruby-ivar">@base_pull</span> <span class="ruby-operator">*</span> <span class="ruby-value">4</span>).<span class="ruby-identifier">to_i</span>.<span class="ruby-identifier">to_bitstring</span>(<span class="ruby-value">4</span>).<span class="ruby-identifier">gray_encode</span> <span class="ruby-operator">+</span>
+ <span class="ruby-ivar">@safe_bonus</span>.<span class="ruby-identifier">to_bitstring</span>(<span class="ruby-value">4</span>).<span class="ruby-identifier">gray_encode</span> <span class="ruby-operator">+</span>
+ <span class="ruby-ivar">@capture_bonus</span>.<span class="ruby-identifier">to_bitstring</span>(<span class="ruby-value">4</span>).<span class="ruby-identifier">gray_encode</span>
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_genome (Potential_player)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libpplayer.rb, line 87</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_genome</span>
+ <span class="ruby-constant">Genome</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_bitstring</span>)
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Class: String</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="classHeader">
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Class</strong></td>
+ <td class="class-name-in-header">String</td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>In:</strong></td>
+ <td>
+ <a href="../files/lib/libttc_rb.html">
+ lib/libttc.rb
+ </a>
+ <br />
+ </td>
+ </tr>
+
+ <tr class="top-aligned-row">
+ <td><strong>Parent:</strong></td>
+ <td>
+ Object
+ </td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <p>
+Extension to <a href="String.html">String</a> class to convert a
+move-description string into a <a href="Move.html">Move</a> object. This is
+the inverse of the <a href="Move.html#M000034">Move#to_s</a> method
+</p>
+
+ </div>
+
+
+ </div>
+
+ <div id="method-list">
+ <h3 class="section-bar">Methods</h3>
+
+ <div class="name-list">
+ <a href="#M000053">to_move</a>
+ </div>
+ </div>
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+ <div id="methods">
+ <h3 class="section-bar">Public Instance methods</h3>
+
+ <div id="method-M000053" class="method-detail">
+ <a name="M000053"></a>
+
+ <div class="method-heading">
+ <a href="String.src/M000053.html" target="Code" class="method-signature"
+ onclick="popupCode('String.src/M000053.html');return false;">
+ <span class="method-name">to_move</span><span class="method-args">(game)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+K 25
+svn:wc:ra_dav:version-url
+V 61
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/String.src
+END
+M000023.html
+K 25
+svn:wc:ra_dav:version-url
+V 74
+/svn/njae/!svn/ver/24/TrapTheCap/trunk/doc/classes/String.src/M000023.html
+END
+M000033.html
+K 25
+svn:wc:ra_dav:version-url
+V 74
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/classes/String.src/M000033.html
+END
+M000053.html
+K 25
+svn:wc:ra_dav:version-url
+V 74
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/classes/String.src/M000053.html
+END
--- /dev/null
+8
+
+dir
+68
+http://scripts.njae.me.uk/svn/njae/TrapTheCap/trunk/doc/classes/String.src
+http://scripts.njae.me.uk/svn/njae
+
+
+
+2008-10-16T14:11:23.436422Z
+41
+neil
+
+
+svn:special svn:externals svn:needs-lock
+
+
+
+
+
+
+
+
+
+
+
+0ada9808-85ab-4924-adda-5bf89eae3818
+\f
+M000023.html
+file
+
+
+
+
+2008-03-25T12:43:37.000000Z
+5379a14f8396caafa9cc2b9efeec7c6f
+2008-03-28T15:47:09.723420Z
+24
+neil
+\f
+M000033.html
+file
+
+
+
+
+2008-03-25T11:48:00.000000Z
+cd7c03584fe23acc665ee89ef6a37f4c
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+M000053.html
+file
+
+
+
+
+2008-03-28T15:44:42.000000Z
+4f1fed17fd24df46a33ecd6aaba77c43
+2008-10-16T14:11:23.436422Z
+41
+\f
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_move (String)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 513</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_move</span>(<span class="ruby-identifier">game</span>)
+ <span class="ruby-identifier">move_elements</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">downcase</span>.<span class="ruby-identifier">split</span>
+ <span class="ruby-identifier">piece_name</span> = <span class="ruby-identifier">move_elements</span>[<span class="ruby-value">0</span>]
+ <span class="ruby-identifier">destination_name</span> = <span class="ruby-identifier">move_elements</span>[<span class="ruby-value">-1</span>]
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">destination_name</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">2</span> <span class="ruby-keyword kw">and</span>
+ <span class="ruby-identifier">destination_name</span>[<span class="ruby-value">-2</span>,<span class="ruby-value">2</span>] <span class="ruby-operator">==</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">centre</span>.<span class="ruby-identifier">place</span>[<span class="ruby-value">-2</span>,<span class="ruby-value">2</span>]
+ <span class="ruby-identifier">destination_name</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">centre</span>.<span class="ruby-identifier">place</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-value str">"Invalid piece in move read"</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">piece_name</span>)
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-value str">"Invalid destination in move read"</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">destination_name</span>)
+ <span class="ruby-comment cmt"># Deal with the synonyms for the centre position</span>
+ <span class="ruby-identifier">via_base</span> = (<span class="ruby-identifier">destination_name</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">move_elements</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">2</span>)
+ <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-identifier">piece_name</span>], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-identifier">destination_name</span>], <span class="ruby-identifier">via_base</span>)
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_move (String)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 495</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_move</span>(<span class="ruby-identifier">game</span>)
+ <span class="ruby-identifier">move_elements</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">downcase</span>.<span class="ruby-identifier">split</span>
+ <span class="ruby-identifier">piece_name</span> = <span class="ruby-identifier">move_elements</span>[<span class="ruby-value">0</span>]
+ <span class="ruby-identifier">destination_name</span> = <span class="ruby-identifier">move_elements</span>[<span class="ruby-value">-1</span>]
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">destination_name</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">2</span> <span class="ruby-keyword kw">and</span>
+ <span class="ruby-identifier">destination_name</span>[<span class="ruby-value">-2</span>,<span class="ruby-value">2</span>] <span class="ruby-operator">==</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">centre</span>.<span class="ruby-identifier">place</span>[<span class="ruby-value">-2</span>,<span class="ruby-value">2</span>]
+ <span class="ruby-identifier">destination_name</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">centre</span>.<span class="ruby-identifier">place</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-value str">"Invalid piece in move read"</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">piece_name</span>)
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-value str">"Invalid destination in move read"</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">destination_name</span>)
+ <span class="ruby-comment cmt"># Deal with the synonyms for the centre position</span>
+ <span class="ruby-identifier">via_base</span> = (<span class="ruby-identifier">destination_name</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">move_elements</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">2</span>)
+ <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-identifier">piece_name</span>], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-identifier">destination_name</span>], <span class="ruby-identifier">via_base</span>)
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_move (String)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 591</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_move</span>(<span class="ruby-identifier">game</span>)
+ <span class="ruby-identifier">move_elements</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">downcase</span>.<span class="ruby-identifier">split</span>
+ <span class="ruby-identifier">piece_name</span> = <span class="ruby-identifier">move_elements</span>[<span class="ruby-value">0</span>]
+ <span class="ruby-identifier">destination_name</span> = <span class="ruby-identifier">move_elements</span>[<span class="ruby-value">-1</span>]
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">destination_name</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">2</span> <span class="ruby-keyword kw">and</span>
+ <span class="ruby-identifier">destination_name</span>[<span class="ruby-value">-2</span>,<span class="ruby-value">2</span>] <span class="ruby-operator">==</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">centre</span>.<span class="ruby-identifier">place</span>[<span class="ruby-value">-2</span>,<span class="ruby-value">2</span>]
+ <span class="ruby-identifier">destination_name</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">centre</span>.<span class="ruby-identifier">place</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-value str">"Invalid piece in move read"</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">piece_name</span>)
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-value str">"Invalid destination in move read"</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">destination_name</span>)
+ <span class="ruby-comment cmt"># Deal with the synonyms for the centre position</span>
+ <span class="ruby-identifier">via_base</span> = (<span class="ruby-identifier">destination_name</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">move_elements</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">2</span>)
+ <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-identifier">piece_name</span>], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-identifier">destination_name</span>], <span class="ruby-identifier">via_base</span>)
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_move (String)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 513</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_move</span>(<span class="ruby-identifier">game</span>)
+ <span class="ruby-identifier">move_elements</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">downcase</span>.<span class="ruby-identifier">split</span>
+ <span class="ruby-identifier">piece_name</span> = <span class="ruby-identifier">move_elements</span>[<span class="ruby-value">0</span>]
+ <span class="ruby-identifier">destination_name</span> = <span class="ruby-identifier">move_elements</span>[<span class="ruby-value">-1</span>]
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">destination_name</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">2</span> <span class="ruby-keyword kw">and</span>
+ <span class="ruby-identifier">destination_name</span>[<span class="ruby-value">-2</span>,<span class="ruby-value">2</span>] <span class="ruby-operator">==</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">centre</span>.<span class="ruby-identifier">place</span>[<span class="ruby-value">-2</span>,<span class="ruby-value">2</span>]
+ <span class="ruby-identifier">destination_name</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">centre</span>.<span class="ruby-identifier">place</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-value str">"Invalid piece in move read"</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">piece_name</span>)
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-value str">"Invalid destination in move read"</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">destination_name</span>)
+ <span class="ruby-comment cmt"># Deal with the synonyms for the centre position</span>
+ <span class="ruby-identifier">via_base</span> = (<span class="ruby-identifier">destination_name</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">move_elements</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">2</span>)
+ <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-identifier">piece_name</span>], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-identifier">destination_name</span>], <span class="ruby-identifier">via_base</span>)
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_move (String)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 495</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_move</span>(<span class="ruby-identifier">game</span>)
+ <span class="ruby-identifier">move_elements</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">downcase</span>.<span class="ruby-identifier">split</span>
+ <span class="ruby-identifier">piece_name</span> = <span class="ruby-identifier">move_elements</span>[<span class="ruby-value">0</span>]
+ <span class="ruby-identifier">destination_name</span> = <span class="ruby-identifier">move_elements</span>[<span class="ruby-value">-1</span>]
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">destination_name</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">2</span> <span class="ruby-keyword kw">and</span>
+ <span class="ruby-identifier">destination_name</span>[<span class="ruby-value">-2</span>,<span class="ruby-value">2</span>] <span class="ruby-operator">==</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">centre</span>.<span class="ruby-identifier">place</span>[<span class="ruby-value">-2</span>,<span class="ruby-value">2</span>]
+ <span class="ruby-identifier">destination_name</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">centre</span>.<span class="ruby-identifier">place</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-value str">"Invalid piece in move read"</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">piece_name</span>)
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-value str">"Invalid destination in move read"</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">destination_name</span>)
+ <span class="ruby-comment cmt"># Deal with the synonyms for the centre position</span>
+ <span class="ruby-identifier">via_base</span> = (<span class="ruby-identifier">destination_name</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">move_elements</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">2</span>)
+ <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-identifier">piece_name</span>], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-identifier">destination_name</span>], <span class="ruby-identifier">via_base</span>)
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>to_move (String)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File lib/libttc.rb, line 591</span>
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_move</span>(<span class="ruby-identifier">game</span>)
+ <span class="ruby-identifier">move_elements</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">downcase</span>.<span class="ruby-identifier">split</span>
+ <span class="ruby-identifier">piece_name</span> = <span class="ruby-identifier">move_elements</span>[<span class="ruby-value">0</span>]
+ <span class="ruby-identifier">destination_name</span> = <span class="ruby-identifier">move_elements</span>[<span class="ruby-value">-1</span>]
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">destination_name</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">2</span> <span class="ruby-keyword kw">and</span>
+ <span class="ruby-identifier">destination_name</span>[<span class="ruby-value">-2</span>,<span class="ruby-value">2</span>] <span class="ruby-operator">==</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">centre</span>.<span class="ruby-identifier">place</span>[<span class="ruby-value">-2</span>,<span class="ruby-value">2</span>]
+ <span class="ruby-identifier">destination_name</span> = <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">centre</span>.<span class="ruby-identifier">place</span>
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-value str">"Invalid piece in move read"</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">piece_name</span>)
+ <span class="ruby-identifier">raise</span>(<span class="ruby-constant">InvalidMoveError</span>, <span class="ruby-value str">"Invalid destination in move read"</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">destination_name</span>)
+ <span class="ruby-comment cmt"># Deal with the synonyms for the centre position</span>
+ <span class="ruby-identifier">via_base</span> = (<span class="ruby-identifier">destination_name</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">==</span> <span class="ruby-value">1</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">move_elements</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">></span> <span class="ruby-value">2</span>)
+ <span class="ruby-constant">Move</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">game</span>.<span class="ruby-identifier">pieces</span>[<span class="ruby-identifier">piece_name</span>], <span class="ruby-identifier">game</span>.<span class="ruby-identifier">board</span>.<span class="ruby-identifier">positions</span>[<span class="ruby-identifier">destination_name</span>], <span class="ruby-identifier">via_base</span>)
+ <span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+Wed, 23 Apr 2008 20:33:07 +0100
--- /dev/null
+K 25
+svn:wc:ra_dav:version-url
+V 48
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/files
+END
+main_rb.html
+K 25
+svn:wc:ra_dav:version-url
+V 61
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/files/main_rb.html
+END
--- /dev/null
+8
+
+dir
+68
+http://scripts.njae.me.uk/svn/njae/TrapTheCap/trunk/doc/files
+http://scripts.njae.me.uk/svn/njae
+
+
+
+2008-10-16T14:11:23.436422Z
+41
+neil
+
+
+svn:special svn:externals svn:needs-lock
+
+
+
+
+
+
+
+
+
+
+
+0ada9808-85ab-4924-adda-5bf89eae3818
+\f
+test
+dir
+\f
+lib
+dir
+\f
+src
+dir
+\f
+main_rb.html
+file
+
+
+
+
+2008-04-23T19:12:55.000000Z
+8533a2e395b529f6f6cffea4bca55f81
+2008-10-16T14:11:23.436422Z
+41
+\f
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>File: main.rb</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="fileHeader">
+ <h1>main.rb</h1>
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Path:</strong></td>
+ <td>main.rb
+ </td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>Last Update:</strong></td>
+ <td>Fri Apr 18 16:35:11 +0100 2008</td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+
+ <div id="requires-list">
+ <h3 class="section-bar">Required files</h3>
+
+ <div class="name-list">
+ <a href="src/play_rb.html">src/play</a>
+ <a href="src/selection_rb.html">src/selection</a>
+ </div>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+K 25
+svn:wc:ra_dav:version-url
+V 52
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/files/lib
+END
+libttc_rb.html
+K 25
+svn:wc:ra_dav:version-url
+V 67
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/files/lib/libttc_rb.html
+END
+libpplayer_rb.html
+K 25
+svn:wc:ra_dav:version-url
+V 71
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/files/lib/libpplayer_rb.html
+END
+main_rb.html
+K 25
+svn:wc:ra_dav:version-url
+V 65
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/files/lib/main_rb.html
+END
+libgenetics_rb.html
+K 25
+svn:wc:ra_dav:version-url
+V 72
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/files/lib/libgenetics_rb.html
+END
--- /dev/null
+8
+
+dir
+68
+http://scripts.njae.me.uk/svn/njae/TrapTheCap/trunk/doc/files/lib
+http://scripts.njae.me.uk/svn/njae
+
+
+
+2008-10-16T14:11:23.436422Z
+41
+neil
+
+
+svn:special svn:externals svn:needs-lock
+
+
+
+
+
+
+
+
+
+
+
+0ada9808-85ab-4924-adda-5bf89eae3818
+\f
+libttc_rb.html
+file
+
+
+
+
+2008-03-28T15:44:42.000000Z
+2c89b18d16593fd3d4929dde5513b80b
+2008-10-16T14:11:23.436422Z
+41
+neil
+\f
+libpplayer_rb.html
+file
+
+
+
+
+2008-04-23T19:33:08.000000Z
+f3cb337746afa0964b387d117dc9fc52
+2008-10-16T14:11:23.436422Z
+41
+\f
+main_rb.html
+file
+
+
+
+
+2008-03-25T11:48:00.000000Z
+a162380b5d5bb9335017066ddb06016a
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+libgenetics_rb.html
+file
+
+
+
+
+2008-04-23T19:33:08.000000Z
+f7083efb84c5691d9f45473ff09c2f77
+2008-10-16T14:11:23.436422Z
+41
+\f
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>File: libgenetics.rb</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="fileHeader">
+ <h1>libgenetics.rb</h1>
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Path:</strong></td>
+ <td>lib/libgenetics.rb
+ </td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>Last Update:</strong></td>
+ <td>Wed Apr 23 20:32:33 +0100 2008</td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <h2>Synopsis</h2>
+<p>
+Library to support genetic algorithms
+</p>
+<h2>Author</h2>
+<p>
+Neil Smith
+</p>
+<h2>Change history</h2>
+<table>
+<tr><td valign="top">Version 1.1:</td><td>23 April 2008
+
+</td></tr>
+</table>
+
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>File: libpplayer.rb</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="fileHeader">
+ <h1>libpplayer.rb</h1>
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Path:</strong></td>
+ <td>lib/libpplayer.rb
+ </td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>Last Update:</strong></td>
+ <td>Wed Apr 23 20:33:01 +0100 2008</td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <h2>Synopsis</h2>
+<p>
+Library to support a Trap the Cap player that uses potentials to select the
+best move
+</p>
+<h2>Author</h2>
+<p>
+Neil Smith
+</p>
+<h2>Change history</h2>
+<table>
+<tr><td valign="top">Version 1.1:</td><td>23 April 2008
+
+</td></tr>
+</table>
+
+ </div>
+
+ <div id="requires-list">
+ <h3 class="section-bar">Required files</h3>
+
+ <div class="name-list">
+ lib/libttc
+ <a href="libgenetics_rb.html">lib/libgenetics</a>
+ </div>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>File: libttc.rb</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="fileHeader">
+ <h1>libttc.rb</h1>
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Path:</strong></td>
+ <td>lib/libttc.rb
+ </td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>Last Update:</strong></td>
+ <td>Thu Mar 27 16:06:40 +0000 2008</td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <h2>Synopsis</h2>
+<p>
+Library to support Trap the Cap play
+</p>
+<h2>Author</h2>
+<p>
+Neil Smith
+</p>
+<p>
+This program is free software: you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the Free
+Software Foundation, either version 3 of the License, or (at your option)
+any later version.
+</p>
+<p>
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+more details.
+</p>
+<p>
+You should have received a copy of the GNU General Public License along
+with this program. If not, see <<a
+href="http://www.gnu.org/licenses">www.gnu.org/licenses</a>/>.
+</p>
+<h2>Change history</h2>
+<table>
+<tr><td valign="top">Version 1.1:</td><td>07 Sep 2007
+
+<ul>
+<li>Changed format for showing moves via bases.
+
+</li>
+<li>Raise error when moving via base without captured pieces
+
+</li>
+<li>Raise error when moving onto a safe space with 3 or more pieces already
+there
+
+</li>
+</ul>
+</td></tr>
+<tr><td valign="top">Version 1.2:</td><td>10 Sep 2007
+
+<ul>
+<li>Incorporated changes in move legality above into <a
+href="../../classes/Game.html#M000041">Game#possible_moves</a>
+
+</li>
+</ul>
+</td></tr>
+<tr><td valign="top">Version 1.3:</td><td>25 Mar 2008
+
+<ul>
+<li>Fixed bug to detect a winner, and also eliminate players that have no
+uncaptured pieces.
+
+</li>
+</ul>
+</td></tr>
+</table>
+
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>File: main.rb</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="fileHeader">
+ <h1>main.rb</h1>
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Path:</strong></td>
+ <td>lib/main.rb
+ </td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>Last Update:</strong></td>
+ <td>Tue Mar 25 11:38:01 +0000 2008</td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <p>
+To change this template, choose Tools | Templates and open the template in
+the editor.
+</p>
+
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>File: libgenetics.rb</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="fileHeader">
+ <h1>libgenetics.rb</h1>
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Path:</strong></td>
+ <td>lib/libgenetics.rb
+ </td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>Last Update:</strong></td>
+ <td>Wed Apr 23 20:32:33 +0100 2008</td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <h2>Synopsis</h2>
+<p>
+Library to support genetic algorithms
+</p>
+<h2>Author</h2>
+<p>
+Neil Smith
+</p>
+<h2>Change history</h2>
+<table>
+<tr><td valign="top">Version 1.1:</td><td>23 April 2008
+
+</td></tr>
+</table>
+
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>File: libpplayer.rb</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="fileHeader">
+ <h1>libpplayer.rb</h1>
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Path:</strong></td>
+ <td>lib/libpplayer.rb
+ </td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>Last Update:</strong></td>
+ <td>Wed Apr 23 20:33:01 +0100 2008</td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <h2>Synopsis</h2>
+<p>
+Library to support a Trap the Cap player that uses potentials to select the
+best move
+</p>
+<h2>Author</h2>
+<p>
+Neil Smith
+</p>
+<h2>Change history</h2>
+<table>
+<tr><td valign="top">Version 1.1:</td><td>23 April 2008
+
+</td></tr>
+</table>
+
+ </div>
+
+ <div id="requires-list">
+ <h3 class="section-bar">Required files</h3>
+
+ <div class="name-list">
+ lib/libttc
+ <a href="libgenetics_rb.html">lib/libgenetics</a>
+ </div>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>File: libttc.rb</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="fileHeader">
+ <h1>libttc.rb</h1>
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Path:</strong></td>
+ <td>lib/libttc.rb
+ </td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>Last Update:</strong></td>
+ <td>Thu Mar 27 16:06:40 +0000 2008</td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <h2>Synopsis</h2>
+<p>
+Library to support Trap the Cap play
+</p>
+<h2>Author</h2>
+<p>
+Neil Smith
+</p>
+<p>
+This program is free software: you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the Free
+Software Foundation, either version 3 of the License, or (at your option)
+any later version.
+</p>
+<p>
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+more details.
+</p>
+<p>
+You should have received a copy of the GNU General Public License along
+with this program. If not, see <<a
+href="http://www.gnu.org/licenses">www.gnu.org/licenses</a>/>.
+</p>
+<h2>Change history</h2>
+<table>
+<tr><td valign="top">Version 1.1:</td><td>07 Sep 2007
+
+<ul>
+<li>Changed format for showing moves via bases.
+
+</li>
+<li>Raise error when moving via base without captured pieces
+
+</li>
+<li>Raise error when moving onto a safe space with 3 or more pieces already
+there
+
+</li>
+</ul>
+</td></tr>
+<tr><td valign="top">Version 1.2:</td><td>10 Sep 2007
+
+<ul>
+<li>Incorporated changes in move legality above into <a
+href="../../classes/Game.html#M000041">Game#possible_moves</a>
+
+</li>
+</ul>
+</td></tr>
+<tr><td valign="top">Version 1.3:</td><td>25 Mar 2008
+
+<ul>
+<li>Fixed bug to detect a winner, and also eliminate players that have no
+uncaptured pieces.
+
+</li>
+</ul>
+</td></tr>
+</table>
+
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>File: main.rb</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="fileHeader">
+ <h1>main.rb</h1>
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Path:</strong></td>
+ <td>lib/main.rb
+ </td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>Last Update:</strong></td>
+ <td>Tue Mar 25 11:38:01 +0000 2008</td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <p>
+To change this template, choose Tools | Templates and open the template in
+the editor.
+</p>
+
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>File: main.rb</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="fileHeader">
+ <h1>main.rb</h1>
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Path:</strong></td>
+ <td>main.rb
+ </td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>Last Update:</strong></td>
+ <td>Fri Apr 18 16:35:11 +0100 2008</td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+
+ <div id="requires-list">
+ <h3 class="section-bar">Required files</h3>
+
+ <div class="name-list">
+ <a href="src/play_rb.html">src/play</a>
+ <a href="src/selection_rb.html">src/selection</a>
+ </div>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+K 25
+svn:wc:ra_dav:version-url
+V 52
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/files/src
+END
+ttc_rb.html
+K 25
+svn:wc:ra_dav:version-url
+V 64
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/files/src/ttc_rb.html
+END
+clockwise-p1_rb.html
+K 25
+svn:wc:ra_dav:version-url
+V 73
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/files/src/clockwise-p1_rb.html
+END
+play_rb.html
+K 25
+svn:wc:ra_dav:version-url
+V 65
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/files/src/play_rb.html
+END
+selection_rb.html
+K 25
+svn:wc:ra_dav:version-url
+V 70
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/files/src/selection_rb.html
+END
+clockwise-cloud_rb.html
+K 25
+svn:wc:ra_dav:version-url
+V 76
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/files/src/clockwise-cloud_rb.html
+END
--- /dev/null
+8
+
+dir
+68
+http://scripts.njae.me.uk/svn/njae/TrapTheCap/trunk/doc/files/src
+http://scripts.njae.me.uk/svn/njae
+
+
+
+2008-10-16T14:11:23.436422Z
+41
+neil
+
+
+svn:special svn:externals svn:needs-lock
+
+
+
+
+
+
+
+
+
+
+
+0ada9808-85ab-4924-adda-5bf89eae3818
+\f
+clockwise-cloud_rb.src
+dir
+\f
+ttc_rb.html
+file
+
+
+
+
+2008-03-25T11:48:00.000000Z
+cfdcf2338281c75233dd289ff30a6f6d
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+clockwise-p1_rb.html
+file
+
+
+
+
+2008-03-25T11:48:00.000000Z
+7cff2abe6c45d314ada57ad526923065
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+clockwise-p1_rb.src
+dir
+\f
+play_rb.html
+file
+
+
+
+
+2008-04-23T19:33:07.000000Z
+84c21cf0058efa8f08e5f5deafa5f649
+2008-10-16T14:11:23.436422Z
+41
+\f
+selection_rb.html
+file
+
+
+
+
+2008-04-23T19:33:08.000000Z
+89fe891785af82f906da594cc0fe7566
+2008-10-16T14:11:23.436422Z
+41
+\f
+clockwise-cloud_rb.html
+file
+
+
+
+
+2008-03-25T11:48:00.000000Z
+84d08f5c1677571581fe800b6b074b25
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>File: clockwise-cloud.rb</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="fileHeader">
+ <h1>clockwise-cloud.rb</h1>
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Path:</strong></td>
+ <td>src/clockwise-cloud.rb
+ </td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>Last Update:</strong></td>
+ <td>Fri Aug 31 20:04:34 +0100 2007</td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <h2>Synopsis</h2>
+<p>
+Play one move of a Trap the Cap game
+</p>
+<h2>Usage</h2>
+<p>
+clockwise-p1
+</p>
+<pre>
+ Game state file read on STDIN
+ Move produced on STDOUT
+</pre>
+<h2>Author</h2>
+<p>
+Neil Smith
+</p>
+<p>
+This program is free software: you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the Free
+Software Foundation, either version 3 of the License, or (at your option)
+any later version.
+</p>
+<p>
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+more details.
+</p>
+<p>
+You should have received a copy of the GNU General Public License along
+with this program. If not, see <<a
+href="http://www.gnu.org/licenses">www.gnu.org/licenses</a>/>.
+</p>
+
+ </div>
+
+ <div id="requires-list">
+ <h3 class="section-bar">Required files</h3>
+
+ <div class="name-list">
+ libttc
+ </div>
+ </div>
+
+ </div>
+
+ <div id="method-list">
+ <h3 class="section-bar">Methods</h3>
+
+ <div class="name-list">
+ <a href="#M000001">more_clockwise</a>
+ </div>
+ </div>
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+ <div id="methods">
+ <h3 class="section-bar">Public Instance methods</h3>
+
+ <div id="method-M000001" class="method-detail">
+ <a name="M000001"></a>
+
+ <div class="method-heading">
+ <a href="clockwise-cloud_rb.src/M000001.html" target="Code" class="method-signature"
+ onclick="popupCode('clockwise-cloud_rb.src/M000001.html');return false;">
+ <span class="method-name">more_clockwise</span><span class="method-args">(this, other)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>File: clockwise-p1.rb</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="fileHeader">
+ <h1>clockwise-p1.rb</h1>
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Path:</strong></td>
+ <td>src/clockwise-p1.rb
+ </td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>Last Update:</strong></td>
+ <td>Fri Aug 31 12:19:53 +0100 2007</td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <h2>Synopsis</h2>
+<p>
+Play one move of a Trap the Cap game
+</p>
+<h2>Usage</h2>
+<p>
+clockwise-p1
+</p>
+<pre>
+ Game state file read on STDIN
+ Move produced on STDOUT
+</pre>
+<h2>Author</h2>
+<p>
+Neil Smith
+</p>
+
+ </div>
+
+ <div id="requires-list">
+ <h3 class="section-bar">Required files</h3>
+
+ <div class="name-list">
+ libttc
+ rdoc/usage
+ </div>
+ </div>
+
+ </div>
+
+ <div id="method-list">
+ <h3 class="section-bar">Methods</h3>
+
+ <div class="name-list">
+ <a href="#M000002">more_clockwise</a>
+ </div>
+ </div>
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+ <div id="methods">
+ <h3 class="section-bar">Public Instance methods</h3>
+
+ <div id="method-M000002" class="method-detail">
+ <a name="M000002"></a>
+
+ <div class="method-heading">
+ <a href="clockwise-p1_rb.src/M000002.html" target="Code" class="method-signature"
+ onclick="popupCode('clockwise-p1_rb.src/M000002.html');return false;">
+ <span class="method-name">more_clockwise</span><span class="method-args">(this, other)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>File: play.rb</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="fileHeader">
+ <h1>play.rb</h1>
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Path:</strong></td>
+ <td>src/play.rb
+ </td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>Last Update:</strong></td>
+ <td>Wed Apr 23 20:32:54 +0100 2008</td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <h2>Synopsis</h2>
+<p>
+Play a game of Trap the Cap.
+</p>
+<h2>Author</h2>
+<p>
+Neil Smith
+</p>
+<h2>Change history</h2>
+<table>
+<tr><td valign="top">Version 1.1:</td><td>23 April 2008
+
+</td></tr>
+</table>
+
+ </div>
+
+ <div id="requires-list">
+ <h3 class="section-bar">Required files</h3>
+
+ <div class="name-list">
+ lib/libttc
+ <a href="../lib/libpplayer_rb.html">lib/libpplayer</a>
+ </div>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>File: selection.rb</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="fileHeader">
+ <h1>selection.rb</h1>
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Path:</strong></td>
+ <td>src/selection.rb
+ </td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>Last Update:</strong></td>
+ <td>Wed Apr 23 20:32:29 +0100 2008</td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <h2>Synopsis</h2>
+<p>
+Use a GA to breed a good potential player
+</p>
+<h2>Author</h2>
+<p>
+Neil Smith
+</p>
+<h2>Change history</h2>
+<table>
+<tr><td valign="top">Version 1.1:</td><td>23 April 2008
+
+</td></tr>
+</table>
+
+ </div>
+
+ <div id="requires-list">
+ <h3 class="section-bar">Required files</h3>
+
+ <div class="name-list">
+ lib/libttc
+ <a href="../lib/libpplayer_rb.html">lib/libpplayer</a>
+ <a href="../lib/libgenetics_rb.html">lib/libgenetics</a>
+ <a href="play_rb.html">src/play</a>
+ </div>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>File: ttc.rb</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="fileHeader">
+ <h1>ttc.rb</h1>
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Path:</strong></td>
+ <td>src/ttc.rb
+ </td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>Last Update:</strong></td>
+ <td>Tue Mar 25 11:46:58 +0000 2008</td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <h2>Synopsis</h2>
+<p>
+Play one move of a Trap the Cap game
+</p>
+<h2>Usage</h2>
+<p>
+ttc [ -b | —board-size SIZE ] [ -i | —input FILE ] [ -r |
+—robot ROBOT ] [ -h | —help ]
+</p>
+<h2>Author</h2>
+<p>
+Neil Smith
+</p>
+
+ </div>
+
+ <div id="requires-list">
+ <h3 class="section-bar">Required files</h3>
+
+ <div class="name-list">
+ open3
+ timeout
+ optparse
+ rdoc/usage
+ </div>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>File: clockwise-cloud.rb</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="fileHeader">
+ <h1>clockwise-cloud.rb</h1>
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Path:</strong></td>
+ <td>src/clockwise-cloud.rb
+ </td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>Last Update:</strong></td>
+ <td>Fri Aug 31 20:04:34 +0100 2007</td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <h2>Synopsis</h2>
+<p>
+Play one move of a Trap the Cap game
+</p>
+<h2>Usage</h2>
+<p>
+clockwise-p1
+</p>
+<pre>
+ Game state file read on STDIN
+ Move produced on STDOUT
+</pre>
+<h2>Author</h2>
+<p>
+Neil Smith
+</p>
+<p>
+This program is free software: you can redistribute it and/or modify it
+under the terms of the GNU General Public License as published by the Free
+Software Foundation, either version 3 of the License, or (at your option)
+any later version.
+</p>
+<p>
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+more details.
+</p>
+<p>
+You should have received a copy of the GNU General Public License along
+with this program. If not, see <<a
+href="http://www.gnu.org/licenses">www.gnu.org/licenses</a>/>.
+</p>
+
+ </div>
+
+ <div id="requires-list">
+ <h3 class="section-bar">Required files</h3>
+
+ <div class="name-list">
+ libttc
+ </div>
+ </div>
+
+ </div>
+
+ <div id="method-list">
+ <h3 class="section-bar">Methods</h3>
+
+ <div class="name-list">
+ <a href="#M000001">more_clockwise</a>
+ </div>
+ </div>
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+ <div id="methods">
+ <h3 class="section-bar">Public Instance methods</h3>
+
+ <div id="method-M000001" class="method-detail">
+ <a name="M000001"></a>
+
+ <div class="method-heading">
+ <a href="clockwise-cloud_rb.src/M000001.html" target="Code" class="method-signature"
+ onclick="popupCode('clockwise-cloud_rb.src/M000001.html');return false;">
+ <span class="method-name">more_clockwise</span><span class="method-args">(this, other)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+K 25
+svn:wc:ra_dav:version-url
+V 75
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/files/src/clockwise-cloud_rb.src
+END
+M000001.html
+K 25
+svn:wc:ra_dav:version-url
+V 88
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/files/src/clockwise-cloud_rb.src/M000001.html
+END
--- /dev/null
+8
+
+dir
+68
+http://scripts.njae.me.uk/svn/njae/TrapTheCap/trunk/doc/files/src/clockwise-cloud_rb.src
+http://scripts.njae.me.uk/svn/njae
+
+
+
+2008-03-25T12:46:59.166018Z
+23
+neil
+
+
+svn:special svn:externals svn:needs-lock
+\f
+M000001.html
+file
+
+
+
+
+2008-03-25T11:47:59.000000Z
+fad522266e3a910a73d91411620f5ae9
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>more_clockwise (src/clockwise-cloud.rb)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File src/clockwise-cloud.rb, line 31</span>
+<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">more_clockwise</span>(<span class="ruby-identifier">this</span>, <span class="ruby-identifier">other</span>)
+ <span class="ruby-identifier">here</span> = <span class="ruby-identifier">this</span>.<span class="ruby-identifier">place</span>
+ <span class="ruby-identifier">there</span> = <span class="ruby-identifier">other</span>.<span class="ruby-identifier">place</span>
+
+ <span class="ruby-comment cmt"># if both are on a spoke, choose the one with the lowest number (nearer the rim)</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">here</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/.c./</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">there</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/.c./</span>
+ <span class="ruby-comment cmt"># break ties by preferring the most clockwise arc</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">here</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-identifier">there</span>[<span class="ruby-value">-1</span>]
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">here</span>[<span class="ruby-value">0</span>] <span class="ruby-operator"><=></span> <span class="ruby-identifier">there</span>[<span class="ruby-value">0</span>]
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-keyword kw">return</span> <span class="ruby-value">-1</span> <span class="ruby-operator">*</span> (<span class="ruby-identifier">here</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator"><=></span> <span class="ruby-identifier">there</span>[<span class="ruby-value">-1</span>])
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-comment cmt"># If one is one a spoke and the other is on the rim, choose the one on the rim</span>
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">here</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/.c./</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">there</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/.c./</span>
+ <span class="ruby-keyword kw">return</span> <span class="ruby-value">-1</span> <span class="ruby-operator">*</span> (<span class="ruby-identifier">here</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator"><=></span> <span class="ruby-identifier">there</span>.<span class="ruby-identifier">length</span>)
+ <span class="ruby-comment cmt"># If one is in the 'f' rim section and the other in the 'a' rim section, choose the 'a'</span>
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">here</span>[<span class="ruby-value">0</span>,<span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">'a'</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">there</span>[<span class="ruby-value">0</span>,<span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">'f'</span>
+ <span class="ruby-keyword kw">return</span> <span class="ruby-value">+1</span>
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">here</span>[<span class="ruby-value">0</span>,<span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">'f'</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">there</span>[<span class="ruby-value">0</span>,<span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">'a'</span>
+ <span class="ruby-keyword kw">return</span> <span class="ruby-value">-1</span>
+ <span class="ruby-comment cmt"># Otherwise, choose the one with highest arc code</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">here</span> <span class="ruby-operator"><=></span> <span class="ruby-identifier">there</span>
+ <span class="ruby-keyword kw">end</span>
+
+<span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>more_clockwise (src/clockwise-cloud.rb)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File src/clockwise-cloud.rb, line 31</span>
+<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">more_clockwise</span>(<span class="ruby-identifier">this</span>, <span class="ruby-identifier">other</span>)
+ <span class="ruby-identifier">here</span> = <span class="ruby-identifier">this</span>.<span class="ruby-identifier">place</span>
+ <span class="ruby-identifier">there</span> = <span class="ruby-identifier">other</span>.<span class="ruby-identifier">place</span>
+
+ <span class="ruby-comment cmt"># if both are on a spoke, choose the one with the lowest number (nearer the rim)</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">here</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/.c./</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">there</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/.c./</span>
+ <span class="ruby-comment cmt"># break ties by preferring the most clockwise arc</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">here</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-identifier">there</span>[<span class="ruby-value">-1</span>]
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">here</span>[<span class="ruby-value">0</span>] <span class="ruby-operator"><=></span> <span class="ruby-identifier">there</span>[<span class="ruby-value">0</span>]
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-keyword kw">return</span> <span class="ruby-value">-1</span> <span class="ruby-operator">*</span> (<span class="ruby-identifier">here</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator"><=></span> <span class="ruby-identifier">there</span>[<span class="ruby-value">-1</span>])
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-comment cmt"># If one is one a spoke and the other is on the rim, choose the one on the rim</span>
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">here</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/.c./</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">there</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/.c./</span>
+ <span class="ruby-keyword kw">return</span> <span class="ruby-value">-1</span> <span class="ruby-operator">*</span> (<span class="ruby-identifier">here</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator"><=></span> <span class="ruby-identifier">there</span>.<span class="ruby-identifier">length</span>)
+ <span class="ruby-comment cmt"># If one is in the 'f' rim section and the other in the 'a' rim section, choose the 'a'</span>
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">here</span>[<span class="ruby-value">0</span>,<span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">'a'</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">there</span>[<span class="ruby-value">0</span>,<span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">'f'</span>
+ <span class="ruby-keyword kw">return</span> <span class="ruby-value">+1</span>
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">here</span>[<span class="ruby-value">0</span>,<span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">'f'</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">there</span>[<span class="ruby-value">0</span>,<span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">'a'</span>
+ <span class="ruby-keyword kw">return</span> <span class="ruby-value">-1</span>
+ <span class="ruby-comment cmt"># Otherwise, choose the one with highest arc code</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">here</span> <span class="ruby-operator"><=></span> <span class="ruby-identifier">there</span>
+ <span class="ruby-keyword kw">end</span>
+
+<span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>File: clockwise-p1.rb</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="fileHeader">
+ <h1>clockwise-p1.rb</h1>
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Path:</strong></td>
+ <td>src/clockwise-p1.rb
+ </td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>Last Update:</strong></td>
+ <td>Fri Aug 31 12:19:53 +0100 2007</td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <h2>Synopsis</h2>
+<p>
+Play one move of a Trap the Cap game
+</p>
+<h2>Usage</h2>
+<p>
+clockwise-p1
+</p>
+<pre>
+ Game state file read on STDIN
+ Move produced on STDOUT
+</pre>
+<h2>Author</h2>
+<p>
+Neil Smith
+</p>
+
+ </div>
+
+ <div id="requires-list">
+ <h3 class="section-bar">Required files</h3>
+
+ <div class="name-list">
+ libttc
+ rdoc/usage
+ </div>
+ </div>
+
+ </div>
+
+ <div id="method-list">
+ <h3 class="section-bar">Methods</h3>
+
+ <div class="name-list">
+ <a href="#M000002">more_clockwise</a>
+ </div>
+ </div>
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+ <div id="methods">
+ <h3 class="section-bar">Public Instance methods</h3>
+
+ <div id="method-M000002" class="method-detail">
+ <a name="M000002"></a>
+
+ <div class="method-heading">
+ <a href="clockwise-p1_rb.src/M000002.html" target="Code" class="method-signature"
+ onclick="popupCode('clockwise-p1_rb.src/M000002.html');return false;">
+ <span class="method-name">more_clockwise</span><span class="method-args">(this, other)</span>
+ </a>
+ </div>
+
+ <div class="method-description">
+ </div>
+ </div>
+
+
+ </div>
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+K 25
+svn:wc:ra_dav:version-url
+V 72
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/files/src/clockwise-p1_rb.src
+END
+M000002.html
+K 25
+svn:wc:ra_dav:version-url
+V 85
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/files/src/clockwise-p1_rb.src/M000002.html
+END
--- /dev/null
+8
+
+dir
+68
+http://scripts.njae.me.uk/svn/njae/TrapTheCap/trunk/doc/files/src/clockwise-p1_rb.src
+http://scripts.njae.me.uk/svn/njae
+
+
+
+2008-03-25T12:46:59.166018Z
+23
+neil
+
+
+svn:special svn:externals svn:needs-lock
+\f
+M000002.html
+file
+
+
+
+
+2008-03-25T11:47:59.000000Z
+a06f76e237cec1ce328cc97a5084e027
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>more_clockwise (src/clockwise-p1.rb)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File src/clockwise-p1.rb, line 19</span>
+<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">more_clockwise</span>(<span class="ruby-identifier">this</span>, <span class="ruby-identifier">other</span>)
+ <span class="ruby-identifier">here</span> = <span class="ruby-identifier">this</span>.<span class="ruby-identifier">destination</span>.<span class="ruby-identifier">place</span>
+ <span class="ruby-identifier">there</span> = <span class="ruby-identifier">other</span>.<span class="ruby-identifier">destination</span>.<span class="ruby-identifier">place</span>
+
+ <span class="ruby-comment cmt"># if both are on a spoke, choose the one with the lowest number (nearer the rim)</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">here</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/.c./</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">there</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/.c./</span>
+ <span class="ruby-comment cmt"># break ties by preferring the most clockwise arc</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">here</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-identifier">there</span>[<span class="ruby-value">-1</span>]
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">here</span>[<span class="ruby-value">0</span>] <span class="ruby-operator"><=></span> <span class="ruby-identifier">there</span>[<span class="ruby-value">0</span>]
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-keyword kw">return</span> <span class="ruby-value">-1</span> <span class="ruby-operator">*</span> (<span class="ruby-identifier">here</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator"><=></span> <span class="ruby-identifier">there</span>[<span class="ruby-value">-1</span>])
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-comment cmt"># If one is one a spoke and the other is on the rim, choose the one on the rim</span>
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">here</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/.c./</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">there</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/.c./</span>
+ <span class="ruby-keyword kw">return</span> <span class="ruby-value">-1</span> <span class="ruby-operator">*</span> (<span class="ruby-identifier">here</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator"><=></span> <span class="ruby-identifier">there</span>.<span class="ruby-identifier">length</span>)
+ <span class="ruby-comment cmt"># If one is in the 'f' rim section and the other in the 'a' rim section, choose the 'a'</span>
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">here</span>[<span class="ruby-value">0</span>,<span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">'a'</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">there</span>[<span class="ruby-value">0</span>,<span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">'f'</span>
+ <span class="ruby-keyword kw">return</span> <span class="ruby-value">+1</span>
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">here</span>[<span class="ruby-value">0</span>,<span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">'f'</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">there</span>[<span class="ruby-value">0</span>,<span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">'a'</span>
+ <span class="ruby-keyword kw">return</span> <span class="ruby-value">-1</span>
+ <span class="ruby-comment cmt"># Otherwise, choose the one with highest arc code</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">here</span> <span class="ruby-operator"><=></span> <span class="ruby-identifier">there</span>
+ <span class="ruby-keyword kw">end</span>
+
+<span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html>
+<head>
+ <title>more_clockwise (src/clockwise-p1.rb)</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
+</head>
+<body class="standalone-code">
+ <pre><span class="ruby-comment cmt"># File src/clockwise-p1.rb, line 19</span>
+<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">more_clockwise</span>(<span class="ruby-identifier">this</span>, <span class="ruby-identifier">other</span>)
+ <span class="ruby-identifier">here</span> = <span class="ruby-identifier">this</span>.<span class="ruby-identifier">destination</span>.<span class="ruby-identifier">place</span>
+ <span class="ruby-identifier">there</span> = <span class="ruby-identifier">other</span>.<span class="ruby-identifier">destination</span>.<span class="ruby-identifier">place</span>
+
+ <span class="ruby-comment cmt"># if both are on a spoke, choose the one with the lowest number (nearer the rim)</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">here</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/.c./</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">there</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/.c./</span>
+ <span class="ruby-comment cmt"># break ties by preferring the most clockwise arc</span>
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">here</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator">==</span> <span class="ruby-identifier">there</span>[<span class="ruby-value">-1</span>]
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">here</span>[<span class="ruby-value">0</span>] <span class="ruby-operator"><=></span> <span class="ruby-identifier">there</span>[<span class="ruby-value">0</span>]
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-keyword kw">return</span> <span class="ruby-value">-1</span> <span class="ruby-operator">*</span> (<span class="ruby-identifier">here</span>[<span class="ruby-value">-1</span>] <span class="ruby-operator"><=></span> <span class="ruby-identifier">there</span>[<span class="ruby-value">-1</span>])
+ <span class="ruby-keyword kw">end</span>
+ <span class="ruby-comment cmt"># If one is one a spoke and the other is on the rim, choose the one on the rim</span>
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">here</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/.c./</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">there</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/.c./</span>
+ <span class="ruby-keyword kw">return</span> <span class="ruby-value">-1</span> <span class="ruby-operator">*</span> (<span class="ruby-identifier">here</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator"><=></span> <span class="ruby-identifier">there</span>.<span class="ruby-identifier">length</span>)
+ <span class="ruby-comment cmt"># If one is in the 'f' rim section and the other in the 'a' rim section, choose the 'a'</span>
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">here</span>[<span class="ruby-value">0</span>,<span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">'a'</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">there</span>[<span class="ruby-value">0</span>,<span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">'f'</span>
+ <span class="ruby-keyword kw">return</span> <span class="ruby-value">+1</span>
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">here</span>[<span class="ruby-value">0</span>,<span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">'f'</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">there</span>[<span class="ruby-value">0</span>,<span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-value str">'a'</span>
+ <span class="ruby-keyword kw">return</span> <span class="ruby-value">-1</span>
+ <span class="ruby-comment cmt"># Otherwise, choose the one with highest arc code</span>
+ <span class="ruby-keyword kw">else</span>
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">here</span> <span class="ruby-operator"><=></span> <span class="ruby-identifier">there</span>
+ <span class="ruby-keyword kw">end</span>
+
+<span class="ruby-keyword kw">end</span></pre>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>File: play.rb</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="fileHeader">
+ <h1>play.rb</h1>
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Path:</strong></td>
+ <td>src/play.rb
+ </td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>Last Update:</strong></td>
+ <td>Wed Apr 23 20:32:54 +0100 2008</td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <h2>Synopsis</h2>
+<p>
+Play a game of Trap the Cap.
+</p>
+<h2>Author</h2>
+<p>
+Neil Smith
+</p>
+<h2>Change history</h2>
+<table>
+<tr><td valign="top">Version 1.1:</td><td>23 April 2008
+
+</td></tr>
+</table>
+
+ </div>
+
+ <div id="requires-list">
+ <h3 class="section-bar">Required files</h3>
+
+ <div class="name-list">
+ lib/libttc
+ <a href="../lib/libpplayer_rb.html">lib/libpplayer</a>
+ </div>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>File: selection.rb</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="fileHeader">
+ <h1>selection.rb</h1>
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Path:</strong></td>
+ <td>src/selection.rb
+ </td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>Last Update:</strong></td>
+ <td>Wed Apr 23 20:32:29 +0100 2008</td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <h2>Synopsis</h2>
+<p>
+Use a GA to breed a good potential player
+</p>
+<h2>Author</h2>
+<p>
+Neil Smith
+</p>
+<h2>Change history</h2>
+<table>
+<tr><td valign="top">Version 1.1:</td><td>23 April 2008
+
+</td></tr>
+</table>
+
+ </div>
+
+ <div id="requires-list">
+ <h3 class="section-bar">Required files</h3>
+
+ <div class="name-list">
+ lib/libttc
+ <a href="../lib/libpplayer_rb.html">lib/libpplayer</a>
+ <a href="../lib/libgenetics_rb.html">lib/libgenetics</a>
+ <a href="play_rb.html">src/play</a>
+ </div>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>File: ttc.rb</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="fileHeader">
+ <h1>ttc.rb</h1>
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Path:</strong></td>
+ <td>src/ttc.rb
+ </td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>Last Update:</strong></td>
+ <td>Tue Mar 25 11:46:58 +0000 2008</td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <h2>Synopsis</h2>
+<p>
+Play one move of a Trap the Cap game
+</p>
+<h2>Usage</h2>
+<p>
+ttc [ -b | —board-size SIZE ] [ -i | —input FILE ] [ -r |
+—robot ROBOT ] [ -h | —help ]
+</p>
+<h2>Author</h2>
+<p>
+Neil Smith
+</p>
+
+ </div>
+
+ <div id="requires-list">
+ <h3 class="section-bar">Required files</h3>
+
+ <div class="name-list">
+ open3
+ timeout
+ optparse
+ rdoc/usage
+ </div>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+K 25
+svn:wc:ra_dav:version-url
+V 53
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/files/test
+END
+libttc_test_rb.html
+K 25
+svn:wc:ra_dav:version-url
+V 73
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/doc/files/test/libttc_test_rb.html
+END
+game-test_rb.html
+K 25
+svn:wc:ra_dav:version-url
+V 71
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/doc/files/test/game-test_rb.html
+END
--- /dev/null
+8
+
+dir
+68
+http://scripts.njae.me.uk/svn/njae/TrapTheCap/trunk/doc/files/test
+http://scripts.njae.me.uk/svn/njae
+
+
+
+2008-10-16T14:11:23.436422Z
+41
+neil
+
+
+svn:special svn:externals svn:needs-lock
+
+
+
+
+
+
+
+
+
+
+
+0ada9808-85ab-4924-adda-5bf89eae3818
+\f
+libttc_test_rb.html
+file
+
+
+
+
+2008-03-28T15:44:42.000000Z
+b48377e2e4dc19c1515aff86b65339d7
+2008-10-16T14:11:23.436422Z
+41
+\f
+game-test_rb.html
+file
+
+
+
+
+2008-03-25T11:48:00.000000Z
+614083683ed97a5066c4af451fd873d7
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>File: game-test.rb</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="fileHeader">
+ <h1>game-test.rb</h1>
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Path:</strong></td>
+ <td>test/game-test.rb
+ </td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>Last Update:</strong></td>
+ <td>Thu Aug 09 14:55:47 +0100 2007</td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <p>
+test/game_test.rb
+</p>
+
+ </div>
+
+ <div id="requires-list">
+ <h3 class="section-bar">Required files</h3>
+
+ <div class="name-list">
+ test/unit
+ </div>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>File: libttc_test.rb</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="fileHeader">
+ <h1>libttc_test.rb</h1>
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Path:</strong></td>
+ <td>test/libttc_test.rb
+ </td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>Last Update:</strong></td>
+ <td>Wed Mar 26 13:52:59 +0000 2008</td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <p>
+test/game_test.rb
+</p>
+
+ </div>
+
+ <div id="requires-list">
+ <h3 class="section-bar">Required files</h3>
+
+ <div class="name-list">
+ test/unit
+ </div>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>File: game-test.rb</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="fileHeader">
+ <h1>game-test.rb</h1>
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Path:</strong></td>
+ <td>test/game-test.rb
+ </td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>Last Update:</strong></td>
+ <td>Thu Aug 09 14:55:47 +0100 2007</td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <p>
+test/game_test.rb
+</p>
+
+ </div>
+
+ <div id="requires-list">
+ <h3 class="section-bar">Required files</h3>
+
+ <div class="name-list">
+ test/unit
+ </div>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>File: libttc_test.rb</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
+ <script type="text/javascript">
+ // <![CDATA[
+
+ function popupCode( url ) {
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
+ }
+
+ function toggleCode( id ) {
+ if ( document.getElementById )
+ elem = document.getElementById( id );
+ else if ( document.all )
+ elem = eval( "document.all." + id );
+ else
+ return false;
+
+ elemStyle = elem.style;
+
+ if ( elemStyle.display != "block" ) {
+ elemStyle.display = "block"
+ } else {
+ elemStyle.display = "none"
+ }
+
+ return true;
+ }
+
+ // Make codeblocks hidden by default
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
+
+ // ]]>
+ </script>
+
+</head>
+<body>
+
+
+
+ <div id="fileHeader">
+ <h1>libttc_test.rb</h1>
+ <table class="header-table">
+ <tr class="top-aligned-row">
+ <td><strong>Path:</strong></td>
+ <td>test/libttc_test.rb
+ </td>
+ </tr>
+ <tr class="top-aligned-row">
+ <td><strong>Last Update:</strong></td>
+ <td>Wed Mar 26 13:52:59 +0000 2008</td>
+ </tr>
+ </table>
+ </div>
+ <!-- banner header -->
+
+ <div id="bodyContent">
+
+
+
+ <div id="contextContent">
+
+ <div id="description">
+ <p>
+test/game_test.rb
+</p>
+
+ </div>
+
+ <div id="requires-list">
+ <h3 class="section-bar">Required files</h3>
+
+ <div class="name-list">
+ test/unit
+ </div>
+ </div>
+
+ </div>
+
+
+ </div>
+
+
+ <!-- if includes -->
+
+ <div id="section">
+
+
+
+
+
+
+
+
+ <!-- if method_list -->
+
+
+ </div>
+
+
+<div id="validator-badges">
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
+</div>
+
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<!--
+
+ Classes
+
+ -->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Classes</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="rdoc-style.css" type="text/css" />
+ <base target="docwin" />
+</head>
+<body>
+<div id="index">
+ <h1 class="section-bar">Classes</h1>
+ <div id="index-entries">
+ <a href="classes/Array.html">Array</a><br />
+ <a href="classes/Fixnum.html">Fixnum</a><br />
+ <a href="classes/GameHandler.html">GameHandler</a><br />
+ <a href="classes/Genome.html">Genome</a><br />
+ <a href="classes/Population.html">Population</a><br />
+ <a href="classes/Potential_player.html">Potential_player</a><br />
+ </div>
+</div>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<!--
+
+ Files
+
+ -->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Files</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="rdoc-style.css" type="text/css" />
+ <base target="docwin" />
+</head>
+<body>
+<div id="index">
+ <h1 class="section-bar">Files</h1>
+ <div id="index-entries">
+ <a href="files/lib/libgenetics_rb.html">lib/libgenetics.rb</a><br />
+ <a href="files/lib/libpplayer_rb.html">lib/libpplayer.rb</a><br />
+ <a href="files/src/play_rb.html">src/play.rb</a><br />
+ <a href="files/src/selection_rb.html">src/selection.rb</a><br />
+ </div>
+</div>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<!--
+
+ Methods
+
+ -->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>Methods</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+ <link rel="stylesheet" href="rdoc-style.css" type="text/css" />
+ <base target="docwin" />
+</head>
+<body>
+<div id="index">
+ <h1 class="section-bar">Methods</h1>
+ <div id="index-entries">
+ <a href="classes/Potential_player.html#M000007">best_move (Potential_player)</a><br />
+ <a href="classes/Population.html#M000019">crossover (Population)</a><br />
+ <a href="classes/Genome.html#M000004">crossover (Genome)</a><br />
+ <a href="classes/Array.html#M000015">gray_decode (Array)</a><br />
+ <a href="classes/Array.html#M000014">gray_encode (Array)</a><br />
+ <a href="classes/Population.html#M000021">make_next_generation (Population)</a><br />
+ <a href="classes/Genome.html#M000002">mutate (Genome)</a><br />
+ <a href="classes/Genome.html#M000003">mutate! (Genome)</a><br />
+ <a href="classes/Population.html#M000020">mutation (Population)</a><br />
+ <a href="classes/GameHandler.html#M000011">new (GameHandler)</a><br />
+ <a href="classes/Population.html#M000018">new (Population)</a><br />
+ <a href="classes/Potential_player.html#M000006">new (Potential_player)</a><br />
+ <a href="classes/Genome.html#M000001">new (Genome)</a><br />
+ <a href="classes/GameHandler.html#M000012">play (GameHandler)</a><br />
+ <a href="classes/Potential_player.html#M000008">score_position (Potential_player)</a><br />
+ <a href="classes/Fixnum.html#M000022">to_bitstring (Fixnum)</a><br />
+ <a href="classes/Potential_player.html#M000009">to_bitstring (Potential_player)</a><br />
+ <a href="classes/Array.html#M000013">to_decimal (Array)</a><br />
+ <a href="classes/Potential_player.html#M000010">to_genome (Potential_player)</a><br />
+ <a href="classes/Genome.html#M000005">to_potential_player (Genome)</a><br />
+ <a href="classes/Population.html#M000016">tournament_select_one (Population)</a><br />
+ <a href="classes/Population.html#M000017">tournament_select_population (Population)</a><br />
+ </div>
+</div>
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="iso-8859-1"?>
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
+
+<!--
+
+ RDoc Documentation
+
+ -->
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+ <title>RDoc Documentation</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+</head>
+<frameset rows="20%, 80%">
+ <frameset cols="25%,35%,45%">
+ <frame src="fr_file_index.html" title="Files" name="Files" />
+ <frame src="fr_class_index.html" name="Classes" />
+ <frame src="fr_method_index.html" name="Methods" />
+ </frameset>
+ <frame src="files/src/play_rb.html" name="docwin" />
+</frameset>
+</html>
\ No newline at end of file
--- /dev/null
+
+body {
+ font-family: Verdana,Arial,Helvetica,sans-serif;
+ font-size: 90%;
+ margin: 0;
+ margin-left: 40px;
+ padding: 0;
+ background: white;
+}
+
+h1,h2,h3,h4 { margin: 0; color: #efefef; background: transparent; }
+h1 { font-size: 150%; }
+h2,h3,h4 { margin-top: 1em; }
+
+a { background: #eef; color: #039; text-decoration: none; }
+a:hover { background: #039; color: #eef; }
+
+/* Override the base stylesheet's Anchor inside a table cell */
+td > a {
+ background: transparent;
+ color: #039;
+ text-decoration: none;
+}
+
+/* and inside a section title */
+.section-title > a {
+ background: transparent;
+ color: #eee;
+ text-decoration: none;
+}
+
+/* === Structural elements =================================== */
+
+div#index {
+ margin: 0;
+ margin-left: -40px;
+ padding: 0;
+ font-size: 90%;
+}
+
+
+div#index a {
+ margin-left: 0.7em;
+}
+
+div#index .section-bar {
+ margin-left: 0px;
+ padding-left: 0.7em;
+ background: #ccc;
+ font-size: small;
+}
+
+
+div#classHeader, div#fileHeader {
+ width: auto;
+ color: white;
+ padding: 0.5em 1.5em 0.5em 1.5em;
+ margin: 0;
+ margin-left: -40px;
+ border-bottom: 3px solid #006;
+}
+
+div#classHeader a, div#fileHeader a {
+ background: inherit;
+ color: white;
+}
+
+div#classHeader td, div#fileHeader td {
+ background: inherit;
+ color: white;
+}
+
+
+div#fileHeader {
+ background: #057;
+}
+
+div#classHeader {
+ background: #048;
+}
+
+
+.class-name-in-header {
+ font-size: 180%;
+ font-weight: bold;
+}
+
+
+div#bodyContent {
+ padding: 0 1.5em 0 1.5em;
+}
+
+div#description {
+ padding: 0.5em 1.5em;
+ background: #efefef;
+ border: 1px dotted #999;
+}
+
+div#description h1,h2,h3,h4,h5,h6 {
+ color: #125;;
+ background: transparent;
+}
+
+div#validator-badges {
+ text-align: center;
+}
+div#validator-badges img { border: 0; }
+
+div#copyright {
+ color: #333;
+ background: #efefef;
+ font: 0.75em sans-serif;
+ margin-top: 5em;
+ margin-bottom: 0;
+ padding: 0.5em 2em;
+}
+
+
+/* === Classes =================================== */
+
+table.header-table {
+ color: white;
+ font-size: small;
+}
+
+.type-note {
+ font-size: small;
+ color: #DEDEDE;
+}
+
+.xxsection-bar {
+ background: #eee;
+ color: #333;
+ padding: 3px;
+}
+
+.section-bar {
+ color: #333;
+ border-bottom: 1px solid #999;
+ margin-left: -20px;
+}
+
+
+.section-title {
+ background: #79a;
+ color: #eee;
+ padding: 3px;
+ margin-top: 2em;
+ margin-left: -30px;
+ border: 1px solid #999;
+}
+
+.top-aligned-row { vertical-align: top }
+.bottom-aligned-row { vertical-align: bottom }
+
+/* --- Context section classes ----------------------- */
+
+.context-row { }
+.context-item-name { font-family: monospace; font-weight: bold; color: black; }
+.context-item-value { font-size: small; color: #448; }
+.context-item-desc { color: #333; padding-left: 2em; }
+
+/* --- Method classes -------------------------- */
+.method-detail {
+ background: #efefef;
+ padding: 0;
+ margin-top: 0.5em;
+ margin-bottom: 1em;
+ border: 1px dotted #ccc;
+}
+.method-heading {
+ color: black;
+ background: #ccc;
+ border-bottom: 1px solid #666;
+ padding: 0.2em 0.5em 0 0.5em;
+}
+.method-signature { color: black; background: inherit; }
+.method-name { font-weight: bold; }
+.method-args { font-style: italic; }
+.method-description { padding: 0 0.5em 0 0.5em; }
+
+/* --- Source code sections -------------------- */
+
+a.source-toggle { font-size: 90%; }
+div.method-source-code {
+ background: #262626;
+ color: #ffdead;
+ margin: 1em;
+ padding: 0.5em;
+ border: 1px dashed #999;
+ overflow: hidden;
+}
+
+div.method-source-code pre { color: #ffdead; overflow: hidden; }
+
+/* --- Ruby keyword styles --------------------- */
+
+.standalone-code { background: #221111; color: #ffdead; overflow: hidden; }
+
+.ruby-constant { color: #7fffd4; background: transparent; }
+.ruby-keyword { color: #00ffff; background: transparent; }
+.ruby-ivar { color: #eedd82; background: transparent; }
+.ruby-operator { color: #00ffee; background: transparent; }
+.ruby-identifier { color: #ffdead; background: transparent; }
+.ruby-node { color: #ffa07a; background: transparent; }
+.ruby-comment { color: #b22222; font-weight: bold; background: transparent; }
+.ruby-regexp { color: #ffa07a; background: transparent; }
+.ruby-value { color: #7fffd4; background: transparent; }
\ No newline at end of file
--- /dev/null
+Generation 153
+00000000000010000011
+00000000000010100011
+00000000000010000001
+00000000000010100011
+00000000000010000001
+00000000000011100001
+00000000000010000001
+00000000000010100011
+00000000000010010011
+00000000000010000011
+00000000000010110011
+00000000000010000001
+00000000000010000001
+00000000000010000001
+00000000000010110001
+00000000000010100011
+00000000000010110011
+00000000000010000001
+00000000000010110011
+00000000000010110011
+00000000000010000001
+00000000000010100001
+00000000000010110011
+00000000000010110011
+00000000000010010010
+00000000000010000011
+00000000000010100001
+00000000000010110001
+00000000000010010011
+00000000000010110001
+00000000000010010010
+00000000000010000011
+00000000000010110011
+00000000000010110001
+00000000000010000011
+00000000000010100011
+00000000000010100011
+00000000000010010010
+00000000000010000011
+00000000000010010010
+00000000000010110011
+00000000000010110011
+00000000000010100011
+00000000000010100001
+00000000000010100011
+00000000000010100001
+00000000000010000011
+00000000000010110011
+00000000000010110011
+00000000000010100011
+00000000000010100001
+00000000000010000011
+00000000000010110011
+00000000000010000001
+00000000000010000011
+00000000000010100001
+00000000000010000011
+00000000000010100011
+00000000000010100011
+00000000000010100001
+00000000000010100001
+00000000000010110011
+00000000000010000001
+00000000000010000001
+00000000000010100001
+00000000000010110000
+00000000000010110011
+00000000000010000010
+00000000000010110011
+00000000000010000011
+00000000000010100011
+00000000000010000011
+00000000000010010011
+00000000000010100011
+00000000000010100011
+00000000000010110011
+00000000000010100001
+00000000000010100011
+00000000000010110011
+00000000000010110001
+00000000000010110001
+00000000000010110011
+00000000000010010010
+00000000000010010010
+00000000000010100001
+00000000000010100011
+00000000000010110010
+00000000000010100001
+00000000000010100011
+00000000000010000011
+00000000000010010011
+00000000000010000011
+00000000000010100001
+00000000000010100001
+00000000000010100011
+00000000000010100011
+00000000000010100011
+00000000000010110011
+00000000000010100011
+00000000000010110011
+00000000000010010011
+00000000000010110011
+00000000000010100011
+00000000000010100001
+00000000000010100011
+00000000000010000011
+00000000000010110001
+00000000000010100011
+00000000000010110011
+00000000000010110010
+00000000000010100001
+00000000000010100001
+00000000000010110001
+00000000000010100011
+00000000000010000011
+00000000000010110001
+00000000000010100011
+00000000000010000001
+00000000000010100011
+00000000000010100001
+00000000000010000011
+00000000000010110011
+00000000000010000011
+00000000000010100011
+00000000000010110001
+00000000000010100011
+00000000000010000001
+00000000000010100001
+00000000000010110011
+00000000000010100001
+00000000000010000011
+00000000000010000011
+00000000000010110000
+00000000000010100001
+00000000000011100001
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010110001
+00000000000010100011
+00000000000010000001
+00000000000010000001
+00000000000010100011
+00000000000010000001
+00000000000010110011
+00000000000010100001
+00000000000010000001
+00000000000010000001
+00000000000010000001
+00000000000010010001
+00000000000010110011
+00000000000010100011
+00000000000010110011
+00000000000010110011
+00000000000010000001
+00000000000010100001
+00000000000010110011
+00000000000010100011
+00000000000010000001
+00000000000010000011
+00000000000010100011
+00000000000010110011
+00000000000010000001
+00000000000010110001
+00000000000010010001
+00000000000010010010
+00000000000010110011
+00000000000010000011
+00000000000010100011
+00000000000010100001
+00000000000010110011
+00000000000010100011
+00000000000010100001
+00000000000010100011
+00000000000010100011
+00000000000010110001
+00000000000010110011
+00000000000010000001
+00000000000010000011
+00000000000010100011
+00000000000010000001
+00000000000010000001
+00000000000010100001
+00000000000011110011
+00000000000010100001
+00000000000010000011
+00000000000010110011
+00000000000010100011
+00000000000010000001
+00000000000010100011
+00000000000010010011
+00000000000010110001
+00000000000010110011
+00000000000010110001
+00000000000010100001
+00000000000010010001
+00000000000010100011
+00000000000010010011
+00000000000010110011
+00000000000010110011
+00000000000010110001
+00000000000010110011
+00000000000010000001
+00000000000010000001
+00000000000010100011
+00000000000010110011
+00000000000010110001
+00000000000010110011
+00000000000010110011
+00000000000010100001
+00000000000010110011
+00000000000010100011
+00000000000010110001
+00000000000010000001
+00000000000010000001
+00000000000010000001
+00000000000010100011
+00000000000010110001
+00000000000010110011
+00000000000010110001
+00000000000010100011
+00000000000010110011
+00000000000010110011
+00000000000010000001
+00000000000010100011
+00000000000010000011
+00000000000010110010
+00000000000010110011
+00000000000010000001
+00000000000010100001
+00000000000010010010
+00000000000010000001
+00000000000010100011
+00000000000010100011
+00000000000010100001
+00000000000010100011
+00000000000010110001
+00000000000010110011
+00000000000010100011
+00000000000010100001
+00000000000010100011
+00000000000010100011
+00000000000010110011
+00000000000010010010
+00000000000010100001
+00000000000010000001
+00000000000010110001
+00000000000010110001
+00000000000010110011
+00000000000010100001
+00000000000010100011
+00000000000010010011
+00000000000010100011
+00000000000010100001
+00000000000010110011
+00000000000010110011
+00000000000010100011
+00000000000010010011
+00000000000010100011
+00000000000010000011
+00000000000010100001
+00000000000010100011
+00000000000010110001
+00000000000010110011
+00000000000010000011
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010110010
+00000000000010010011
+00000000000010000001
+00000000000010000001
+00000000000010000011
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010100001
+00000000000010010011
+00000000000010100011
+00000000000010100011
+00000000000010110011
+00000000000011100001
+00000000000010100001
+00000000000010000011
+00000000000010000001
+00000000000010100001
+00000000000010110001
+00000000000010100011
+00000000000010000011
+00000000000010000001
+00000000000010110001
+00000000000010100011
+00000000000010000011
+00000000000010110011
+00000000000010100011
+00000000000010000011
+00000000000010100001
+00000000000010000001
+00000000000010110011
+00000000000010100011
+00000000000010110011
+00000000000010100011
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010010010
+00000000000010100011
+00000000000010000001
+00000000000010000001
+00000000000010100001
+00000000000010000011
+00000000000010100011
+00000000000010110000
+00000000000010100011
+00000000000010100011
+00000000000010110001
+00000000000010110001
+00000000000010000001
+00000000000010110011
+00000000000010100011
+00000000000010100001
+00000000000010100011
+00000000000010110011
+00000000000010110011
+00000000000010100011
+00000000000010110011
+00000000000010010011
+00000000000010110001
+00000000000010110011
+00000000000010000001
+00000000000010010001
+00000000000010110011
+00000000000010110001
+00000000000010110011
+00000000000010010010
+00000000000010000001
+00000000000010100011
+00000000000010110011
+00000000000010010001
+00000000000010100011
+00000000000010100011
+00000000000010010010
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010100011
+00000000000010000001
+00000000000010110000
+00000000000010110001
+00000000000010000011
+00000000000010110011
+00000000000010110001
+00000000000010110011
+00000000000010010011
+00000000000010100011
+00000000000010110011
+00000000000010100011
+00000000000010110011
+00000000000010000001
+00000000000010000011
+00000000000010110011
+00000000000010110011
+00000000000010100001
+00000000000010110011
+00000000000010100011
+00000000000010110011
+00000000000010100011
+00000000000010000011
+00000000000010110010
+00000000000010000011
+00000000000010000001
+00000000000010110000
+00000000000010010010
+00000000000010010001
+00000000000010100001
+00000000000010000011
+00000000000010110011
+00000000000010100011
+00000000000010010010
+00000000000010010011
+00000000000010100011
+00000000000011100001
+00000000000010000001
+00000000000010110011
+00000000000010100011
+00000000000010110001
+00000000000010100001
+00000000000010010010
+00000000000010000011
+00000000000010110011
+00000000000010000011
+00000000000010010011
+00000000000010100011
+00000000000010110011
+00000000000010110011
+00000000000010010011
+00000000000010000001
+00000000000010100001
+00000000000010110011
+00000000000010010001
+Completed generation 153 in 413.86847 seconds
--- /dev/null
+00000000000010110011
+00000000000010110001
+00000000000010100011
+00000000000010110001
+00000000000010010010
+00000000000010100001
+00000000000010010010
+00000000000010100011
+00000000000010100011
+00000000000010010010
+00000000000010100001
+00000000000010110010
+00000000000010100011
+00000000000010110001
+00000000000011100001
+00000000000010100011
+00000000000010110011
+00000000000010100011
+00000000000010100011
+00000000000010010001
+00000000000010110011
+00000000000010110011
+00000000000010010001
+00000000000010100001
+00000000000011100011
+00000000000010110011
+00000000000010110001
+00000000000010110011
+00000000000010110001
+00000000000010010011
+00000000000010110011
+00000000000011100011
+00000000000010110011
+00000000000010110001
+00000000000010100001
+00000000000010110011
+00000000000010110011
+00000000000010100001
+00000000000010100011
+00000000000010110011
+00000000000010100011
+00000000000010110011
+00000000000010110001
+00000000000010010010
+00000000000010110011
+00000000000010110001
+00000000000010110001
+00000000000010010001
+00000000000010100011
+00000000000010110001
+00000000000010110011
+00000000000010110011
+00000000000010110001
+00000000000010100010
+00000000000010100011
+00000000000010110010
+00000000000010110011
+00000000000010100011
+00000000000010110001
+00000000000010110011
+00000000000011100001
+00000000000010100011
+00000000000010100011
+00000000000010110011
+00000000000010110001
+00000000000010110011
+00000000000010110011
+00000000000010110010
+00000000000010110011
+00000000000010110010
+00000000000010100011
+00000000000010110001
+00000000000010100011
+00000000000010110011
+00000000000010100011
+00000000000010110011
+00000000000010100011
+00000000000011100001
+00000000000010100001
+00000000000010100011
+00000000000010110011
+00000000000010110001
+00000000000010110001
+00000000000010110010
+00000000000010100011
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010110001
+00000000000010010001
+00000000000010110001
+00000000000010110011
+00000000000010110011
+00000000000010000001
+00000000000010000001
+00000000000010110011
+00000000000010110001
+00000000000010110010
+00000000000011100001
+00000000000010110001
+00000000000010110001
+00000000000010100001
+00000000000010110001
+00000000000010110001
+00000000000010110010
+00000000000010110001
+00000000000010110011
+00000000000010110001
+00000000000010100001
+00000000000010000011
+00000000000010110011
+00000000000010110011
+00000000000011100010
+00000000000010110011
+00000000000011100011
+00000000000010110001
+00000000000010010001
+00000000000010110001
+00000000000010110001
+00000000000010110011
+00000000000010100001
+00000000000010000001
+00000000000011110001
+00000000000010110011
+00000000000010110001
+00000000000010100011
+00000000000010100011
+00000000000010100010
+00000000000010110001
+00000000000010100011
+00000000000010110011
+00000000000010110010
+00000000000011100011
+00000000000010100011
+00000000000010100011
+00000000000010100011
+00000000000010110011
+00000000000010010011
+00000000000010110011
+00000000000010100011
+00000000000010110011
+00000000000010100011
+00000000000010110011
+00000000000010110011
+00000000000010110001
+00000000000010010001
+00000000000010110001
+00000000000010110001
+00000000000010110001
+00000000000010110001
+00000000000010110011
+00000000000010110001
+00000000000010100011
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010110001
+00000000000010110011
+00000000000010100011
+00000000000010010001
+00000000000011110011
+00000000000010100001
+00000000000010110001
+00000000000010110001
+00000000000010100011
+00000000000010100011
+00000000000010100011
+00000000000010110011
+00000000000010100011
+00000000000011110001
+00000000000010100001
+00000000000010110011
+00000000000010110001
+00000000000010100011
+00000000000010110011
+00000000000010000001
+00000000000010110001
+00000000000010100011
+00000000000010110011
+00000000000010100001
+00000000000010110011
+00000000000010100011
+00000000000010100001
+00000000000010110001
+00000000000011110001
+00000000000010110001
+00000000000010100011
+00000000000010110011
+00000000000010100010
+00000000000011100001
+00000000000010010001
+00000000000010110001
+00000000000010100011
+00000000000010110011
+00000000000010110011
+00000000000010100011
+00000000000010110001
+00000000000010110011
+00000000000010110011
+00000000000010100011
+00000000000010010001
+00000000000010110011
+00000000000010100010
+00000000000010110011
+00000000000011100011
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010000001
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010010001
+00000000000010100011
+00000000000010110011
+00000000000010110010
+00000000000010100011
+00000000000010110011
+00000000000010110010
+00000000000010110011
+00000000000010100001
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010000001
+00000000000010010011
+00000000000010100011
+00000000000010110011
+00000000000010110001
+00000000000010110001
+00000000000010110011
+00000000000010110011
+00000000000011110001
+00000000000010010001
+00000000000010010001
+00000000000010110001
+00000000000010100001
+00000000000010100011
+00000000000010110011
+00000000000010110001
+00000000000010100011
+00000000000010100011
+00000000000011110011
+00000000000010100011
+00000000000010100010
+00000000000010100011
+00000000000010110010
+00000000000010110001
+00000000000010110011
+00000000000011100001
+00000000000010110011
+00000000000010110001
+00000000000010110001
+00000000000010010010
+00000000000010110001
+00000000000010110011
+00000000000010110001
+00000000000010110011
+00000000000010100011
+00000000000010100011
+00000000000010100011
+00000000000010110001
+00000000000010100011
+00000000000010100011
+00000000000010110001
+00000000000010110001
+00000000000010100001
+00000000000010110011
+00000000000010100011
+00000000000010110011
+00000000000010110011
+00000000000010110001
+00000000000010110001
+00000000000010010010
+00000000000010110011
+00000000000010110011
+00000000000011100001
+00000000000011100011
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010000001
+00000000000010110011
+00000000000010000001
+00000000000010110011
+00000000000010110011
+00000000000011100011
+00000000000010110011
+00000000000010010011
+00000000000010110011
+00000000000010110001
+00000000000011100011
+00000000000010110001
+00000000000010000001
+00000000000010110011
+00000000000011110011
+00000000000010010001
+00000000000010100011
+00000000000010010011
+00000000000011100011
+00000000000010010011
+00000000000010100011
+00000000000010100011
+00000000000011100000
+00000000000010110011
+00000000000011100011
+00000000000010100001
+00000000000010110001
+00000000000010110001
+00000000000010010010
+00000000000010100011
+00000000000010000001
+00000000000010110011
+00000000000010100001
+00000000000010110010
+00000000000010110010
+00000000000010010011
+00000000000011100001
+00000000000010110011
+00000000000010100011
+00000000000010110011
+00000000000010110011
+00000000000010100001
+00000000000010100011
+00000000000010110010
+00000000000010110011
+00000000000010110011
+00000000000011100001
+00000000000010110011
+00000000000010100011
+00000000000010000001
+00000000000010110011
+00000000000010100010
+00000000000011100011
+00000000000010100011
+00000000000010110011
+00000000000010100011
+00000000000010010001
+00000000000010110011
+00000000000010110011
+00000000000010000001
+00000000000010110011
+00000000000010110011
+00000000000010100011
+00000000000010110001
+00000000000011100001
+00000000000010110011
+00000000000010100011
+00000000000010110011
+00000000000011100001
+00000000000010110011
+00000000000010110001
+00000000000010110011
+00000000000010100011
+00000000000010110001
+00000000000010010010
+00000000000010110010
+00000000000010110011
+00000000000010100011
+00000000000010100011
+00000000000010100011
+00000000000010110001
+00000000000010110001
+00000000000010100011
+00000000000010110001
+00000000000010110011
+00000000000010110011
+00000000000010100001
+00000000000010110011
+00000000000010110001
+00000000000010000001
+00000000000010110011
+00000000000010100011
+00000000000010110011
+00000000000010110011
+00000000000010010011
+00000000000010110011
+00000000000010100011
+00000000000010110011
+00000000000010110011
+00000000000010100011
+00000000000010110011
+00000000000010100011
+00000000000010110011
+00000000000010110001
+00000000000010100011
+00000000000010110011
+00000000000010010011
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010100010
+00000000000010110001
+00000000000010110010
+00000000000010110011
+00000000000010100011
+00000000000011100010
+After selection:
+
+
+00000000000010110011
+00000000000010110001
+00000000000010100011
+00000000000010110001
+00000000000010010010
+00000000000010100001
+00000000000010010010
+00000000000010100011
+00000000000010100011
+00000000000010010010
+00000000000010100001
+00000000000010110010
+00000000000010100011
+00000000000010110001
+00000000000011100001
+00000000000010100011
+00000000000010110011
+00000000000010100011
+00000000000010100011
+00000000000010010001
+00000000000010110011
+00000000000010110011
+00000000000010010001
+00000000000010100001
+00000000000011100011
+00000000000010110011
+00000000000010110001
+00000000000010110011
+00000000000010110001
+00000000000010010011
+00000000000010110011
+00000000000011100011
+00000000000010110011
+00000000000010110001
+00000000000010100001
+00000000000010110011
+00000000000010110011
+00000000000010100001
+00000000000010100011
+00000000000010110011
+00000000000010100011
+00000000000010110011
+00000000000010110001
+00000000000010010010
+00000000000010110011
+00000000000010110001
+00000000000010110001
+00000000000010010001
+00000000000010100011
+00000000000010110001
+00000000000010110011
+00000000000010110011
+00000000000010110001
+00000000000010100010
+00000000000010100011
+00000000000010110010
+00000000000010110011
+00000000000010100011
+00000000000010110001
+00000000000010110011
+00000000000011100001
+00000000000010100011
+00000000000010100011
+00000000000010110011
+00000000000010110001
+00000000000010110011
+00000000000010110011
+00000000000010110010
+00000000000010110011
+00000000000010110010
+00000000000010100011
+00000000000010110001
+00000000000010100011
+00000000000010110011
+00000000000010100011
+00000000000010110011
+00000000000010100011
+00000000000011100001
+00000000000010100001
+00000000000010100011
+00000000000010110011
+00000000000010110001
+00000000000010110001
+00000000000010110010
+00000000000010100011
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010110001
+00000000000010010001
+00000000000010110001
+00000000000010110011
+00000000000010110011
+00000000000010000001
+00000000000010000001
+00000000000010110011
+00000000000010110001
+00000000000010110010
+00000000000011100001
+00000000000010110001
+00000000000010110001
+00000000000010100001
+00000000000010110001
+00000000000010110001
+00000000000010110010
+00000000000010110001
+00000000000010110011
+00000000000010110001
+00000000000010100001
+00000000000010000011
+00000000000010110011
+00000000000010110011
+00000000000011100010
+00000000000010110011
+00000000000011100011
+00000000000010110001
+00000000000010010001
+00000000000010110001
+00000000000010110001
+00000000000010110011
+00000000000010100001
+00000000000010000001
+00000000000011110001
+00000000000010110011
+00000000000010110001
+00000000000010100011
+00000000000010100011
+00000000000010100010
+00000000000010110001
+00000000000010100011
+00000000000010110011
+00000000000010110010
+00000000000011100011
+00000000000010100011
+00000000000010100011
+00000000000010100011
+00000000000010110011
+00000000000010010011
+00000000000010110011
+00000000000010100011
+00000000000010110011
+00000000000010100011
+00000000000010110011
+00000000000010110011
+00000000000010110001
+00000000000010010001
+00000000000010110001
+00000000000010110001
+00000000000010110001
+00000000000010110001
+00000000000010110011
+00000000000010110001
+00000000000010100011
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010110001
+00000000000010110011
+00000000000010100011
+00000000000010010001
+00000000000011110011
+00000000000010100001
+00000000000010110001
+00000000000010110001
+00000000000010100011
+00000000000010100011
+00000000000010100011
+00000000000010110011
+00000000000010100011
+00000000000011110001
+00000000000010100001
+00000000000010110011
+00000000000010110001
+00000000000010100011
+00000000000010110011
+00000000000010000001
+00000000000010110001
+00000000000010100011
+00000000000010110011
+00000000000010100001
+00000000000010110011
+00000000000010100011
+00000000000010100001
+00000000000010110001
+00000000000011110001
+00000000000010110001
+00000000000010100011
+00000000000010110011
+00000000000010100010
+00000000000011100001
+00000000000010010001
+00000000000010110001
+00000000000010100011
+00000000000010110011
+00000000000010110011
+00000000000010100011
+00000000000010110001
+00000000000010110011
+00000000000010110011
+00000000000010100011
+00000000000010010001
+00000000000010110011
+00000000000010100010
+00000000000010110011
+00000000000011100011
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010000001
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010010001
+00000000000010100011
+00000000000010110011
+00000000000010110010
+00000000000010100011
+00000000000010110011
+00000000000010110010
+00000000000010110011
+00000000000010100001
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010000001
+00000000000010010011
+00000000000010100011
+00000000000010110011
+00000000000010110001
+00000000000010110001
+00000000000010110011
+00000000000010110011
+00000000000011110001
+00000000000010010001
+00000000000010010001
+00000000000010110001
+00000000000010100001
+00000000000010100011
+00000000000010110011
+00000000000010110001
+00000000000010100011
+00000000000010100011
+00000000000011110011
+00000000000010100011
+00000000000010100010
+00000000000010100011
+00000000000010110010
+00000000000010110001
+00000000000010110011
+00000000000011100001
+00000000000010110011
+00000000000010110001
+00000000000010110001
+00000000000010010010
+00000000000010110001
+00000000000010110011
+00000000000010110001
+00000000000010110011
+00000000000010100011
+00000000000010100011
+00000000000010100011
+00000000000010110001
+00000000000010100011
+00000000000010100011
+00000000000010110001
+00000000000010110001
+00000000000010100001
+00000000000010110011
+00000000000010100011
+00000000000010110011
+00000000000010110011
+00000000000010110001
+00000000000010110001
+00000000000010010010
+00000000000010110011
+00000000000010110011
+00000000000011100001
+00000000000011100011
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010000001
+00000000000010110011
+00000000000010000001
+00000000000010110011
+00000000000010110011
+00000000000011100011
+00000000000010110011
+00000000000010010011
+00000000000010110011
+00000000000010110001
+00000000000011100011
+00000000000010110001
+00000000000010000001
+00000000000010110011
+00000000000011110011
+00000000000010010001
+00000000000010100011
+00000000000010010011
+00000000000011100011
+00000000000010010011
+00000000000010100011
+00000000000010100011
+00000000000011100000
+00000000000010110011
+00000000000011100011
+00000000000010100001
+00000000000010110001
+00000000000010110001
+00000000000010010010
+00000000000010100011
+00000000000010000001
+00000000000010110011
+00000000000010100001
+00000000000010110010
+00000000000010110010
+00000000000010010011
+00000000000011100001
+00000000000010110011
+00000000000010100011
+00000000000010110011
+00000000000010110011
+00000000000010100001
+00000000000010100011
+00000000000010110010
+00000000000010110011
+00000000000010110011
+00000000000011100001
+00000000000010110011
+00000000000010100011
+00000000000010000001
+00000000000010110011
+00000000000010100010
+00000000000011100011
+00000000000010100011
+00000000000010110011
+00000000000010100011
+00000000000010010001
+00000000000010110011
+00000000000010110011
+00000000000010000001
+00000000000010110011
+00000000000010110011
+00000000000010100011
+00000000000010110001
+00000000000011100001
+00000000000010110011
+00000000000010100011
+00000000000010110011
+00000000000011100001
+00000000000010110011
+00000000000010110001
+00000000000010110011
+00000000000010100011
+00000000000010110001
+00000000000010010010
+00000000000010110010
+00000000000010110011
+00000000000010100011
+00000000000010100011
+00000000000010100011
+00000000000010110001
+00000000000010110001
+00000000000010100011
+00000000000010110001
+00000000000010110011
+00000000000010110011
+00000000000010100001
+00000000000010110011
+00000000000010110001
+00000000000010000001
+00000000000010110011
+00000000000010100011
+00000000000010110011
+00000000000010110011
+00000000000010010011
+00000000000010110011
+00000000000010100011
+00000000000010110011
+00000000000010110011
+00000000000010100011
+00000000000010110011
+00000000000010100011
+00000000000010110011
+00000000000010110001
+00000000000010100011
+00000000000010110011
+00000000000010010011
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010100010
+00000000000010110001
+00000000000010110010
+00000000000010110011
+00000000000010100011
+00000000000011100010
+
+
+
+After crossover:
+
+
+00000000000010100011
+00000000000010100011
+00000000000010100011
+00000000000010110001
+00000000000010110011
+00000000000010110011
+00000000000010100011
+00000000000011100001
+00000000000010010001
+00000000000011100011
+00000000000011100011
+00000000000011110001
+00000000000010100011
+00000000000010110001
+00000000000010000001
+00000000000010110001
+00000000000010110011
+00000000000010110001
+00000000000010110001
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010100011
+00000000000010000001
+00000000000010110001
+00000000000010110001
+00000000000010110001
+00000000000010110011
+00000000000010110001
+00000000000010010001
+00000000000010110011
+00000000000010100011
+00000000000010110001
+00000000000010110011
+00000000000010100010
+00000000000010110001
+00000000000010110010
+00000000000010100011
+00000000000010110011
+00000000000010110001
+00000000000010100011
+00000000000010110001
+00000000000010100011
+00000000000010110011
+00000000000010100011
+00000000000011100011
+00000000000010110001
+00000000000010100011
+00000000000011100011
+00000000000010100001
+00000000000010110001
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010010011
+00000000000010110001
+00000000000010110011
+00000000000010110011
+00000000000010110001
+00000000000011100001
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010100011
+00000000000010110010
+00000000000011100001
+00000000000010110011
+00000000000011100011
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010100011
+00000000000010110001
+00000000000010100011
+00000000000010110011
+00000000000010010011
+00000000000010000001
+00000000000010110001
+00000000000010100011
+00000000000010010010
+00000000000010110011
+00000000000010110001
+00000000000010110011
+00000000000010110011
+00000000000010010001
+00000000000010100011
+00000000000010100010
+00000000000010110011
+00000000000010100011
+00000000000010100011
+00000000000011110001
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010100011
+00000000000010010001
+00000000000010110011
+00000000000010010011
+00000000000010100001
+00000000000010110001
+00000000000010010010
+00000000000011110001
+00000000000010110011
+00000000000010110001
+00000000000010110011
+00000000000010100011
+00000000000011100001
+00000000000010110001
+00000000000011100001
+00000000000010110011
+00000000000010010001
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010100010
+00000000000011100011
+00000000000010100011
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000011100001
+00000000000010000001
+00000000000010000001
+00000000000010100010
+00000000000010100011
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010100011
+00000000000010110001
+00000000000010110011
+00000000000010110011
+00000000000010100001
+00000000000010100011
+00000000000010010001
+00000000000010100001
+00000000000010100001
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010100011
+00000000000011110001
+00000000000010110011
+00000000000010100001
+00000000000010110011
+00000000000010100001
+00000000000010110010
+00000000000010110001
+00000000000010100011
+00000000000010110011
+00000000000010110001
+00000000000010110011
+00000000000010000001
+00000000000010110011
+00000000000010100001
+00000000000010100011
+00000000000010110011
+00000000000010000001
+00000000000010110011
+00000000000010110011
+00000000000010100001
+00000000000010110010
+00000000000010110011
+00000000000010110011
+00000000000010110001
+00000000000010110001
+00000000000010110011
+00000000000010000001
+00000000000010110001
+00000000000010110001
+00000000000010010001
+00000000000010100011
+00000000000010100001
+00000000000010110011
+00000000000010110011
+00000000000010110010
+00000000000010000001
+00000000000010100011
+00000000000010110011
+00000000000010110011
+00000000000010110001
+00000000000010100011
+00000000000010100001
+00000000000010100011
+00000000000010100011
+00000000000011100011
+00000000000010110011
+00000000000010110011
+00000000000010100001
+00000000000010100011
+00000000000010110011
+00000000000010010011
+00000000000010110010
+00000000000010110011
+00000000000010100011
+00000000000010110001
+00000000000010100011
+00000000000010110010
+00000000000010110011
+00000000000010100010
+00000000000010110011
+00000000000010110011
+00000000000010110001
+00000000000010100011
+00000000000010110011
+00000000000010100011
+00000000000010110001
+00000000000010110001
+00000000000011110011
+00000000000010100011
+00000000000010110011
+00000000000010100001
+00000000000010110011
+00000000000010100010
+00000000000010100011
+00000000000010100011
+00000000000010100011
+00000000000010110011
+00000000000010110001
+00000000000010100001
+00000000000010110001
+00000000000010010001
+00000000000010110011
+00000000000010100011
+00000000000010110010
+00000000000010010001
+00000000000010110001
+00000000000010110001
+00000000000010110001
+00000000000010100011
+00000000000010110011
+00000000000010110011
+00000000000010100011
+00000000000010100001
+00000000000010110011
+00000000000010100010
+00000000000010010001
+00000000000010010001
+00000000000010100001
+00000000000011110011
+00000000000010100011
+00000000000010000001
+00000000000011100011
+00000000000010110011
+00000000000010100011
+00000000000010100011
+00000000000010110011
+00000000000010110011
+00000000000010110010
+00000000000010100011
+00000000000010110001
+00000000000010110011
+00000000000010110001
+00000000000010110011
+00000000000010100011
+00000000000010100011
+00000000000010110010
+00000000000010010001
+00000000000010110011
+00000000000010110010
+00000000000010110001
+00000000000010100011
+00000000000010110011
+00000000000010010011
+00000000000010110011
+00000000000010110011
+00000000000010100011
+00000000000010110011
+00000000000010110001
+00000000000010110011
+00000000000010100011
+00000000000010100011
+00000000000010110011
+00000000000010110010
+00000000000010110001
+00000000000010110001
+00000000000010110011
+00000000000010100011
+00000000000010100011
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010100011
+00000000000010010001
+00000000000010110001
+00000000000010110001
+00000000000010000001
+00000000000010100001
+00000000000010000001
+00000000000010100011
+00000000000010100011
+00000000000010110011
+00000000000011100011
+00000000000010110001
+00000000000010110011
+00000000000011100010
+00000000000010010010
+00000000000010100001
+00000000000010110001
+00000000000010110011
+00000000000010110010
+00000000000010110011
+00000000000010110001
+00000000000010100011
+00000000000011100010
+00000000000010010010
+00000000000010110001
+00000000000010110011
+00000000000010110001
+00000000000010010011
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010110001
+00000000000010110001
+00000000000010010010
+00000000000011100001
+00000000000011100011
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000011100000
+00000000000010110001
+00000000000010100011
+00000000000010010011
+00000000000010110011
+00000000000010110011
+00000000000010110001
+00000000000010110001
+00000000000010100011
+00000000000010010011
+00000000000010110001
+00000000000010110011
+00000000000010110001
+00000000000010100011
+00000000000010110011
+00000000000010100011
+00000000000011100011
+00000000000010000001
+00000000000010100011
+00000000000011100001
+00000000000010110010
+00000000000010110001
+00000000000010110001
+00000000000010110011
+00000000000010100011
+00000000000010110011
+00000000000010110011
+00000000000010010011
+00000000000010100011
+00000000000011110011
+00000000000010100001
+00000000000010110001
+00000000000010110011
+00000000000010100001
+00000000000010010010
+00000000000010100011
+00000000000010100011
+00000000000010100011
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010100011
+00000000000010000001
+00000000000010110001
+00000000000010110010
+00000000000010110010
+00000000000010110011
+00000000000010100011
+00000000000010110001
+00000000000010110001
+00000000000010100011
+00000000000010010010
+00000000000011100011
+00000000000010100011
+00000000000010010001
+00000000000010110001
+00000000000010110011
+00000000000010110001
+00000000000010110001
+00000000000010100001
+00000000000010010011
+00000000000010110001
+00000000000010110001
+00000000000010100011
+00000000000010110001
+00000000000010110011
+00000000000011100001
+00000000000010100011
+00000000000010110011
+00000000000010110011
+00000000000011110011
+00000000000010110010
+00000000000010110011
+
+
+
+After mutation:
+
+
+00000000000010111011
+01000100000010110110
+00000000000011110011
+00000000000010110010
+00000000010010110011
+01000100000010100011
+00000000000111100001
+00000000010010110011
+00100000001010110001
+00000000000010100011
+00000000000010110000
+00000000000010110001
+01000000000111010011
+00000000000010110001
+00000000000010110001
+00000000000010110001
+00000001000010110011
+00000000000010110001
+00000000000010110001
+00000000000011100011
+00000000001011100011
+01000010000010010010
+00000000000010100011
+00000000001010110001
+00000000000010110000
+00000000000000100011
+00000000000010110011
+00001000000010110010
+00000000000010010010
+00000000000000110001
+00000001000010000001
+10000000000010100011
+00001000000010100011
+00000000000010110011
+00000010000010110001
+01000000000010100011
+00000000000010100011
+00100100000010100011
+00000000000010010000
+00000000000000100001
+00000000000010110010
+00000000000010110000
+00000000000010110001
+00000000001011110011
+00000000000010100011
+00000000100010010011
+00000000000010110011
+00000000000010110011
+00000000000010100001
+00000000010010110010
+00000001000010110001
+00001000000010110001
+00100000000010110010
+00000000000011100001
+00000000000010100111
+00000000000010000011
+00000000000011100011
+00000000000010100011
+00000000000010110011
+00000000000011100011
+00000000000110110001
+00000000000110110011
+00000000000010110001
+00000000000010010011
+00000000000010100011
+00000000000010110001
+00000000000010110001
+00000000000010110011
+00000000000010111011
+00000000000010010011
+10000000000010110011
+00000000000010110001
+00000100000011100000
+00000010000000110000
+00000000000010110011
+00000000000010111011
+00000000000011110011
+00000000000010110011
+01000100100010110011
+00000000000010110011
+00000000000011100010
+00000000000011100001
+00000000100010010110
+00000100000010110001
+00000000000010110001
+00000000001010110011
+00000000000010111011
+00100000000010110011
+00000000000010010011
+00000000000010110001
+00000000000010110011
+10000000000010010001
+01000000000010010010
+00000000000011101010
+00000001000010100011
+00000100000010110001
+00000000000010110011
+00000000010010110010
+00000000000010110011
+00000000000010110001
+00000000000010100001
+01000000110010010010
+00110010000011100010
+00000000000010110011
+00000100000011110001
+00000000100011100111
+00000000001011111011
+00010000000010100011
+01000000000010100011
+00000000000010000001
+00000000100010100001
+01000000000010000001
+00000000000010110001
+00000000000010100001
+00001100000010010001
+00100000000010100111
+00010000000010100011
+00000000000010110001
+00000000000010110011
+00000000000000100011
+00000100000011100011
+00000000001010110011
+01000000000010110001
+00000000000010110001
+00000101000010111010
+00000000001010110011
+00010010010010101010
+00000000000010100011
+00000000001010110011
+00000000000010111101
+00000001000010110011
+00000000000010100011
+00010000000010010011
+00000000000010110011
+00000000000010010011
+00000000000010110011
+00000000000010100011
+00010000000010110001
+00000000000110110010
+10000000000010110011
+00000000000010000001
+00000000000010110010
+00000000000010100010
+00000000001010000011
+00000000000010110011
+00000000000010110001
+00000000000010110011
+01000000000010100001
+10000000000010100011
+01000000010010110010
+00000100000010110011
+10000000000010110011
+00000000100010100011
+00000100000010100011
+00001000000010110011
+00000000000011100011
+00000000000011000001
+00000000000010100011
+00010000000011110011
+00000000000010100001
+00000000000010010001
+01000000000010000001
+00000000000010100010
+00000000000010110001
+00000000000010100001
+00000000000010100011
+10000000000010110011
+00000000000010110011
+00010000000010000011
+10100000000010110001
+00000000001010110001
+00000000000010110001
+00000000000010010001
+00000000000010110010
+00000000000010100011
+00000100000010110011
+00000000000010010001
+00010000000110110001
+00000000000010100001
+00000000000010100001
+00000000000010110111
+00000001000010100011
+00000000000010000011
+00000000000010100010
+00000000000011100010
+00000000100010110011
+10000000001010100001
+00000000000010110011
+00000000000010101111
+00000000000001110010
+00000000000010110001
+00000000000010110011
+00000000000010101011
+10000000000010010011
+00100000001010100011
+00000001000010110001
+00000000000010110011
+00000000010010110111
+00000000000010100010
+00000000000010110011
+00000000000000110010
+00000000000010001011
+00000000000010110001
+00000000000010100011
+10000000000010110011
+10000000000010110010
+00000000001010110011
+00000000010010110011
+00000000000010100011
+00001000100010100011
+00000000000010110011
+00000000000010110011
+00000000000011100011
+00000000000010000011
+00000000000010100010
+01000101000110100001
+00000000000010100011
+00000000000010010001
+00000000000010110011
+00000000000010110011
+00000000000010100011
+00001000000010000000
+00000000000010110010
+00000000000110110011
+00000000000000100011
+00001000000010100001
+00000000000010000011
+00100000000010000001
+00000100001010010001
+00000000000010110001
+00000000000010000000
+00000000001010110011
+00000001000010110001
+00100000000010110000
+00000000000010110011
+00000000000010110011
+00000000000010110010
+00000000001010100000
+00000000000010110010
+00000000000010110011
+00000000000010000001
+00000000000010110011
+00000000000010110011
+00000000001010100001
+00010000000011110011
+00000000000010000001
+00100000000010110101
+00001001000010110001
+00000000000010110011
+00000000000010100011
+00001010000000110001
+00000000000011010010
+00000001000010100001
+00000000000010110011
+00000000000010100001
+00000000010010010011
+00000000000011110001
+00000000000010100011
+00000000000010111011
+00000001000010110011
+10010000000010110001
+00010000000010100001
+00000000011010000001
+00000000000010010000
+10100000000010000011
+00000000001010100000
+00000000100010110011
+00000000000010010001
+00000010000010110001
+00000000000010100011
+00001000111010110011
+00000000000010110011
+00100000000010110011
+00000000000100110011
+01101000000010100011
+00000000000010100010
+00000010000010010001
+01000000100010100001
+00000000000011100001
+00000000000010110011
+00010000000010010011
+00000000000010111001
+00000000010000100011
+00000000000011100111
+00000000000010100010
+00000100000010100011
+00000000001001110011
+00000000110010110011
+00010000000010010001
+00000000000010110011
+00000000000011100001
+00010000001010110001
+00010000000011110001
+00010000000010100011
+00000000001010110011
+00000000000010110001
+00100010000010110011
+00000000000011110101
+00000000010010010010
+00000000000010100001
+00000000000010100001
+00000000000010010010
+10000000000110110011
+00000000000011000001
+00000000000000100011
+00000000000010110011
+00000000000110110011
+00000000000110110011
+00100000000010110011
+00000000000011110001
+00000000000010100011
+00000000000010100011
+00000010001010110011
+00010000000010100010
+00100000000010100011
+00000100000110010001
+00000010001010010011
+00000000000010110011
+00100000000010110001
+00000000000010110011
+10000000010010010010
+00000001000010100010
+01000011000010110001
+00001100001010000001
+00000000000010010011
+00000000100110110011
+00000000000010100011
+00000000000010110001
+00000000000010100011
+01000000000000110011
+00000000000010110011
+00010000000010110011
+00000000000011100011
+00000000000010110011
+10001000000011100001
+00001000000010110010
+00000000000010100011
+00000000010010110011
+00000000000010110011
+01000000000010110001
+00001000000011100001
+10000000000010110001
+00000000000010110011
+00000000000010110001
+00000000000010110001
+01000000000010010011
+00000000000010110011
+00000000000010110011
+00000000000000110011
+00000000000010110011
+00000000010010100001
+00000100000011110011
+00000000000010100011
+11000000000010110001
+00000000000011100011
+10000000000010100011
+00000000000010110010
+00000000000010100011
+00000000000000110001
+00000000000010100011
+01001000000010110001
+00100010010010100011
+00000000000000100011
+00010000000010110010
+00000000000010110001
+00000000000011100010
+00000001000110110011
+00000000100010110001
+00000000100010100011
+00000000000010110011
+00000000000010011001
+00000000000010110001
+00000000000010110011
+00000000000010110001
+00000001000010100001
+00010000000010110001
+00000000100010000001
+00000000000010100011
+00000000000010111011
+00000000000010110011
+00000000000010110011
+00000000000110110001
+00000000000010110001
+00000000000010110011
+00000000000010110001
+00000000100010000001
+00000000000010110001
+10000100010010100011
+00000000000011110001
+00000000000011100011
+00000000001011101011
+00000010000010010001
+00100001000011100001
+00000000000010000011
+00000000000010110011
+00000000000010110011
+00000001000011110001
+00001000000010100011
+00000000000010100011
+00000000100010100011
--- /dev/null
+00000000000010110011
+00000000000010110001
+00000000000010100011
+00000000000010110001
+00000000000010010010
+00000000000010100001
+00000000000010010010
+00000000000010100011
+00000000000010100011
+00000000000010010010
+00000000000010100001
+00000000000010110010
+00000000000010100011
+00000000000010110001
+00000000000011100001
+00000000000010100011
+00000000000010110011
+00000000000010100011
+00000000000010100011
+00000000000010010001
+00000000000010110011
+00000000000010110011
+00000000000010010001
+00000000000010100001
+00000000000011100011
+00000000000010110011
+00000000000010110001
+00000000000010110011
+00000000000010110001
+00000000000010010011
+00000000000010110011
+00000000000011100011
+00000000000010110011
+00000000000010110001
+00000000000010100001
+00000000000010110011
+00000000000010110011
+00000000000010100001
+00000000000010100011
+00000000000010110011
+00000000000010100011
+00000000000010110011
+00000000000010110001
+00000000000010010010
+00000000000010110011
+00000000000010110001
+00000000000010110001
+00000000000010010001
+00000000000010100011
+00000000000010110001
+00000000000010110011
+00000000000010110011
+00000000000010110001
+00000000000010100010
+00000000000010100011
+00000000000010110010
+00000000000010110011
+00000000000010100011
+00000000000010110001
+00000000000010110011
+00000000000011100001
+00000000000010100011
+00000000000010100011
+00000000000010110011
+00000000000010110001
+00000000000010110011
+00000000000010110011
+00000000000010110010
+00000000000010110011
+00000000000010110010
+00000000000010100011
+00000000000010110001
+00000000000010100011
+00000000000010110011
+00000000000010100011
+00000000000010110011
+00000000000010100011
+00000000000011100001
+00000000000010100001
+00000000000010100011
+00000000000010110011
+00000000000010110001
+00000000000010110001
+00000000000010110010
+00000000000010100011
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010110001
+00000000000010010001
+00000000000010110001
+00000000000010110011
+00000000000010110011
+00000000000010000001
+00000000000010000001
+00000000000010110011
+00000000000010110001
+00000000000010110010
+00000000000011100001
+00000000000010110001
+00000000000010110001
+00000000000010100001
+00000000000010110001
+00000000000010110001
+00000000000010110010
+00000000000010110001
+00000000000010110011
+00000000000010110001
+00000000000010100001
+00000000000010000011
+00000000000010110011
+00000000000010110011
+00000000000011100010
+00000000000010110011
+00000000000011100011
+00000000000010110001
+00000000000010010001
+00000000000010110001
+00000000000010110001
+00000000000010110011
+00000000000010100001
+00000000000010000001
+00000000000011110001
+00000000000010110011
+00000000000010110001
+00000000000010100011
+00000000000010100011
+00000000000010100010
+00000000000010110001
+00000000000010100011
+00000000000010110011
+00000000000010110010
+00000000000011100011
+00000000000010100011
+00000000000010100011
+00000000000010100011
+00000000000010110011
+00000000000010010011
+00000000000010110011
+00000000000010100011
+00000000000010110011
+00000000000010100011
+00000000000010110011
+00000000000010110011
+00000000000010110001
+00000000000010010001
+00000000000010110001
+00000000000010110001
+00000000000010110001
+00000000000010110001
+00000000000010110011
+00000000000010110001
+00000000000010100011
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010110001
+00000000000010110011
+00000000000010100011
+00000000000010010001
+00000000000011110011
+00000000000010100001
+00000000000010110001
+00000000000010110001
+00000000000010100011
+00000000000010100011
+00000000000010100011
+00000000000010110011
+00000000000010100011
+00000000000011110001
+00000000000010100001
+00000000000010110011
+00000000000010110001
+00000000000010100011
+00000000000010110011
+00000000000010000001
+00000000000010110001
+00000000000010100011
+00000000000010110011
+00000000000010100001
+00000000000010110011
+00000000000010100011
+00000000000010100001
+00000000000010110001
+00000000000011110001
+00000000000010110001
+00000000000010100011
+00000000000010110011
+00000000000010100010
+00000000000011100001
+00000000000010010001
+00000000000010110001
+00000000000010100011
+00000000000010110011
+00000000000010110011
+00000000000010100011
+00000000000010110001
+00000000000010110011
+00000000000010110011
+00000000000010100011
+00000000000010010001
+00000000000010110011
+00000000000010100010
+00000000000010110011
+00000000000011100011
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010000001
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010010001
+00000000000010100011
+00000000000010110011
+00000000000010110010
+00000000000010100011
+00000000000010110011
+00000000000010110010
+00000000000010110011
+00000000000010100001
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010000001
+00000000000010010011
+00000000000010100011
+00000000000010110011
+00000000000010110001
+00000000000010110001
+00000000000010110011
+00000000000010110011
+00000000000011110001
+00000000000010010001
+00000000000010010001
+00000000000010110001
+00000000000010100001
+00000000000010100011
+00000000000010110011
+00000000000010110001
+00000000000010100011
+00000000000010100011
+00000000000011110011
+00000000000010100011
+00000000000010100010
+00000000000010100011
+00000000000010110010
+00000000000010110001
+00000000000010110011
+00000000000011100001
+00000000000010110011
+00000000000010110001
+00000000000010110001
+00000000000010010010
+00000000000010110001
+00000000000010110011
+00000000000010110001
+00000000000010110011
+00000000000010100011
+00000000000010100011
+00000000000010100011
+00000000000010110001
+00000000000010100011
+00000000000010100011
+00000000000010110001
+00000000000010110001
+00000000000010100001
+00000000000010110011
+00000000000010100011
+00000000000010110011
+00000000000010110011
+00000000000010110001
+00000000000010110001
+00000000000010010010
+00000000000010110011
+00000000000010110011
+00000000000011100001
+00000000000011100011
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010000001
+00000000000010110011
+00000000000010000001
+00000000000010110011
+00000000000010110011
+00000000000011100011
+00000000000010110011
+00000000000010010011
+00000000000010110011
+00000000000010110001
+00000000000011100011
+00000000000010110001
+00000000000010000001
+00000000000010110011
+00000000000011110011
+00000000000010010001
+00000000000010100011
+00000000000010010011
+00000000000011100011
+00000000000010010011
+00000000000010100011
+00000000000010100011
+00000000000011100000
+00000000000010110011
+00000000000011100011
+00000000000010100001
+00000000000010110001
+00000000000010110001
+00000000000010010010
+00000000000010100011
+00000000000010000001
+00000000000010110011
+00000000000010100001
+00000000000010110010
+00000000000010110010
+00000000000010010011
+00000000000011100001
+00000000000010110011
+00000000000010100011
+00000000000010110011
+00000000000010110011
+00000000000010100001
+00000000000010100011
+00000000000010110010
+00000000000010110011
+00000000000010110011
+00000000000011100001
+00000000000010110011
+00000000000010100011
+00000000000010000001
+00000000000010110011
+00000000000010100010
+00000000000011100011
+00000000000010100011
+00000000000010110011
+00000000000010100011
+00000000000010010001
+00000000000010110011
+00000000000010110011
+00000000000010000001
+00000000000010110011
+00000000000010110011
+00000000000010100011
+00000000000010110001
+00000000000011100001
+00000000000010110011
+00000000000010100011
+00000000000010110011
+00000000000011100001
+00000000000010110011
+00000000000010110001
+00000000000010110011
+00000000000010100011
+00000000000010110001
+00000000000010010010
+00000000000010110010
+00000000000010110011
+00000000000010100011
+00000000000010100011
+00000000000010100011
+00000000000010110001
+00000000000010110001
+00000000000010100011
+00000000000010110001
+00000000000010110011
+00000000000010110011
+00000000000010100001
+00000000000010110011
+00000000000010110001
+00000000000010000001
+00000000000010110011
+00000000000010100011
+00000000000010110011
+00000000000010110011
+00000000000010010011
+00000000000010110011
+00000000000010100011
+00000000000010110011
+00000000000010110011
+00000000000010100011
+00000000000010110011
+00000000000010100011
+00000000000010110011
+00000000000010110001
+00000000000010100011
+00000000000010110011
+00000000000010010011
+00000000000010110011
+00000000000010110011
+00000000000010110011
+00000000000010100010
+00000000000010110001
+00000000000010110010
+00000000000010110011
+00000000000010100011
+00000000000011100010
--- /dev/null
+01000100110001110110
+00001001001010100011
+00000001010101011001
+00000000010101010010
+00000001000000010001
+00001000000011110010
+00000000000111010011
+00000000000010010111
+01000010000000111001
+00011100000000111110
+00000001010101100011
+00100010011100101000
+00010011000110000101
+01100000000111010010
+10010111101110001110
+01100000100011100011
+00000000010010010011
+00011001001000000000
+10000000000111000010
+10011011011111011011
+00000001000011110000
+00000000000011111111
+00010010000010011111
+01000000000111101101
+00100000100011110111
+00000000000011101101
+01000010100001010110
+01000100100101001010
+00000000001001100000
+00000000000011000110
+00000000000001000011
+00000111001010001110
+00000000101000110001
+01000010001100010101
+00000000101000101100
+00101100001101110001
+00001000000111110100
+00000000100010000001
+00011001101010011011
+00000001000011110011
+01000100110101101011
+00001100010101000101
+00000000000001000000
+00001000000011110010
+00100000010111010001
+00000010000001110011
+00010001000001000010
+00000000011110010111
+00100001000011111101
+00000001001010010100
+00000000000010100001
+11000010110010000010
+00000011000111010000
+00001111111000001110
+00000000000010110100
+01000100010101010101
+01000000010101111001
+00000000100010011111
+00100100001010001100
+10000100000101011110
+00000100001011011011
+00000000010110101000
+01001000010101110101
+00000000001111010111
+00010100010100001001
+00000000000001000111
+00000001100101111101
+01000000010001100110
+00000100000000010010
+00000010000101001001
+00000000100011000001
+00010111001010001100
+00000000001010000110
+00000000000111100010
+00000000010001010011
+00001000001010001010
+00000100010010100101
+00000001010111110001
+00000100000011010000
+00100000010000110010
+00000000000000110110
+10000010011011000100
+00000001001011111111
+10000011000010100100
+00000000000110010100
+00001010000001111010
+00010011000110000100
+01010110000110001110
+00000011001110101010
+00000000000111100110
+00100010100111100010
+00000100100111110111
+10010010100010001100
+00011011001011111110
+00000000000111110011
+00000000101001110001
+01010110001100001110
+00000001000011000011
+00010001100010110110
+00000100000100110010
+00000000000000111011
+00000000000111010010
+00001000000011001110
+00000100110011010011
+00000000000000010011
+00000100000011111110
+01000010101111011100
+10000000110001110110
+00010011000111110101
+10000001000110000100
+00000011100010000100
+00000000000011010001
+10000010101010100001
+00000000010110101010
+00000001000010000010
+00000001101101110001
+01000001010110011111
+00000000011100010101
+00100110100001111101
+01010000001001010111
+00000100110111110001
+00000000000000010111
+00000000000011001110
+00000001000010000110
+01000000001011110010
+00000000011110101000
+01110011000001111110
+00000010100011000001
+00000011110010100001
+01110100101010010001
+00000001000010010001
+10011101011110011001
+00010000000110000011
+11000000001110110000
+01000010000001010010
+00000000111110001101
+00000000001111110000
+00100000000011111100
+11000011000010011011
+00110011110000110110
+00100000000010010110
+00100011000011111100
+10011011111001001011
+00010000000011110010
+00001011000101111001
+00000010101001110000
+10000001001000000101
+00001000000001010000
+00000011000110010110
+00000111100100110110
+00100001111100001100
+00001111110001110101
+01010000000111110011
+10100001010011010000
+00000000001010010010
+00000000100001110111
+00000000000100100001
+00100010000000111010
+01001000001110101000
+00000010000001111110
+01000001000110111000
+00000000000100010111
+11010110100100010101
+00000001000011111111
+00000010100010000100
+00010000000011010010
+00000111001001111100
+00100001100010111101
+00010110100010010000
+00000110001001011011
+00000100100010000011
+01010000000011010110
+00000001110011110001
+00000110010101010010
+00100000010010110110
+00000100000001000010
+10000000000011111100
+00010011011000110010
+00000011001010001100
+00111000011011000100
+00000000011110010111
+00000110110101010101
+00000000000101111001
+00000100011111010100
+01000000001111010000
+00100100010101001111
+00001000000111111101
+01101000000111110010
+00100100001010100011
+00001100001010001000
+01000010011100110101
+00000001000010110100
+10000100001010000011
+00011000000111101100
+00000000010010000010
+01000100000010001010
+01000001100001101011
+00011010001010111001
+00001111111111000011
+00000000000000001000
+01011100011011100111
+00000001011011000000
+10000000000111111010
+00000100010010100100
+01000000010011001110
+11100010000101010110
+10100011010011000000
+00100100010100001000
+00010100000111010111
+00000000010011111100
+00100010101000111110
+11000110100011000001
+00011000000001000100
+00000011101000110000
+00000010000001100101
+00010011000010010011
+01010010010110001110
+00100010110010100111
+00000001111111000111
+00100000001011000111
+00000000000011001100
+00000001010110001011
+01000000011011000011
+00000000000111110010
+01010110001110101011
+00000000000111110110
+00100010100111100111
+01010110000110001010
+00001000000010000010
+00000000000001001100
+10001001011001110001
+00000000000000010111
+10000000100001110011
+01000000000111100011
+00011000000110100011
+00000100101110000010
+00001000100011111010
+00000000000011000000
+00000000100000010010
+00000000000010011101
+10000000000011000000
+00010110000000010111
+00001010100000111111
+01101010110011010011
+00000010010010111000
+00000010010010111000
+00000010000000000111
+00100100100011110111
+01110011001111010011
+00010110101010001010
+00100000110010001000
+01011100011011110011
+00000010000101110001
+00000001100010010011
+00000001000001000011
+00010001000011010110
+00000000000011000101
+00100000001101100001
+00000000000111010011
+00111010100011011010
+01000000000001010101
+00100000000011100101
+00000000100011101000
+00000010000011100011
+00001001011110000111
+00000000001110100010
+00001011001111110000
+00000100010010010011
+10000100100001010110
+00000000000011100011
+01000000000111110000
+00100010101001110011
+00000000001010100100
+00000000001001110001
+00000000100011100011
+00010000111001110111
+00110000000000010110
+00000100100101111111
+00000000000111010100
+00011000000110010010
+00000010100010101000
+00001001000011110000
+00100000110010100010
+10011001011110110001
+10000100010100001011
+01001100101010001000
+00000110001110101011
+10001110000010010110
+00010100010011010110
+10000010001000111100
+00010110001110010111
+01000001000101110001
+00000000010000110000
+00000000011111110110
+00000010001010001011
+00100000010011011001
+00001100011101111001
+01011100001010001010
+00000000010010100001
+00110011000110001100
+00000000000001110011
+00000001000001000010
+00001011010010010011
+00100010000110001010
+00000000100110000010
+00000100101010110110
+00000100000110101100
+00100000000001100100
+00000000010011110101
+01000001011001100000
+00000010000111010011
+00000000000010000010
+01010000010011110000
+00100000010110001110
+00000000011000101011
+00000100000010100100
+01000001000111010010
+01110001000010001111
+00000001000001010000
+10011000000110110110
+00001011001111011010
+00011011000000101000
+00000001000011011010
+00010010010100111100
+00000100000010110000
+00001110111000011010
+00000000001010110010
+00100100000100101101
+00000001000010010110
+01000100000010001010
+00000000000011111001
+00000010000000110110
+00000000110011100011
+00100011010010010011
+10000000000000010111
+00000000011110010110
+00000000000011100010
+00000010000010000110
+00001010000011011010
+00000000000001110011
+00100000111100001010
+01000111000010001010
+00000011001110101110
+00000011001100101111
+01011100011010001000
+01000100000001111110
+10000000000110001110
+00000001000111010011
+00011010000010111001
+00010010000011111010
+00000000000000111011
+00010000000110000011
+00000011000010010110
+00000000000111001010
+00000000101000110010
+11100010010110010111
+00001100011110101010
+00000111111100000100
+00001100011011110000
+01000100101010000011
+00000000000011110010
+00000000001010010011
+00010000000000001100
+00100001000011001001
+00001110100011110100
+00010011010010010011
+00000001010100001011
+00000001111100010011
+00000100001100110011
+00100000000111000100
+01000001100101110001
+00001001001011010010
+11100010000101001110
+00100000001110010011
+00000100000101010011
+00000001110010000010
+10000000000011011011
+00010000000101000010
+00000100001000010110
+00110010100010011111
+00000001011010010011
+10000000001001010011
+01000001000010000000
+00010100111110001101
+10000100001100010111
+01000011000010011011
+10001000000001010011
+00000000000100010110
+01000001010001011001
+00000100100011001000
+00011100100011001011
+00000000010011111100
+00000000111010111010
+00001110100011111110
+10011011011101011011
+00000000010000110010
+00100000000100110101
+00000001100001011101
+00010001000010000000
+00000011001100001101
--- /dev/null
+10101101111110011111
+10101100011000100000
+00001010111110111001
+00001011100110000011
+00101011111010101000
+00011001110111100101
+00010011101011010001
+01001010110110111001
+00000001111011100111
+00110100010010011111
+00011111010100111111
+00011001111000101101
+00101110110101011101
+00011010011110001010
+00100001101010001100
+00111010111101001111
+00001010111110000111
+10000111010001011110
+00100101101000000111
+00111111010111001000
+00100101010110001111
+00011111010010111110
+00101110110101011011
+00101011100110000101
+00100110101111010000
+10111110010111010100
+00011111110011100101
+00011010101000110100
+00001010011011001111
+00000101010110101111
+00010010010000011101
+01101110111010011101
+00011101111001101111
+01011101011100110111
+00010111100110111111
+10110111010000011110
+01001000110010111110
+00011011010101000010
+00011011100010111011
+00010110010101010110
+10100110000011011110
+10010100100110011101
+00001011001100001000
+00100111000011101111
+01010110001011010011
+00110011111001101011
+00111010001010000010
+00100110100110101101
+00000100010110001110
+00000111010000000110
+00011100001010100010
+00011000111100010100
+10110100110000001011
+11110110010011101000
+00001111110100101001
+00011001010001111100
+01101001011101101010
+00000111101011001111
+01110110110100001010
+00011011110011000001
+01010100110101110110
+10011111100110010110
+00010110101110011010
+00111110001110011110
+01111010110111001100
+00101110000101011000
+01101110011110101101
+00101010010010001001
+00101000010011101011
+01001011010110010111
+01101100001010001111
+11001001100001100101
+00001011100011101111
+10111100010100011001
+01011011100010011010
+00111001111111101111
+00010010010001011101
+00110001010010111100
+00101110000110001100
+00011011101011110001
+01111010000111011011
+10001000100111011101
+00111011110010111010
+00111001011110111000
+10001110110101011101
+10010101000011000001
+00010001111010010100
+00000101010110111001
+10101111001110000101
+10000101001010011001
+00101000010100000001
+00001101101000000101
+01011110110100110111
+01011001000111010111
+10011110100000010110
+01101110010010111100
+01011000100011010001
+00011011010011110110
+00001100011000101111
+10001100111010100011
+00011010001100101011
+11101101100010101110
+01011011110010000000
+00101001000011101101
+00111001100111110110
+10001111000101000111
+00001111010011111101
+00010001110000101101
+00011011000011010010
+00001001011011111110
+01000111000010111111
+00000000011011101110
+00111010011110101000
+00001110001001101000
+00100011100011110110
+00101010010001011100
+10010100101111011110
+01000101111111000001
+00001001110111010010
+00111100111010100011
+10001010110101011100
+10011001100100111111
+00110001010001001010
+10111010001010010100
+00001011111010111111
+00011011110010110101
+00111001010010011111
+00100011100100011110
+00011011101001101000
+10001110010010100101
+00101100101111001111
+00101010110000010111
+01111101101010101110
+10011110101000010111
+00001111000011101111
+11100111101011011110
+00001000111000001011
+00011010011011011011
+00101001100000011010
+00110101010011010100
+00111001010101101010
+00111010101001101000
+10000101000001111001
+00001101111110011001
+00011101111001101001
+00101110111011111111
+10111101011011110000
+00100001101100111000
+10011101000011100001
+00001100000000011010
+00011100110001101101
+00111101000110110101
+00011100111011010100
+00010011000111001100
+00010101010101001110
+00110010010001011100
+00101110111100011101
+00011010110011001011
+11000010000010110000
+00011011011001011001
+00001111010011101101
+00001100011010001001
+01111010000111110111
+00111110100101101011
+01110011110010001001
+01101011111100001001
+00001100100001101110
+01001011110110010111
+01011011101110010110
+00100011100100011001
+00111010110111110111
+00010101101011111101
+00101011011101011111
+10000011100011101111
+00110110001001011110
+00110101111001011111
+01101001011010011001
+00001110111110111111
+00001011010100101111
+10011111101001101010
+00101111010001100101
+00011011100101101010
+01001110011011101010
+01001111100001011110
+00011111111100001111
+01011111000100111111
+00100011110100011110
+01011101001010100011
+00011001000000101010
+00001011110001110010
+00011101111001101111
+00011101110110110111
+00110101110000111110
+01110111001110001010
+00001010100110010000
+00000011011111101111
+00111110000111011110
+00100110000111011011
+00001111110010110101
+01101000000100110111
+01001110111011100001
+00011011010001000111
+10000101111101110000
+00011011101011010001
+10110010011000110011
+00011111110110110110
+01000001110110111001
+00100011110010111100
+00001100011010001000
+10100000111000110000
+00011010101001010111
+00111110100000100100
+10100111110110100011
+00110111110011101111
+00000010010001011100
+00010010100011100111
+00111001110000000110
+00101111010111100101
+00011100000100110011
+01011111111100000110
+01000011010010101001
+00011110110111110101
+00011111101001000110
+00011001110100101011
+11101101110010001111
+00100101010110111011
+01111001010011100110
+01010101010101110101
+11010010101101111010
+01011010000111011111
+00011100111010111010
+01010011101001000000
+00011010110110111101
+00000001110010011011
+00010010011111110110
+00101110111110011101
+00001001111000001001
+00111111001111011101
+10110000100010011111
+00101001011001101100
+00111101010010111011
+11101001011110111100
+00001111111111010001
+10001111110011100101
+11000011100001100011
+10000010100000101011
+00101110110100111011
+00111001100111011101
+00000010100011101111
+00111001111101101111
+00101110010010011110
+01111110100110101010
+10001011110001011110
+01011010000110101010
+01011001100011100001
+10011001100101010001
+00001111000101000110
+01011011101110010001
+10101011110010000111
+00101010011101100001
+01011000111000110000
+10100000110001110111
+00001110001010001000
+10001001010110111111
+00100000111000110000
+11110101010110001111
+00111010001001101000
+00011011101001101101
+00001010011010101011
+00000100100011001101
+01100010011100101000
+01111011110010111101
+01001111010110111101
+00100110100011101111
+00011000111100000110
+00100011100011101111
+00010101001111110110
+00010010010111100110
+00000111011101011101
+00010101101100101000
+00010101011001100001
+00101001100111100111
+00001010000001101111
+00001011100011011100
+00110100011000111001
+10001101110000011110
+00110110000111001101
+00011010111011011110
+00001011010000011101
+00010111000000101010
+00011001000001110000
+01101100001010001101
+10001101111111001000
+00011010011111001101
+10011010011011011111
+00101011111100001001
+01100000001101111101
+01111110011100100001
+00000100000011111011
+00000100010110010100
+00010101011001000111
+00011101011000101111
+00010000010000011001
+00111000010111110110
+00010011011011101011
+11000011100000111001
+00111001000101110110
+00100011000010010011
+10100011100000100011
+10000011011100100000
+00001010111001111010
+00011000101000110101
+01110101110110110101
+00001110101111011111
+00011100110001000111
+00001111110110011110
+10011001110111101111
+00000011001011100100
+01101000111110011001
+00101011011111001100
+11001001000011010100
+00101001010101101010
+01001001010010000111
+00000101011001111011
+00111111001111111001
+00011110010110110010
+00011111000010110111
+00111001000101101010
+00011010111010101101
+10000001011101001101
+01111100111110011110
+00011011100101010001
+10100010100111101000
+01101001100010001101
+00101110110101011101
+00000101010110001111
+01101001111100101111
+00111110000111011001
+00111010100100111000
+10111001110100101101
+00111010001111010000
+00001000000110011010
+00110101110101000110
+00011110000100001101
+00011011010001011100
+00001010101001110000
+00111011111101101111
+00101000101110001001
+01101010100101011010
+00111100110111001110
+00010101000111010111
+00000111011101111011
+00010010010001011100
+00010110000110101011
+01001011100101010001
+00111101100010101111
+00111110010110110110
+00000100010110001111
+00011101010101101010
+00110010011010111110
+00101110110101011101
+00101101101000000110
+01010101110000110001
+10111100110000001001
+01011010111000111011
+00011010101100111001
+00011110111110101000
+00010001001011111001
+00000011001000110000
+01100101111011111000
+10100000111000110000
+01111011110010111101
+00001101111111111001
+00001100110011110101
+00011000000101010110
+01000101110101110001
+00010010010001111001
+00011011110000011101
+11011010100010111110
+00001110110110111111
+00000001100011111011
+00001001100110010101
+00101110111110011100
+00011001000110100011
+00111101110000110010
+00001011110001001110
+00001100101000010110
+00000100010000011010
+00001000111000001110
+00010000001110111101
+00100010001111001100
+00000001110010011101
+00101000011011111011
+00000001100011101011
+00101011111101001011
+00111001110000001001
+00101000100101111011
+11010110000100001101
+10011110101000000110
+01011010000111011111
--- /dev/null
+00000001001010000001
+01011010101010000011
+01100110011110100111
+00011000000110000011
+00000100111100010010
+00000001101110111111
+10000110110000101101
+00000001010010001100
+01101100000110000000
+00001001100010100010
+00000100000111101101
+00001011110100011001
+01000011001110000000
+00000101011011010111
+00011000000110110001
+00000000010110011111
+00100010100100110011
+00000111000111100000
+00000000001000011100
+00100000010011100100
+00101000110010000110
+00110010001110100001
+11000100010010110110
+00000011011010100000
+01111000000010101111
+00000010101010000011
+00010100100111100001
+11100000011110010001
+00000000100000011101
+00000000001110010011
+01001100111110010000
+01111000001110101010
+00000001001010010100
+10100000001110011101
+00000001011100010110
+00110000000100011111
+10100000010011100010
+00010000011001100010
+00000011011110010110
+10000101011011010101
+00000000000110010111
+00100000111011000010
+00100000000110000100
+00111000100010000110
+00100001000110010011
+00100011000111111001
+00000101010011010101
+00010000000001111111
+00101000000010100010
+00100000010111111101
+00000110010100011111
+00101001001100010111
+10000000010100011000
+10001110101010101101
+00010100001110100011
+00011000100010011011
+00010000000100011111
+00010110011010011110
+00000000110000000110
+00001000001110010011
+01001010000001101010
+01110000101010001100
+00010000000111010011
+00001100110110110010
+00100000010111010101
+00000001000110000001
+00000001011000000100
+00000000100101010011
+01010000110110111110
+00000000101110110011
+01001001010011101111
+10010000001010100000
+00000000000110010010
+00000000101010010001
+00000000000101011101
+00000110000010100111
+00000010000000000011
+01101000000100001001
+10000000000110000111
+00000000100101011001
+01100001000000110100
+01100010000110101011
+00100000101010100100
+00000100011010110011
+10000010110010100100
+01000000100010000001
+00000000010000101000
+00001000000010110100
+01010011001010110011
+11001000000110100010
+10000000001110001111
+00001000010000011001
+01100001101010000001
+01001000000100000011
+01000000010001000001
+00000000000111000100
+00000010011110000100
+00000010000001101101
+00011000101111010011
+00010100101110011001
+00011001100101110011
+00000100001010111111
+11000001000101010000
+00010100000001000001
+00000101110101110011
+10000000000110101001
+00000101000110010110
+10000000001010100100
+11000001001010000001
+00100000110011010000
+00001000001010011111
+00000001000010010111
+10000000001000001111
+10000001101010000100
+00000000100110110001
+00000000000110100111
+01000101111100011000
+00101010001011000110
+00000000100010111011
+00001110111100001011
+00011000100010000101
+00000000000111100011
+00010100000100100111
+00000000000001010110
+00000000001110101010
+01001000001110110101
+00000001010111110100
+00110110000101011101
+00100000010010011010
+00100101000011100110
+00000000010000010100
+00100000010000101101
+00000101010010010010
+01010000101110110011
+00011000000000000001
+01100000100110001111
+10000000000000011001
+00000001000110100001
+10000000000010100101
+01001001001101110101
+00000001000100011101
+01000000010110001110
+00000100000010110000
+00100010001010000101
+10000000000110000011
+00110000001100100011
+00000001001110110110
+00100101101110000011
+01110000010010011101
+00001001000010001111
+10100101010000010010
+00000001010000101101
+00000010101101111011
+00000001010110001000
+00000000000110110000
+01010100100111100001
+00000010000010000011
+00010000000010100100
+00011000010000111110
+00000001000110100001
+00000000001110010000
+00100001100111011001
+00100100100101100011
+11110101111000011000
+00100011011010100100
+01100000001100010110
+00001100011000101100
+00100001010011110010
+01000101111000011000
+00000110010000111000
+00000111010000110010
+00000100000111011010
+00000100001110110011
+00000110000011011010
+01100110000010011100
+01010110101111010101
+00010000000110010111
+00000101010011111000
+01100011010110010111
+00000010010000000001
+01101100010110000100
+00000000010110100111
+01000010010010101110
+00000001011000010010
+00000110010010110100
+11001000100110111110
+00000001001111010011
+00000010001100011011
+00101000101100011011
+00001000001011000110
+00000000000000101100
+00000000000111000011
+00000000011110010011
+00000000001110001000
+00000001100111001111
+00010001001011011001
+00000000000010101111
+00011000100111010110
+00000000100000000010
+01001111101010100100
+00000010010000010100
+00000110000000101100
+00011000011000100001
+11100001100011111000
+00000000000010111010
+00001100101110010001
+01101000000101010110
+11000011010100000111
+00000011010010010010
+00000001001100110000
+00010000100001101110
+00000100110001110010
+00000000001110101010
+01000000011110000000
+00000101001110110000
+00001001100010001101
+00000101011110111001
+10000011010000011101
+00000001010110010111
+00011000000111010000
+00000010110010001111
+00101000000010110011
+00001001011010011111
+00000000000000010010
+00000001010110111101
+01100000000101101010
+01011010000011101000
+00001000001010101011
+01100010001111101011
+10001001100000100010
+00001010110110110011
+00001000011010000010
+00010001000010100101
+11101000100001011011
+00000110100001101110
+00000100000110111011
+00000000100101011000
+11000000000110000001
+01111000000111010001
+00000011101010000010
+00000010010010100110
+00001011011110100100
+00001001001110000001
+00000000100100100111
+00000001001010000100
+00000000110010111111
+00000000000110010010
+00000110100010001111
+00000001000111100001
+00000101001110110000
+00000001001110010000
+00000000111111111101
+00000101001110010011
+11000110100110111000
+10000010001010110001
+00000010010110010001
+00000000010011000100
+00000000110000010110
+00001101001110010110
+00000001010000111101
+10000001001011011001
+00000001110111110011
+01101000001011000100
+10000000000010100110
+00011000011001100010
+00000010011110100110
+00000110011010100000
+00000001000110010000
+00100001010111110110
+00000000000001101101
+00000001001000011110
+01000000000010000011
+00110000000100010011
+10000000010010001111
+00000000001010111011
+00000000000010110110
+00000000010010101111
+00000000100010011111
+00000000001111010100
+00100000010001001010
+11000000010100000000
+00000000010010010111
+00000110010111110110
+00001000010000111100
+00101000110011100011
+01110111100110010001
+00000100000110001101
+00000100001010010111
+00000000000111111110
+01001000000110010001
+00001100001110100110
+00000000000010100010
+10000110101010100110
+00000100000110010110
+00001001000010100111
+00000000010111011111
+00000000000011111000
+00000010100010100101
+01100000010111001000
+11000101001000100111
+00001000001010110010
+00001000110110110010
+00100001010010100111
+00000110000110101001
+01101001001011000110
+00011000001101000011
+10000011000001100011
+00001011010110011010
+00100000000101110010
+00000000000101101111
+10000010000001101010
+01111100000010110110
+00001001001101000111
+00110000000111010000
+01000001010110010011
+00000100001010110000
+01000001101110100000
+00000101010010000111
+00000000000110010110
+01110010111000011101
+00101000001110000000
+00000010110010010110
+00101000000011100010
+00010000110001001110
+00000000001110011101
+01000010101010010010
+00000000010000010100
+00001110111100011011
+01000101000001001100
+01101000110010000110
+01010100100111100000
+00100000000111010101
+00000000000010011011
+00000000000110010011
+00000001011000011011
+00000110010010110100
+10001000000010101011
+00000110101010001100
+00011000000110000000
+00000000001110010111
+00100110001110010011
+01001001011011010111
+00000001000110010111
+00000000001110010101
+00000000000010011111
+10000001000110000011
+00011000001001011100
+10000000000101110010
+00000110111010100110
+00000000000000101010
+00000000000010000001
+00000010000110110110
+00000000001111100111
+01100001010110111101
+00000010000110000010
+00000000001010000011
+00000001001110000001
+01000000100000011101
+00000010110010000111
+01000001100110101111
+00000000000011111101
+10000000000010100110
+00000100000001001001
+00000000000110010000
+00001010111101011011
+00001111010110011111
+00001001001010111111
+01000001010110100010
+00100000000011111011
+00000000000110000100
+00100010000010011011
+00000000010010000001
+01110010100010000000
+10000001000111100011
+00001000000011011011
+00000001010010011101
+00001000100010011011
+00000000001101011110
+01100010010111101101
+01000000000000011001
+00000000010010010000
+00000010100100000001
+00000000100010001001
+01000000001010010010
+00010111010010100101
+10000110101010010000
+00000001001110111000
+10000001111000010111
+10000000110110101111
+00000000100110111100
+00000110111101011100
+00000101001111000101
+00000100011001101001
+01000000001110111101
+00100001010011100011
+00000001110111100100
+00000010100000101000
+00000001010010100000
+00001000000110110011
+10001000110000100110
--- /dev/null
+00010011110011100010
+00000000001011110100
+00101001100000000010
+00000010001000110111
+10100100111001011011
+00010001001011110110
+01000000000010101111
+00111000101000010110
+00010100100010111111
+00011010000000001111
+00000000001101011101
+01000000101010100111
+01011001011010001101
+01000010111011100110
+01100101010110110111
+00000000001010011111
+10000000000010100111
+00000000000010001000
+00000000000010000001
+00101101001010001011
+00100001101010110110
+00111000100010010100
+11001101101110010010
+01100000000010000011
+00000010000110110101
+01110000000000001110
+10011000010000110101
+00000011000010101011
+10011110001010000011
+00110100111011000011
+00010000001011000001
+11000001001010110100
+00000001010011110101
+11101100100000001011
+00000000000011011111
+10100101111110101110
+00000000100010010111
+00010000001000100001
+01100000000010100111
+00101101101110110110
+00001000101100010010
+01011001100010000100
+00000000001110000101
+00001000001011100111
+00100100010100100111
+10101000001010110110
+01100100000100000100
+00000000010000011110
+10010000000011001110
+00101100011010000011
+00111001000010000001
+10000000000010010000
+00100000001110000111
+01100000000010001111
+10000000000110010110
+00000000000110110100
+00001000000110000101
+10000110000000101111
+10100000101010000100
+00111011100101100111
+00011110100011110101
+00000000100011101101
+00000001000010000111
+00000100001010000111
+10010001000110000011
+00001000000111110011
+00111010000110000010
+11010000001011001000
+00000000101100000011
+01000000000010001110
+10110001011111011111
+10101100010111010101
+00000011100001011111
+01101010011111101010
+10000000000011010110
+00000000001110001110
+00000110010100011100
+00000000001110011100
+00000001000110000011
+00000000101010110010
+00000001000010100011
+00000100001001100101
+00111011000010000110
+00000000001001010011
+01010001010010110111
+00000100001010111001
+00000000000010001101
+01111100100011010110
+00100000101010011110
+00100001100010000100
+00010110000010011100
+00101000001111110100
+00100100000110011100
+00000000000010101100
+00101101000001010001
+00000001010111001011
+00000001000011010100
+01000000000010000001
+00110000110010110010
+01101110100010010100
+01011001000010010111
+01000000011110001111
+10100000011010001111
+00000000001010001110
+00111010001001010011
+00001100000001000011
+00000000010011110011
+00100100011110101100
+01000000000001110111
+00100001000110010100
+00011000010111000110
+01100100110011110001
+00000000010000110000
+00000100011111001111
+10110000110110110110
+00000110000010000110
+00000011000010110101
+00001100100011000111
+00100110001000001000
+10010101000010111111
+00110100100110111011
+00000000000111001100
+00000001010110010100
+00011000110001111001
+00111000001010010101
+00000000000110100101
+00000000001010110101
+00010000000000000101
+00100110101001001101
+00000010010001011110
+10100101011010001111
+10000010100110010011
+00000000000010001011
+10011001100110101111
+01100100110011111001
+00000000000001110110
+00000001010000001001
+00011101010111101111
+00101001000001001111
+00100110000010010010
+00000000000010111111
+00000000100010000011
+00111100100100001100
+00000001010101010101
+00011001000011110111
+01000001010111100010
+00000000000010000011
+11000010010001011110
+01011000001111110110
+00000011101101100111
+11101101100011100101
+00010000011011000101
+01000000101010010101
+00100001100100011101
+00000100001110010101
+00001000100000000101
+00000100001000010001
+10101000100000101001
+01101110101010011100
+00000000101011100000
+00100100000110010001
+11101110011100001100
+01000110000000000101
+00000100000010101111
+00000001000010000011
+00000100000010110100
+00000101100010111111
+00011001100001111011
+00100101000011001100
+00110100110111101011
+01000100000000001111
+10100100011100101100
+00000000000011101001
+00100000000010001001
+00010110001000011100
+00000100100101101101
+00010100100011111111
+00100011000010101011
+01000000010011011111
+00101101100100101110
+00000000000011101011
+01101000000110011111
+01000001001111111110
+11000011001110110100
+01000000000001100111
+00000110000100010110
+00000000000011110110
+00100000000011000111
+00000000000011110101
+00011001000000000011
+01000001001011101111
+01100100110111110001
+00100101000110111111
+11000000110001000111
+00100100000111100001
+10000101001000011001
+00000100110011010001
+01100100100000011111
+00100001001010010111
+01100011100001100111
+10100100100010111110
+00000000000010110111
+00000001001010100101
+00001000000010010110
+00000000000010001010
+00000000000010100011
+00100011001010000001
+10000000100011110101
+00000000001110110100
+00011000000000100100
+00010000000000000011
+00000001000000000011
+01000000001110100011
+00000000000110000100
+00010001010011101101
+00100000000000000001
+00000000001010111011
+00000000000110000010
+00000000000011101101
+11000000001100101101
+00000000000000110100
+00100000000101000011
+01000100011010010101
+00100001000001100110
+10000100100010010110
+01101110011100000001
+11000011010010000100
+00010000101101110011
+00000000000011011111
+00101010011000111101
+00000100000110000100
+00100010010110000111
+00000001001010010111
+10000000111000011101
+00100100101101011111
+10100101100101001011
+10010110110011100100
+01001000101000000000
+10000001000010000111
+00000000100010000011
+00100000011000001111
+00000000001010010111
+00000000000010110100
+00000000100010111110
+00010000000010110111
+01100100110011110000
+00000000010110100110
+10110000000010110111
+00000110010010010011
+10110100100110101110
+00000001001000011101
+00010010010010000100
+00100100010110000101
+00000000100010110111
+00100110011010010110
+00000010000110111110
+11001100001010100111
+00000000101101111100
+00000000001000011001
+01111110110010110110
+00100110000110010111
+00000110001010010101
+00001010101011000011
+01001001101000001111
+10101000001000100000
+00000010000000011111
+01000010000110010100
+00000000000000000001
+01101100001011001110
+00000101011101011010
+01000000010011010100
+10101000001010100111
+00000001000011110101
+01000000111010011101
+00000000000000000011
+10000000000011100100
+10000000000011111101
+00110100010001111111
+10000000000000000001
+00000000000010110111
+00000001001010010010
+01101101100011111010
+11000001001010000111
+00100000010011110101
+00100000010010001000
+01000001101011100110
+00000100001111000011
+00000000000010001011
+00001000011100000011
+01100000011010001111
+00000000000010010110
+00001000000110011110
+00100100010010011110
+00010000000000011110
+00000000000010100110
+00000010000010101100
+00001000010110011010
+01100000000110000011
+00000000000011100011
+10010000010000011100
+00000000010010011100
+00010000001000010110
+00000010000010110110
+00011001010111000111
+01100000000111011110
+00000010000010000110
+11010001100010000011
+00000000110111101000
+00000111000100000111
+00100000001010100110
+10000100000000000010
+10100000100000000100
+00000000011011001000
+00010000000000000011
+00001000110011101101
+00101010011001011111
+00001000110011101101
+00000000011010010001
+10000000001000001100
+00001111000000010010
+00000001000110100111
+01000001101101100110
+00000100000110000111
+00000100000000000100
+00000000101011100000
+00111101101100010010
+00001000000110010110
+00011001001011110101
+00001000001110000111
+00100000010010000001
+00000000011010011101
+01010000000010000110
+00100100010100000111
+00010000001010110111
+00000000001011001111
+00111100010010100110
+01110000000000001010
+00000000000001110101
+01000000000111100011
+00000000001010000110
+00000000000010100100
+00001001010111111100
+00100110001000011111
+00100100010110010111
+10110100100010001110
+00001010100011110101
+00101101100100101110
+00111010001001010011
+01000100010110010110
+00000101000110010111
+00000000110100000011
+00000100000110010110
+00000100000010110110
+00100000011000000111
+00100000000110110100
+00001000010010100110
+10000010000000101111
+00100000001010011110
+00101101110011111001
+01100101100101001011
+00000000001010111010
+00011111001011001111
+00000000000010001111
+00000010001110001100
+01111000000011001111
+00100010001011001000
+00100100001010010101
+00000000000010011111
+00000000001110110110
+00000000001000110100
+10111010001010000110
+00000110010010110011
+00000000011101001100
+00000101000010110110
+00101000011010110110
+00100001101001001111
+00000100010110110110
+00010000000001110000
+01101110011100110101
+00000010010011000011
+00000100100010011110
+00000010001010011110
+00100000000010000011
+00000000001010111111
+01001101100101001011
+00100000111010011101
+01101110100000010011
+00001001001110011000
+01001011000011001010
+00011101101111110111
+01001100010001011011
+00010001110011001100
+00011001001010011100
+00001001000111100110
+00000000100011100110
+00010000100111101011
+00000000001011111111
+10000101110110001011
+00000000011000000011
+00000001101010010001
--- /dev/null
+00000000001011111010
+00110001011111110110
+00000010011000010111
+00000101101101011000
+10010000000111110001
+00000000001010000110
+00010100010010101100
+00000000011011010111
+00000000000011011100
+00000001110111111100
+00000000000010010110
+00011110100110011111
+00000000100010011110
+01010000001110111110
+11110010100011010011
+01001110000110110101
+00001001101010000001
+00010000010001000100
+00000000100111010011
+00100111000111110000
+00010100001010100111
+00000110101001101010
+00000000001111101111
+00000001010001010110
+00010001110111111100
+01111110010001111111
+10100010111111011100
+00001101100111000100
+00000000010011011111
+00011101000011111110
+00101000011010011010
+01110000100011100011
+10001001011011111110
+00101011111001000100
+00001001110011000011
+00000000110111101100
+01101111011001110101
+10010110001110100011
+00000000011110000011
+00100011001110100101
+00000000011011000101
+00000000111011011010
+00011111011010011000
+00001100110011010101
+00011100011010011010
+01001000010010011111
+00000000000001000100
+00000111101011000110
+00000010110111001000
+10001011101010011110
+00010001110011111100
+00001100100110011011
+01011001000100110011
+00000110001111001011
+00000000001010110111
+00010101100010010100
+00101110011010011010
+00000010000001000100
+00000001000010100011
+00000001011110110010
+00000100001110000100
+00000000101111000010
+01110001111010110011
+00010100000110000100
+10100010000010101101
+00000000001100011101
+10000011001110111010
+10001001001111110110
+00010010001011101100
+01011000111110110111
+00011110000111100010
+00000010001110000001
+00000000101111110001
+00000001110100111110
+10101101110011010010
+00000000101111010001
+10010010000010101101
+00010000011111001110
+00010100100110011000
+10011100001101111111
+01010001111111111010
+10000010101010010011
+00100001011001111011
+00000011000010010011
+00011101111011000011
+01001001110011010011
+00000000010001000100
+00010010100010000011
+00001101100001010001
+00100000011010000111
+00000000100011111110
+00000100000010000011
+01110000101010110011
+00000000100111010111
+00000010001111101111
+00000000000010010101
+00001000101010000001
+00000000010001000010
+10011000010010000001
+10101011101111001010
+01000100001010011110
+00000010110111011000
+01000011101001011000
+00000000100011000101
+00000110010001111001
+00000011101110100011
+00001001010110100011
+01001000011010011010
+01001000011001000001
+01000101001010110100
+11010100001011111000
+00000000010011010001
+00000010000011110001
+01011000110110110010
+00000110001010111101
+00000101000001011010
+00001001000101101001
+00001101100110011011
+00000000000010111101
+00001010101110100001
+00100001011010111100
+10101011000010000011
+10011010010100000111
+00000110011111001001
+00101101111010001010
+00001000100111010010
+11001000100101010010
+00001000001010000000
+00110000101010110111
+01010001000011110100
+00001000001110000010
+00000000100111101011
+00010001110100111110
+01000100011010111000
+01010000000100100011
+00000010010011010101
+00000010011010011010
+00000000100110011111
+00011010100010000011
+00100100000001110100
+00101100101110000001
+10011001100011100000
+00010010010010110100
+10101101100111100101
+01000001001011000110
+00000000001111111010
+00010101000010100101
+00100001000110100110
+00010011000010101000
+00001011100011001110
+00000010010101010111
+01000100010010010111
+00000000110111101101
+00010010001011110101
+10001011101110011010
+00000000001010000011
+00000000000111010001
+00100100111011000111
+00001110000110101110
+00001110001011110110
+00000000111110101111
+00011000010010001001
+00000011000011110100
+10010110001110111110
+00001001110001101100
+00101100000011110000
+00010000000010000011
+00001101011011110110
+00010001110100111110
+10000000010011010111
+00000000001111101010
+00000001111001101010
+00000000010110000001
+00000000000100100111
+00010110001110000001
+00000010000011111100
+00100100001110000100
+00000101011010001001
+00000011001110010110
+00111111011100111111
+10000000001011101101
+00010000110111111110
+00000000000100000110
+00000001111010000111
+00000001100010010110
+01010111000011010101
+00000010011011100101
+00000101001111010110
+00100101101010001001
+00101111100111100100
+00010100001100110101
+10100010001101010111
+10111100011000100110
+10101011000011111010
+00010101011111001110
+00010000110011100000
+00000100110111100111
+00100000100010011101
+10000000000010001110
+01111011111100010110
+00001101100111110100
+10001100011011110110
+01000000000011111100
+00001000010001010100
+00000010101110100010
+10100101010011101001
+00000100100110011100
+10001011011111110001
+00000000000011111110
+00101000000010010101
+00000110011111111010
+00000000000011011101
+01000110010101010111
+00000000000011111110
+00101010100110110110
+00000111011000110011
+10100101011011101001
+00101100010011101010
+00000000000011110110
+00000010101110101001
+01110000110010011010
+00001011010010000010
+00110001010010010101
+00000000001010111000
+00100111000111110110
+00001000010001010000
+11001000000010110101
+00010010011111101101
+00000001101010010110
+01101100000001111100
+00100110001010111101
+00000100000001011111
+00000000010100001101
+00001000101111011010
+01011100010001111111
+00111101100111010101
+00111100010101111110
+00011000111111010111
+11010100001110101011
+10001000011011011100
+00111101111011010010
+10100111100010111000
+01010111010011010100
+00010100010010100111
+00111100010001111111
+00010100110111010011
+01100001101000110100
+01010100111111110101
+00001001001011010010
+00000000011011101000
+00010100011011010100
+00011100000110001100
+00000110011100111010
+00000000000010010110
+00101011001111001100
+00100100111111010101
+10010000101101110010
+10000100001111001101
+01000001010101010110
+00001110000010011110
+01001100011010110101
+00101010110110110011
+01110000101010110100
+00000001001011110111
+00000110001010111000
+00010000010001000101
+00000001000010100010
+00001100101010000111
+00001100111111010110
+10001001001111111101
+00000000000000110111
+10011010011100000001
+00000110001010111101
+00000000110111011111
+10010000111111000100
+00010001110100111110
+01000000111111010011
+00000100111111010101
+10100111000110111011
+00010101010111101010
+01111100010001111111
+00011111010010011011
+00100111001111110000
+10001000011001100010
+01000000011111011010
+00010100000011110100
+00000010100111111110
+00001100001110111100
+00110011111110011100
+00101100000011110110
+00000001000110001001
+10111011011001100110
+00000010001011100000
+00100000001111101010
+01010000101111010011
+00001101001011110110
+10000011001110111000
+00000001011010100001
+01100010010111000111
+01010100011010100111
+00000000000011101111
+00001000001110010101
+00001110001011010011
+00110011111110011110
+00000001110110010010
+10110111001110111100
+00000010010110111001
+00000010000010111100
+00111001101001010110
+00000011001111010110
+10010000011100110000
+00101001111111010110
+00010001011110100101
+01000110001010111101
+00010010000010000011
+00000000001011100111
+00000000100100100110
+00101110000111000100
+00000001100011110101
+00000010001111010110
+00001100010011010001
+00010000000011110010
+00000010000011110110
+00001100001111100000
+00000001001010000111
+00111110010011110101
+10000010100110111001
+00000010000011010100
+00011111010010011011
+01000000000010011101
+00010000000010010010
+00000001110101010110
+01011000000001110110
+00001010000010011001
+00000000000110011011
+00001000011010010000
+00000011010110000001
+00000000001010001110
+00010000000010010101
+01000111101110101100
+00111110010001111111
+10000000000010000111
+00000100110101110101
+00000011000010101000
+00000011000111011001
+00000100001111101000
+01111001000111110100
+00000100111110101000
+11101010110010000000
+00100101110000001101
+00000000111111011111
+00101111100110000111
+00101000100110110011
+00001001010001010110
+01010101110111011100
+00001000111110111011
+00000010000010111001
+01000011101000110101
+00000010000111100000
+00011010001011000111
+00000111010110000110
+00111011111001101000
+00000000111111011111
+00100001011000110111
+00010100110011100011
+01000100000010000000
+00100000000001111111
+01111110010010010101
+00000000000110010101
+00000000001010000110
+00001101011011101100
+00011000111110100110
+00100100001010010001
+00000001101011110111
+00001001110111011100
+00000010100010011110
+00011011100011000100
+00000000000010000111
+00010001110011100100
+00011111011001010110
+00010000000001010110
+00001001010010111101
+10000011000110000111
+00000000000111001011
+00000000011010000101
+00000100001111000111
+00101111000110100000
+00010001011000011000
+11110010010110011010
+00001010011011101100
+10101001001111111111
+00001011011110011010
+00000000110010010101
+00000000000011000111
+10000000000110100010
+10001010111111101100
+00000000010010010101
+00000000100110000010
+00001001100010000011
+00001000010111000101
--- /dev/null
+00100010100010001001
+00001101000011111001
+00010111000010100001
+01011000001011110001
+00101101000111100000
+10000000010010110000
+00000111110011100101
+00000000100010011010
+01000010100000100100
+01010000100001110110
+00000100011010111001
+00000111001100011100
+00001000010011100111
+10000000000011100111
+10010000010100100110
+00000000111111110010
+00001000100010001101
+00000010010010110110
+00000001100010100001
+00100011011001001001
+00000000000001100101
+00000000000010110110
+01011000000000101101
+00011000010011100000
+00000001101010110011
+00001001011010010110
+00000000011110011100
+00000000010100001001
+00000100100010010011
+00000011000110100110
+00000001100010100001
+00000000000000110011
+11001011010011001001
+00000100010101101101
+01000000000110110110
+00000001011000111001
+00000011010111011000
+00000000000010001101
+00000100011110011110
+00111000100100001001
+00000000000010101100
+00010000000010010110
+00000100000011100000
+00000010010010000010
+10000010011110100011
+01000000100010100001
+10000000000110110101
+00000001000100110000
+00001000000010100010
+00000111000010000001
+00000000100011100011
+01000011000011100010
+00001000010110011100
+00000010011111100001
+00000111010010010110
+01000000110101000110
+00010000000110000011
+00000100110011001011
+10001010010110010111
+01100000001011010011
+00010101111111101011
+00001001000010010011
+00010001010101100010
+00100010000010001101
+00000000010011110110
+00010000100111010100
+00001011001011110100
+00000000000011100111
+00000000000010001101
+00100011000111000000
+10010001000010111011
+11100010000101100101
+00000000001010111000
+00000001001001001011
+00010010011010111001
+00011100000000001001
+00000011000111100101
+00000000000011001000
+00000000100011011000
+00010010110011110011
+00100100011111001110
+01000000010110010000
+00010101100010010001
+00000011001110101010
+00000010011101111010
+00010000000101011111
+00000000000010000001
+00100100000001101110
+00110000100010000100
+00100000100010111001
+01001010110001111111
+01010010000000010110
+00000111110011101101
+10011100100011010011
+00110000100010000110
+00000010000001011101
+01000010000110101011
+00000001000011011010
+11000100010000100110
+01000000000010100110
+00000000000001100011
+00010011000011101100
+00000101100011110010
+00000101111011110010
+00000000010101000011
+00101100010011000100
+00100000100010001101
+00100000011111001100
+00010000000100100110
+00110101010011100011
+00010001010111100110
+00100000011010110011
+00000000000010110110
+00000100100011000110
+00000001000100001001
+00000000010001001011
+00011010001010111000
+01000000100111000100
+00010100010100100010
+00001010000110010111
+00000000000001111110
+00000101000001110000
+00010010011010000101
+10101000001011111001
+00100000011110010100
+00100000000010111010
+10000000001110000110
+00000101010110110001
+00000110000110110101
+00000000000010111000
+00000000010011110000
+00001000011010011011
+10011100010111001011
+00000000000011000110
+01001001000010000001
+10000000000010001111
+00000000000110011100
+00001001011000110001
+00010010011101111010
+01000010001011010011
+00000000100011110000
+01000000000010011001
+00000000000011111101
+00010000101101100001
+10000001001001111000
+00000110000011001100
+01000000000111101010
+00010011100001100011
+00000011011011110110
+00000000000010001010
+00000110000101001011
+00100000110101101100
+00000000011010111000
+10100000101010101001
+10000011110010110011
+00010000001011010010
+00000001011000110001
+00100000100010010110
+00001000011000110010
+00000100010111111010
+00000000100011111110
+00001100111100000100
+00000100000000111101
+00000011011011110110
+00000000100101100101
+11100011110011000011
+00000000010100100110
+00000101000110100011
+00110100110001000111
+00000011000100110110
+01110111000001000010
+00000101111110101000
+00000000100110000011
+00101101000100000110
+00100100110101101011
+01000101011000101110
+01111001110000110010
+00100001000101001000
+00001000010110011100
+00000000000011010111
+00100010000000110010
+00000000000110011110
+00000000001110101110
+01000110000110000110
+00110001001010000001
+00000000010000010001
+01000001000011010000
+00000000000010110010
+00001000000111110101
+00000000101010110100
+00001000000110011100
+11100000001101100101
+00000000000011101001
+00000010010010001101
+00000111010011000010
+00111101010111001101
+00100100000010000001
+00110100000101001011
+00000001000100110100
+00000000010110000001
+00000110110110010111
+00100011101110001101
+00010001010101001110
+00000100000101100011
+00001000011100100000
+00000101110111011100
+00000100000110111010
+01100000101011110101
+00000011010100010110
+00000000100001000001
+01000011110010100101
+00000000100001000001
+00000000010011110011
+00100100010011010111
+00000000100001010001
+00010011000110000000
+00000001000111110100
+01000000000011100111
+00100011011000001111
+01000101001011101001
+00000001100010111001
+01100010110110010111
+00001100011110001111
+00000101000101111100
+00000001000100001101
+00011001100010100000
+00000111100011000100
+00000000000110000011
+00110001110010110010
+00000001010010110111
+01000001000011100100
+00000010001011010011
+01100011000010101010
+00000000011011101001
+00000001000010110100
+10111110000011101011
+00001010101011111110
+01001010110100011010
+10010011011110001101
+00100010000110101010
+00000000111100000101
+10010100000011010000
+00010011101011010110
+00000001001011010010
+10000000000010010010
+10000001000011011101
+11011011100111011000
+10000000110110100010
+00000011000111000010
+10000001000111000111
+00001000100010101101
+00000001100000100001
+00101000001110110010
+10000000000010110010
+00010001000010010101
+00001110100010000011
+11010010110010010110
+01100010001010010011
+00011100000000101010
+00100101000101111001
+00000101011011110110
+00011010111111101011
+10000000010111110011
+00000000111101110010
+01010010011100010110
+00100000011011011010
+10000101010011110101
+10000100011010101010
+00000101100110000010
+00000001010011010011
+00000000100110100101
+01000011100010110110
+00000000000110110010
+00101010011010101011
+01001000000001010010
+01111011011110011100
+00100000000101000110
+00000010101000100010
+11010000101111110011
+00000000100011010000
+10000000000011110110
+00100001000010101001
+00101000100010000000
+00000000000001101001
+00010111110010101101
+00100100000010110111
+00000000010010000001
+00000001000101101101
+01000000000011111101
+00011110000000100111
+00100000011110001101
+01000001000011111100
+00100000000100110101
+01000000001010111000
+00010001000010101011
+11000010001011101100
+00000000000010110011
+01000000001010110111
+00000100010011110011
+00100000001011010000
+00000000000011101111
+00110000000110110011
+10000101011011110101
+11100000000101100101
+00000111001011011011
+11010010110001101100
+00100100000011100110
+00000000100111010111
+00010010011010000110
+00000000000011101001
+00000011000011111000
+00000000000011001100
+00000000000010100011
+10000101110010000011
+00000110100010110000
+10101100010010001110
+00000011000110010101
+00100010001001001100
+10111101011100011101
+01001000010101011000
+00100001100101010101
+00111110000110011100
+00000010000110101100
+00100100110110101110
+00000000000110011100
+00000011000110000111
+00000101100110011001
+00100100011100000000
+00100100000101001001
+10000001100010111011
+00010000010110100110
+00001000000011011101
+10000000000000000110
+00010001000001100101
+00000010010110011111
+00000011011010110010
+00010011010010110000
+00010011000111101111
+00010010011101111011
+00000010001111010111
+01010000100011001101
+00100001000110111011
+01000000011001101010
+00001100011110110000
+00001000111111000111
+11101000001011011011
+01100000011010010001
+11000000101111110110
+00010011000111010010
+00001000000010100001
+00000000001010101011
+01100001000011010001
+10000000100010000010
+00000010110010111100
+00000000000111010000
+01100000000010000010
+00100000000010011101
+00000000000011100110
+00000000100010001110
+00001011101001110101
+00000010011100101010
+00000011010011010011
+00100100000101001011
+01000101011010101111
+00000100000011111110
+00000000000010110110
+01000110100110101110
+10010100110011110101
+00000010011011011110
+00000010000000001110
+00011011001000000001
+01000011110011110111
+00000000001010110010
+00000011010010010101
+01000001111010111000
+00000000000111101011
+01001111110111001001
+00100000000010100110
+00000001001101001010
+00000010010010111010
+01011001011010001001
+10101110000010101101
+00000100010010111101
+00000000100111001111
+00100101010111001001
+00100011011011010010
+10010010000010110110
+01000001010111010110
+00000000001101101101
+00101101000011100011
+00000000111111110110
+00001100001010111010
+00101010010010101011
+10000001010111000110
+00000000001100110111
+00000100010111110010
+10000001100010110110
+00001010011111100001
+00001001100010001000
+10100000001011100101
--- /dev/null
+00000001001011100100
+10010001110011111110
+00000000000010100011
+00100001000011000001
+00001000000010100101
+00000000000010110101
+00100000000110100010
+00010000000010000010
+00111000000000100000
+10001010000011010001
+00000001010001110110
+00001000000011011000
+00010000001010110111
+00100001000000000110
+00000000000010110110
+01000000000011111000
+00001110010101101001
+00001000001110001001
+00000000010010010000
+00000110010010010101
+00000100000110100011
+00001000001110111010
+00010001000000010011
+00100001000010110111
+00001010000101110111
+00000000000000110110
+00000000010100100001
+00000010000100100111
+00000000000010011011
+00000000000010100101
+00100000001000011001
+11100011100101100011
+00000001000000100011
+00000000000001101010
+00000000000010010010
+00001101001010110011
+00100100000110100001
+00000000000011100001
+11000000010110010111
+00011111100101010011
+00100100000100010101
+00000001000011010010
+01000000000000011111
+00000001011010110101
+10010010000010010110
+00000000000010000111
+00000000100010100101
+01000000000111010000
+00010101100001101001
+10100000000010100110
+00000010100010100111
+00000001000001100011
+00010000000011000101
+00000000001011101100
+00000001001011110100
+00000000000010011101
+00000010010010100001
+11101101100110001110
+00001001000011000010
+11101101110100001110
+01000101111010111111
+00000011010101100010
+00001000000010110011
+00001000000010000011
+00000010001110011111
+00000001000000010000
+00000000000010101001
+00000000001010100111
+00000000000010001100
+00011110000010101010
+00000000010100111100
+00011000000010011011
+01000000001100011011
+01000000000010100101
+00000000110000110101
+00001001101110100010
+00000001000001000111
+01000000000011010000
+00000000000001000111
+01000010000010111111
+00000000000000100000
+00000000000010111010
+00000001001010011101
+01000000000001100011
+00101000000010110001
+00000100000010000111
+00001000010110110110
+00000000000110100001
+00001101000010100001
+00010000000000001011
+00010000001110100011
+00000000010001110101
+00010000000011000100
+00000100000010000010
+00000000100011110111
+10010001100000111011
+00000000010010000010
+00111010000110110001
+00110101100011110111
+00000000000010111000
+00000000000011000101
+00000000001000110110
+00000010101111011011
+00000000000010010011
+00000001100110000011
+00000001001010110110
+00000000100010011110
+00000000000011100010
+00000000010100111100
+00011100000010000100
+01000000010001110000
+00000000100011000100
+00000000001000110010
+00000000001011101100
+01100000001110100010
+00100001010110101001
+00100000101011001101
+10000000000000101010
+00001101100011000011
+00010000001110010111
+01100010001111000010
+00000000000100010011
+00000000000010011011
+00000000000010010010
+00000000000110001001
+00000010000010100100
+10011000000011100101
+00100000001010110111
+00000000010111010000
+00000000000010100001
+00100000000000000110
+00010000100010100011
+00000001000010000011
+00010000001110010111
+10001110001100101000
+00010000010001100001
+00000001000001010101
+00000000000010110010
+00000000000011110101
+00010111001110010001
+00000010000010000010
+00000000000010100101
+10010010000001110011
+10000010100010010110
+00000000000010100101
+00000000000010000101
+10000000001110000010
+00010000001110000010
+10000000000010011000
+00000101010010100001
+00100001001010011100
+01000000001110100011
+01000000001000110011
+00010000001110000010
+00111000101010110110
+00000100000111110111
+00000000000011101011
+00010010000110010001
+00101000001010010010
+00010110001011011111
+00000000000011011001
+00000000000000010100
+00000110000000110101
+00010100100010011111
+00000000000100101001
+01000001011010011110
+00000001010110001011
+00011000110000110001
+01000000110100000001
+00011001000010001101
+00010110100010011101
+00000011000111010110
+00000000000010001110
+00000100010111010000
+00000000000010101000
+00001000010010000010
+00000000000010000100
+00001000000011010101
+00000000001110100010
+00000010000100100101
+01101010000010011001
+01000000010010110110
+00100000001010011010
+00000000000110111000
+00000010010100100011
+00000000001111010101
+01000110000011110010
+00000000000001010111
+00110000001101010001
+01001100100011110010
+01000000000101100101
+00101010110110001001
+00000000100010101001
+00000000000010100001
+00100001000110000101
+00000000000010100010
+11000000010001000111
+00000001001111011111
+00110011111000110011
+00000100000011110100
+00000010110000110111
+00000000000110011001
+00000000000010100011
+00000000000010110010
+00000000000010110010
+01001000010010110011
+00000000000010110001
+10000110000010110101
+00100010000100100011
+00000101000111100110
+00000000000000010100
+00000000010110011010
+00010000001011110100
+00010000011000000111
+00000000000010001110
+00000001010011000010
+00000000000011011111
+00000000010010100001
+00000011000010100010
+00000000000101100011
+00000101001011111100
+10000010000010100111
+10000000000001111110
+00000000000011000010
+01000010010011100001
+00001000000001110110
+00000000001000001100
+10000001001111110111
+10000100000000111001
+00000001000110010001
+00110101100010111000
+00000000000010000100
+00000001000011000110
+00000000101010111101
+00001001001010100001
+01010000100000100010
+00000000000010000110
+00000001001010001001
+00000000001110000010
+00000101000100010011
+00000011011010111101
+00000001000000110111
+00000011000111110110
+00110101000111101101
+01001101001011101001
+01010000010001000010
+00010100000010110011
+10000000001101110000
+00000001000010000111
+00000000000110010100
+00000000010010100001
+00010100001001110110
+00000101111010110110
+10100000010100100000
+10000001110011100101
+00100000000000000101
+01000000011000101000
+10000000001010110011
+00000000000010100101
+00100101111010110111
+00010010010101101001
+01001100100110101001
+00000010100100100101
+00000000000011110101
+00101000000001001001
+00000000000010100101
+00000000001111110001
+00001000000010011011
+11000000000110100011
+00100000000010011000
+00010000000001100011
+00000010100010101100
+00000000001110000010
+01000001000000101100
+01100000001110010101
+00001100100011010001
+00000000000000100011
+00010001010110100011
+00000001000001100100
+00010110000011111111
+00000000000010101011
+00000000000110000011
+00000100000010110001
+01000000110000110101
+00100101111010110111
+00000001000010110110
+00010000000010011101
+00101000001110100110
+00010000000010111010
+01000000001101001101
+00000010000111000011
+00000001110010110111
+00111010100110110010
+00001010001010001100
+00000000000001000101
+00000000101011110001
+00000100000110100001
+00000000000010100001
+00000000000010000101
+00000000000000100011
+01000000000010000101
+00001000000110010111
+00000101000110110001
+00000000000011011000
+00010000101111110001
+01001011101011110110
+00000111001010100001
+01001000001010001010
+00000010010010100101
+00000010000101000011
+00000000101011010000
+00000000000010110011
+00000000000010000011
+00001000000010100111
+00000000000010111010
+00011100000100110111
+01001100100011011001
+00000100010101010011
+00000000000011110101
+00000000000000100011
+01000001000010110001
+00011000010011101101
+00000000001010001010
+00000111001110011100
+00000001101110010101
+00100001000111010010
+00000000000010100001
+00010000000100000010
+00000000001010010101
+00000000000010010011
+00000000110010101101
+10010000100110010110
+10000000100110110110
+00000000000000010001
+00000000000010000100
+00000000000010111101
+00000001000111010011
+00000000000010100111
+00000000110001011101
+00000101000011100011
+00000001001001011101
+00010000110011110100
+00000000000010011001
+01101010001010000010
+00000000000010100101
+00000000000010100001
+00010000000011110011
+00010001011011010010
+00010000000011000111
+10000000000001010110
+00000001000001110110
+00000000010110101001
+00000000000010000101
+00000000011000010100
+00000001001111100010
+00001001110011010011
+00000000000011110111
+00000000000010101000
+00000111000000110110
+01000101101110010001
+10000000000110110110
+10010100000010011110
+00000000001100001101
+00000000010111010000
+00000001001110101110
+01000001010011001101
+00000111001110101011
+00000100000010100110
+01000001101100001011
+00000000000001100011
+11010001000000000100
+00000000001011110111
+00000111001010100000
+00010000001010111100
+00000000000010000100
+00010010010010111100
+00100000001111111101
+01000000001101000010
+00110001110010110111
+00001000010001101001
+00010001001110011011
+00101000000101000101
+00000000000010100111
+00000000110001101000
+00000001101010001001
+10000001100011101001
+10011011101011111111
+00000000000010110101
+00000000000010011011
+00000000000111110010
+10100010100111001001
+01000100100001101001
+00000000110011110111
+01000001000011110101
+00001000000110010010
+00000100000110010010
+00011010000100100001
+10110101100010111101
+00000001000011010010
+00010000000000100111
--- /dev/null
+Generation number 1
+00000001011100001100
+00000010011110101110
+00000101101001100110
+00001000100001100001
+00001000110111011111
+00001010011010001111
+00001011011101101101
+00001100000011111101
+00001100101101000001
+00001101001111111000
+00001110000011000001
+00001111000011101111
+00010000100111111110
+00010001000100000000
+00010001100010011010
+00010011100101011110
+00010101011000110110
+00010101110001000010
+00010110001011101101
+00010110111001110000
+00010111100001010011
+00010111110010001010
+00011001111111011010
+00011100100110000111
+00011110110011100101
+00100000101100001100
+00100000111110101100
+00100010011111000101
+00100100000100110000
+00100110101110010011
+00100111101000010010
+00101000101001111110
+00101010110101011000
+00101100101001000011
+00101100110011011000
+00101110000010100100
+00101110001010111000
+00101111001000011110
+00101111010000111100
+00101111101000001111
+00110010111100011000
+00110011100001110001
+00110011101001100100
+00110011111011100110
+00110100001010100010
+00110101110001010000
+00111000010100111011
+00111001110100010100
+00111010001011011011
+00111100101010110110
+00111100101111011001
+00111101110011000101
+00111111110100110100
+01000001000001010100
+01000001001111111101
+01000001110101011010
+01000010010111101001
+01000010111000001110
+01000101001001100101
+01000101100111111011
+01000110101001001110
+01000110110011011011
+01000111001100101111
+01000111010001001110
+01001101001011100101
+01001101001110000111
+01001110101001010111
+01001111111110000101
+01010000001011011111
+01010010100001101111
+01010100101110011110
+01010101000010110001
+01010101010110010010
+01010101101111010101
+01010110001101010000
+01010111001111100000
+01010111011101100011
+01011001110110110100
+01011100001010110001
+01011100110100000101
+01011101010010010010
+01011110111001010010
+01011111011000000001
+01100000001110100011
+01100000110001111110
+01100001101000100111
+01100010010011101111
+01100010010111000111
+01100010110110101011
+01100100110000100010
+01100101000000101100
+01100101110000000001
+01101010010001001100
+01101010101110101001
+01101011011011001100
+01101100010110000011
+01101101010001111111
+01101101011111110011
+01101111110010110001
+01110001110010101111
+01110001111110111110
+01110010111110000010
+01110100111011110000
+01110101010000010000
+01110111010001011010
+01111000110010000111
+01111001000001000100
+01111001000100010001
+01111001010011010010
+01111011101111110101
+01111111001111110110
+10000010111110000100
+10000101100010100100
+10000110111110100010
+10000111010010110011
+10001010101111001110
+10001100101011000010
+10001101001010001110
+10001111010010001011
+10010001011101011011
+10010010100000100110
+10010010110000010101
+10010100110100101111
+10010110101111110111
+10010110110001001011
+10010111111100011110
+10011000000100011111
+10011010011100010111
+10011100011111000100
+10011110101010100011
+10011110111011100001
+10011111010001000100
+10100000000100001111
+10100000001100101000
+10100010110111001010
+10100011001111111111
+10100100010100110101
+10100110100011010000
+10101001110111000100
+10101010010010100110
+10101100000001111101
+10101101111101101000
+10101110110001011000
+10110000111100111000
+10110010100110110010
+10110011011111011101
+10110011011111100000
+10110101001100010111
+10110101110001111100
+10110111011001010100
+10111000100001111100
+10111100010010111011
+10111100111000100010
+10111101000001100111
+10111101110000101010
+10111101111000111011
+10111111000110001011
+11000001001000101111
+11000010011100111101
+11000010110010110101
+11000011001111011011
+11000100111111011110
+11000101011011110010
+11001000011010000110
+11001000100110011110
+11001001011110011101
+11001010100011011100
+11001011011111110101
+11001011101010110010
+11001111110110010011
+11010000001110101110
+11010000010111110000
+11010000111010101010
+11010001000000101110
+11010001100000010110
+11010001110111100001
+11010010101000000100
+11010011010000100101
+11010011100100111111
+11010101010001100110
+11010110011000001110
+11011001011100110101
+11011010000010010010
+11011101111110110010
+11100011101001110001
+11100100000110011001
+11100101011001010000
+11100111000101011010
+11101011010000101101
+11101101111010111100
+11110000000011001100
+11110100001010011010
+11110101111000001001
+11110110001010000101
+11110110011100111011
+11110110110100101111
+11110111001001111111
+11111010001101011101
+11111011101011111011
+11111111011111000000
+Started at Fri Apr 25 22:39:39 +0100 2008
+Took 1598.862926 seconds
+Generation number 2
+00000100101001100110
+00000101100010101100
+00000101101001101100
+00000101111001010100
+00001000101001110110
+00001010001010001111
+00001010011001000011
+00001010011110001111
+00001011011101101101
+00001100000011110110
+00001100010110000010
+00001100101000001111
+00001100101101111000
+00001111001111111111
+00010000110010000101
+00010001000000000000
+00010001001100010000
+00010001010100000100
+00010001100101011110
+00010001110110011010
+00010010100000100111
+00010010110111111001
+00010011100001110001
+00010100100010001010
+00010100111001001100
+00010101010110101111
+00010110111000001010
+00100000111110101100
+00100001110100010100
+00100010111110000000
+00100010111110000100
+00100100000100110000
+00100100000100110000
+00100100000100110101
+00100100110100100010
+00100110111110100010
+00101010110101111000
+00101100110001110100
+00101100110011011000
+00101100110011011001
+00101101110011010101
+00101110000101010000
+00101110001000111010
+00101110001010011001
+00101110001010110110
+00101110010001001100
+00101110101010010010
+00101111001000011110
+00101111001010111110
+00110011101111010101
+00110100001010011011
+00110100100011101100
+00110110001101011101
+00110111101110110010
+00110111110011110001
+00110111110100110100
+00111000010100111011
+00111000010110000011
+00111000100001111100
+00111000101100001100
+00111001110100000010
+00111010001011011011
+00111100001011100111
+00111100101011000011
+00111101100100011110
+00111101101010100001
+00111110110011010011
+00111110111111100001
+00111111110100110100
+01000001011000110110
+01000010101011011101
+01000010111000010101
+01000010111000011110
+01000101110110010010
+01000110001001001010
+01000111010001100001
+01000111100001000011
+01001000100001101010
+01001000110100000100
+01001100001110000111
+01001100101111011000
+01010000000001101111
+01010001000010011010
+01010010110101011100
+01010100001111011111
+01010101110001100101
+01010101111000001001
+01010111011010110001
+01010111011101100011
+01010111011111000000
+01010111100101011111
+01010111110001000100
+01010111111100000001
+01011011011000000110
+01011100100011110010
+01011100110100010101
+01011110111001010010
+01011111001111100100
+01011111011001000011
+01100000010001111110
+01100000110000100010
+01100000110110101011
+01100001000000110110
+01100001101100101111
+01100010001110100011
+01100010011011000010
+01100100000101100000
+01101000000100101011
+01101010101110101001
+01101011101111110101
+01101101010011111111
+01110000100111111010
+01110001110010101111
+01110001111111011110
+01110100111110000110
+01110111010001011010
+01111000100111111110
+01111010011011000111
+01111100101010111110
+01111111001111111101
+01111111010110001010
+10000010110111001010
+10000101100010100110
+10000110101011001100
+10001010101111000010
+10001010111010100001
+10001011101010110010
+10001100001000110001
+10001101010010001011
+10001110000011000001
+10001111010100100101
+10001111010100111100
+10010001001000010110
+10010001100010100100
+10010010110001110101
+10010010110100010001
+10010110110001001011
+10010110111110010011
+10011101110011000001
+10011110111010100011
+10011110111011001110
+10011110111011100000
+10011110111011100000
+10011110111011100001
+10011111010001110100
+10100000001100101000
+10100000001100101010
+10100100010100110111
+10100110011000000110
+10100110100011010000
+10101001110101000000
+10101001110111000101
+10101110001010111000
+10101111010000111100
+10110000111100111000
+10110001011111111000
+10110010111100011000
+10110011011111110001
+10110011111011000110
+10110110101110010011
+10111000011000001110
+10111001110110011100
+10111011010111010011
+10111111110100101010
+11000001011111110000
+11000001101000101111
+11000010010111111001
+11000100111111011111
+11000101011010110010
+11000101111011111011
+11000111010010110011
+11001001011110010111
+11001001011110011101
+11001111110110010010
+11001111110110010011
+11010001100000010110
+11010001100000010110
+11010010110001011100
+11010011100100111011
+11010111110011110101
+11011010000001000011
+11011101111110110010
+11100011001001100001
+11100100000110011001
+11100111000101011000
+11100111000101011010
+11100111101000110010
+11101010010010100110
+11101011010001101101
+11110000000011000000
+11110000000111001100
+11110001110001010000
+11110101111010101001
+11110110001000000001
+11110110001101010001
+11110110011100111011
+11110111001001111111
+11111000001110011111
+11111000010100111011
+11111000101001011110
+Started at Fri Apr 25 23:06:18 +0100 2008
+Took 1684.749211 seconds
+Generation number 3
+00000001101000101111
+00000010011100001010
+00000011010001100001
+00000100101000001111
+00000100110100000000
+00000100111111011111
+00000101001001100001
+00000101111001000110
+00000101111001110001
+00001000101010100010
+00001010011001000011
+00001011111011111011
+00001100000110100111
+00001100001000110011
+00001100001010010110
+00001100100000010110
+00001100101000111011
+00001110001010011001
+00010000001011100110
+00010001010110011010
+00010010010111111001
+00010011011111110001
+00010011100001110001
+00010011100001110001
+00010011100001110001
+00010011110001010100
+00010100010100011100
+00010100011101010001
+00010100100010001010
+00010100100110010111
+00010101010110000110
+00010101010110101100
+00010101010110101111
+00010111011001000011
+00011001110001010000
+00011100101000101111
+00011101011100101011
+00011110110001000011
+00100000001101010000
+00100000111110101000
+00100010111000010101
+00100010111110110010
+00100100110100100011
+00100100110100100111
+00100100110100101000
+00100100110101110110
+00101000010001110110
+00101010001010011001
+00101010011110001100
+00101010110101110010
+00101100110011010001
+00101101110011010101
+00101101110011010101
+00101110000110010111
+00101110000111010000
+00101110001000101010
+00101110001010111100
+00101110001101011000
+00110011101111010101
+00110011110001011100
+00110011110100110101
+00110100001010011010
+00110100001011011010
+00110100111110000110
+00110110000100000100
+00110110001101011101
+00110111101110110010
+00111000010100111011
+00111000100001011100
+00111000100001111100
+00111000100100010001
+00111000111111011111
+00111001100110100000
+00111001110100000010
+00111001110100100010
+00111010010111010001
+00111100101011011111
+00111101001010101001
+00111110001010110110
+00111110010000111100
+00111110101011011101
+00111110111101100001
+00111111010100101100
+00111111110100110100
+00111111110100110100
+01000000000001101111
+01000001101010101001
+01000010110011110110
+01000010111000000101
+01000100001111010001
+01000100010100110000
+01000101100010101100
+01000110011001001010
+01001000100000101011
+01001000101001011010
+01001000101110011111
+01001000110100000100
+01001010001010011110
+01001010111000011111
+01001100111101011101
+01010000000001101111
+01010010110100010010
+01010011011101101011
+01010101111000001001
+01011000110100000100
+01011011011000000110
+01011100111001001100
+01011101010000001011
+01011110001111100100
+01011111011011100000
+01011111011101100111
+01011111110001100111
+01100000100011101010
+01100001101100101111
+01100010111110000000
+01100011000000110110
+01100100001111100110
+01100101011010111111
+01101011111000011000
+01101100000101110001
+01110000100111111010
+01110000110001010000
+01110000110111101000
+01110110010001011010
+01110110111110110101
+01111010101011011101
+01111111001111011100
+01111111001111111101
+01111111010110001010
+10000010011001011000
+10000010110111001010
+10001001011110011101
+10001100001000100001
+10001101010100111100
+10001101100000010010
+10001110111111101110
+10001111010110100100
+10001111101001101100
+10010000010110000011
+10010000111000111000
+10010000111100110100
+10010001110010101111
+10010010110001111100
+10010010110100010011
+10010101010110101111
+10011111010001101000
+10100000001100101010
+10100100010100110111
+10100110001010011001
+10100110100011010000
+10101001110101000000
+10101111010101110001
+10110000010100111011
+10110001001000010110
+10110010111100011000
+10110110001100001000
+10110110101110000011
+10110110101110110010
+10111001110110011100
+10111011110001011010
+10111011110111011111
+10111101110100101010
+10111110110011010010
+10111110111111100001
+10111111110100101111
+11000001011111110000
+11000001100101011110
+11000100010100111011
+11000100011110001111
+11000100100011100011
+11000101111011001111
+11000111010010110010
+11001001011010001010
+11001011011000000110
+11001101011111010000
+11001110111001010010
+11001111010110000010
+11010011010100100100
+11010101110011110101
+11010111110011110101
+11011001110101111000
+11011101111110000100
+11011110110011010011
+11100100010100110111
+11100101010000110110
+11100101110100011100
+11100111000000111010
+11100111000110100001
+11101111001010111110
+11110000010001101010
+11110011011111110001
+11110100101111011000
+11110110000111101111
+11110110001000001100
+11110110010110101111
+11110111001001110111
+11110111001101111111
+11111000100111111110
+11111111010001100001
+11111111110100110101
+Started at Fri Apr 25 23:34:23 +0100 2008
+Took 1771.991079 seconds
+Generation number 4
+00000000110100000000
+00000001101000101100
+00000001111001000111
+00000010011100101111
+00000011010001100001
+00000100011111010010
+00000100100001001111
+00000101010110101111
+00000101100010101100
+00000101111001110001
+00000101111010000110
+00000101111101000011
+00001000001000110010
+00001010011001000000
+00001010101000111011
+00001100000110100111
+00001100000110111110
+00001100001011011010
+00001100101010111101
+00001110010111111001
+00010000001011100110
+00010000010110000011
+00010010110001000011
+00010011100001110001
+00010100011100000001
+00010100011101010010
+00010101010000010010
+00010101010110101100
+00010101011001001000
+00010101111111011111
+00010110000110101001
+00010111010110000110
+00010111011001000011
+00011000110100000100
+00011001100010100000
+00011100100001010111
+00011100101010100110
+00011101011100101011
+00011101011100101011
+00011110110001000011
+00100010010100111011
+00100010111000000101
+00100010111011110010
+00100010111110110000
+00100011101101010101
+00100100001011111010
+00100100110100101000
+00100100110101110110
+00100100110111110110
+00100100111111011111
+00100101110101010101
+00100110110100100011
+00100111001000001101
+00101000110100000100
+00101001110000010110
+00101010011011001100
+00101010011110001000
+00101100110011011110
+00101100111110000110
+00101101110011010001
+00101101110011110110
+00110001010010101111
+00110001110100000010
+00110010001010011001
+00110010011000011101
+00110011101111010101
+00110100001010010110
+00110100111101100110
+00110110000100111011
+00110110001100001000
+00110110001101011101
+00110110001101011101
+00110110011101100011
+00110111101100010000
+00110111111000001001
+00111000100100100000
+00111000110100010101
+00111001100100000010
+00111001100100110100
+00111001100110010001
+00111001100111110001
+00111001110100000010
+00111001111100101000
+00111001111111101110
+00111010010111010001
+00111010010111010101
+00111100100001010100
+00111100100100010001
+00111100101011011111
+00111100101110011000
+00111101001000000100
+00111101101010101001
+00111101110011010101
+00111110001000101010
+00111110010010111101
+00111110011111110001
+01000001111010101101
+01000011010010110010
+01000100010100111011
+01000100100010101100
+01000100101111010001
+01000101100010101100
+01000110010110101110
+01000110011100001010
+01001000010001110110
+01001000101010011111
+01001010001010010101
+01001110101000010110
+01001111001111000010
+01010010110100011000
+01010011001100000100
+01010011011101010001
+01010101010110000110
+01010101111011001111
+01011100111000101100
+01100000000001101111
+01100011000000110100
+01100100000101110001
+01100100001111100110
+01100101001111100110
+01101011111010110010
+01101100000101101011
+01110000100111111010
+01110000100111111010
+01110000110001010000
+01110000110011010100
+01110000110110001000
+01110110000111101111
+01110111010011100001
+01111000100111111011
+01111001110100000010
+01111010101011000101
+01111100001010111100
+01111101001010101001
+01111111110100101111
+10000010011100011010
+10001101100100010000
+10001111011011001111
+10010000010110000011
+10010000111100100000
+10010111010010111111
+10010111100001011100
+10011001011110010001
+10011110110101000000
+10101001000011101000
+10101101101110101111
+10101110011111011000
+10101111010100100001
+10110000010100000100
+10110000010100111011
+10110001001000010110
+10110001001000010110
+10110010111100011000
+10110100111110000110
+10110110000111100000
+10110110010111001010
+10110110101110000011
+10110110101110110010
+10110110101110110010
+10111011110011011010
+10111100101011011111
+10111101001011101011
+11000000000001101010
+11000001100101011110
+11000010101100001100
+11000011010001000001
+11000100001000111000
+11000100010100111011
+11000100011111001111
+11000100111110101000
+11000101111001101100
+11001000101010011111
+11001001110101011000
+11001100011111000000
+11001100100100110110
+11001101011010001011
+11001101011111010100
+11001110111011010001
+11001111010110000010
+11001111010110000010
+11001111100001001111
+11010000110110110000
+11010010110100010000
+11010100101110001100
+11011001110101110010
+11011001111110000100
+11011011011000000110
+11011101101110001100
+11100100001111000110
+11101101110011110101
+11101111001010111110
+11110010001111110000
+11110011010000111100
+11110100101111011000
+11110110010100101110
+11110110101110110010
+11110111000101111111
+11110111101101111111
+11111000100110111110
+11111000100111010110
+Started at Sat Apr 26 00:03:55 +0100 2008
+Took 1879.650283 seconds
+Generation number 5
+00000000100111111111
+00000000110100000110
+00000000110100010010
+00000001111000110001
+00000001111110101110
+00000010011100100010
+00000100001011100110
+00000100100100100011
+00000101001010101100
+00000101010100101100
+00000101111010000110
+00001000101010010111
+00001100001011000011
+00001100011011001000
+00001100101010000100
+00001101110011110110
+00001110001010001101
+00010011100101110001
+00010100011011111010
+00010100011100000010
+00010100011101010111
+00010100011101011000
+00010101000110111110
+00010101011001000000
+00010101011001001011
+00010101100001111001
+00010101110111011111
+00010110000110101001
+00010111010110000100
+00010111010110000110
+00010111011001010011
+00011000100100100000
+00011000110100010101
+00011001110010100000
+00011101010100110110
+00011101011100100000
+00011101101010100111
+00011110110001000010
+00011110111111000000
+00100000111110110000
+00100010001010010101
+00100010110100110110
+00100010111011110111
+00100010111111011111
+00100011101111100101
+00100100001101011101
+00100100100100101110
+00100100110101011110
+00100100111110110000
+00100101011010000110
+00100110110100100011
+00100111001001011011
+00101000111010000110
+00101001110000000101
+00101010011110001001
+00101010011110100000
+00101011011101010001
+00101100011111110001
+00101100101010101101
+00101101110011010110
+00110000001100010001
+00110000011111010010
+00110001111100101000
+00110001111110101101
+00110010001010000011
+00110010001010011111
+00110010001100111001
+00110010011010010001
+00110011101111100000
+00110101100100010000
+00110110001110101011
+00110110111000000101
+00110111011010000110
+00110111100001011000
+00110111101100010000
+00110111101100010000
+00111000110000010000
+00111001011100101000
+00111001100100000101
+00111001100110110100
+00111001100111111100
+00111001110100000011
+00111010000011111111
+00111010010111000011
+00111010010111010110
+00111010011100101111
+00111011100101010010
+00111100001010111100
+00111101001000000110
+00111101001010101111
+00111101111110010000
+00111110010010101111
+00111110011111110110
+00111110100001001010
+00111111010011101001
+01000000010100111011
+01000000100001101010
+01000001101101011110
+01000001110101010000
+01000100010101111011
+01000100011101000011
+01000100101010010010
+01000100101111010001
+01000101001111100110
+01000101111101010110
+01000110010110111100
+01000110011100001010
+01000110011100001010
+01000111010110101111
+01001000010001110110
+01001000010001111000
+01001000101010011010
+01001010010001111110
+01001010111000010101
+01001110111110000101
+01001111001111001010
+01001111010000000111
+01001111110100101111
+01010011001100010100
+01010011001100100110
+01010011011101010001
+01010011011110111101
+01010100100011011111
+01010101010110101011
+01010101111011001111
+01010111010101111001
+01011010101000111011
+01011100000101101011
+01100000100111111110
+01100011110000000010
+01100100100010101100
+01100110000111101011
+01101000100111111011
+01101111110100111101
+01110000100101101000
+01110000100111111010
+01110111000111101110
+01111000110100000010
+01111100001010101100
+01111101001000101001
+01111101011010100001
+01111111110100101110
+10000001110011110101
+10000010011001000000
+10000101010100000100
+10000101111001000011
+10001010011100010010
+10001101100100011010
+10001101100101011101
+10001110000101001101
+10001111010110000110
+10010000010101111101
+10010001010010101111
+10010100111100111011
+10101100011111010010
+10101101101110100111
+10101101101110101111
+10101101111100001000
+10110001001100011111
+10110010111100011000
+10110100010100001100
+10110100111110000110
+10110110000111010101
+10110110010111010100
+10110110101110100010
+10110110101111011010
+10111001001000010110
+10111100101111011100
+11000000100101011110
+11000010101001100100
+11000011010001100001
+11000100001000110110
+11000100110010000000
+11000101010110100111
+11000101100010001100
+11001000101000011000
+11001000101010011001
+11001001110101011000
+11001100010001000001
+11001101011111010101
+11001101110101110010
+11001110101110101011
+11001111101001001111
+11010000010110110000
+11010110100100111011
+11011001101000010110
+11011001110101110010
+11011011011110000010
+11100100001111000100
+11100100001111000110
+11101101111001000111
+11101110101100110110
+11101110110010001100
+11101111001010100110
+11110000110001010001
+11110010001111100000
+11110100101111011000
+11110110010100100110
+11111000100111010001
+11111101001011101011
+Started at Sat Apr 26 00:35:15 +0100 2008
+Took 1834.799951 seconds
+Generation number 6
+00000000100111111100
+00000000110100000110
+00000000110101111011
+00000001110100100111
+00000010011100100010
+00000010011100100011
+00000100001011100001
+00000100010101111011
+00000101010100001100
+00000101111010000110
+00000101111010001110
+00000110011100001000
+00001000101010100000
+00001011011001010011
+00001100001011000011
+00001100001011001010
+00001100101001100101
+00001100101010000101
+00001110001110001100
+00010000011101010111
+00010011001100010100
+00010100001101111001
+00010100011011111011
+00010101000110000110
+00010101000110111001
+00010101010100100100
+00010110000011101011
+00010110001110101001
+00010110010001010011
+00010111010110111110
+00010111110111111111
+00011000001100010111
+00011000110100010110
+00011001100111111100
+00011001110110100100
+00011010100100011001
+00011100001111000100
+00011100101010111100
+00011101101010100100
+00011110111111000000
+00100010111000000010
+00100010111010111100
+00100011101111100101
+00100100000100110110
+00100100001101001101
+00100100110101011110
+00100101011010000110
+00100101101010000100
+00100110000100110110
+00101000110001110110
+00101000111110110000
+00101001010000000110
+00101010011110000101
+00101010011110001001
+00101011011101010001
+00101100011011000011
+00101100011111110110
+00101100101011011001
+00110001010110111100
+00110001111100101000
+00110001111100101000
+00110001111110100110
+00110010011010010101
+00110011001100001100
+00110100100101100000
+00110101000110101011
+00110101100100010010
+00110101101100010011
+00110110010101101011
+00110111001100010000
+00110111011010010110
+00110111011011000001
+00110111101110110000
+00110111111110010010
+00111001011100101000
+00111001100100000010
+00111001100111111100
+00111001101010010110
+00111010010111010110
+00111100001010111100
+00111100010101111011
+00111100011101011000
+00111101001011110111
+00111101011010000100
+00111110000001001000
+00111110000010101011
+00111110001110110111
+00111110010010101110
+00111110011111110100
+00111111100011001010
+00111111101100010001
+00111111101111111000
+01000000100001101010
+01000001101101011100
+01000001110101010000
+01000001110101011000
+01000001110101111010
+01000010000011111111
+01000100011100000011
+01000100011100001010
+01000100100101011110
+01000100100111111110
+01000100111101001000
+01000101001111100110
+01000101100100010000
+01000110010000011010
+01000110111100101000
+01000111010110101111
+01000111011110001111
+01001000001010011010
+01001000010001000000
+01001000010001111000
+01001010010001000011
+01001010111000010100
+01001100001001111110
+01001101011100100000
+01001101011111010101
+01001101011111110101
+01001110000101001101
+01001110111010000101
+01001110111110000101
+01001111110100110101
+01010000101010101101
+01010011001100010101
+01010011101111101011
+01010101010010101001
+01010101110011011111
+01010101111011001011
+01010101111011011110
+01010110001010011111
+01010111010101111001
+01011010101000111011
+01011111011011001001
+01100001110000100010
+01100010111101011101
+01100011001101101111
+01100101011100100000
+01101000010001111001
+01101111001010100111
+01110000100111111000
+01110010100101101000
+01110010101110111011
+01111000110111110111
+01111100000010101110
+01111100001010101110
+01111100101111011011
+01111101011010110001
+10000100010101111011
+10000100111100000100
+10000101000100101100
+10000101010110000111
+10001010011100010010
+10001010011100101000
+10001011001111001010
+10001111100010000100
+10010000010101111101
+10010001010010101101
+10010100010101111111
+10010110111100000110
+10010111011110000001
+10100110011110010010
+10101100011111010010
+10101101101110010010
+10101111011110111101
+10110000010001111111
+10110010111100011000
+10110100101110101101
+10110100111100111011
+10110110000101010101
+10110110101111011000
+11000000101010011110
+11000001110101011110
+11000010011001000000
+11000010101001100100
+11000100001000110001
+11000101001010001101
+11001000101010011001
+11001001111101011000
+11001100110100000010
+11001101011111010001
+11001101100101011101
+11001110110010111011
+11001111101001001101
+11001111101110101011
+11010000001000110110
+11010011001100000000
+11010101100010001100
+11100100001111000100
+11100100001111010110
+11101010110010000100
+11101111000010100110
+11110000011010000110
+11110100010011101001
+11110100111111011010
+11110111000111000001
+11111000100111010000
+11111000100111010001
+11111000100111010001
+11111001101000011100
+11111010000111000011
+Started at Sat Apr 26 01:05:49 +0100 2008
+Took 1806.325558 seconds
+Generation number 7
+00000000100111100000
+00000001110100100111
+00000010011101100011
+00000100000101111010
+00000100100011111110
+00000100110100111100
+00000100110101111001
+00000101010110000111
+00000110001100001000
+00000110010101101000
+00000110011101001000
+00000110110011011111
+00001000011110001000
+00001000100100110110
+00001010011110000101
+00001011011101010011
+00001100001011000011
+00001100011010011010
+00001100100010001100
+00001100100101111110
+00001100101001100101
+00001100101010001000
+00001101101001100101
+00001110001100100100
+00010000011101010110
+00010001100100001010
+00010010001101000000
+00010010101010101101
+00010100011011111011
+00010101010110001100
+00010101011100100100
+00010110010011101011
+00010111010101101000
+00011000010100010110
+00011001110110100100
+00011010100100011001
+00011010101010100111
+00011100101010110100
+00011101101010000100
+00011101101010011000
+00011110111111000000
+00100001011010000110
+00100100001101001101
+00100100101010000101
+00100100101010111011
+00100101111010011010
+00100110000100110111
+00100110001010110000
+00100110111011010110
+00101000111010110000
+00101010011110101101
+00101011011001010011
+00101100011010000010
+00101110111100011000
+00110000001000010110
+00110000010001111001
+00110001010110111010
+00110001101110101011
+00110001111110111001
+00110010011010010101
+00110011001100010101
+00110011001111110001
+00110101000111101011
+00110101010110000111
+00110101100000010010
+00110110010101101011
+00110111001001111011
+00110111011010000110
+00110111101110110000
+00111000001010111100
+00111000010100101100
+00111000010101111011
+00111001000010100110
+00111001010001111001
+00111001101010000100
+00111001101010010110
+00111001101010010110
+00111100010100001100
+00111100010101111011
+00111100011001100100
+00111100011101011000
+00111100011101111001
+00111101101111000100
+00111101101111111000
+00111110000010101011
+00111110011111111100
+00111111100011001010
+00111111101000011101
+00111111101111111001
+01000000100001101010
+01000001101101011100
+01000001110111011000
+01000100100101011101
+01000100100101011110
+01000100101010000101
+01000100110111111110
+01000100111101001000
+01000101111010000110
+01000101111010111100
+01000110011000010011
+01000110101111011011
+01000110111000010100
+01000111011110001111
+01001000001010101010
+01001000111101001010
+01001010111000010100
+01001100101010000101
+01001101010111110101
+01001101011111110111
+01001110000101001101
+01001110011110000100
+01001110111010000101
+01001110111100000001
+01001111001010100111
+01001111110100110101
+01010000010001111111
+01010000101000100101
+01010001010110101101
+01010001110101111010
+01010100000110000110
+01010100100101100000
+01010101010000101110
+01010101010010100010
+01010101010010111010
+01010101110101011000
+01010110011110001101
+01011010000100110110
+01100001110000100011
+01100010111000010000
+01100011101100010101
+01100100000111111110
+01100101001111100011
+01100111001000011111
+01101000010001110000
+01101101000110101011
+01101111000100011001
+01101111001010100111
+01101111001010100111
+01110001100111111100
+01110010101100001000
+01110010101110000001
+01110011001101111111
+01110011101111111011
+01110100110011011111
+01110110111010011101
+01111000000010111011
+01111000010001111001
+01111000010101101000
+01111000110111010010
+01111100001010001110
+01111100100111111110
+01111110001110101011
+01111110101111011011
+10000001010110111100
+10000101000101110011
+10000111100011010000
+10001010011100010001
+10001010011100100100
+10001110111110000101
+10001111010110001111
+10001111100010000100
+10010001010010101101
+10010101111011011110
+10010110010000010001
+10010110111100011101
+10010111011110000000
+10011001110100100111
+10101101101110110110
+10110001010110111100
+10110010001101010101
+10110010010100110000
+10110011001111111000
+10110100101110001001
+10110100101110101101
+10110110000000011100
+10110110111100101100
+10111000101001101101
+10111100001010001100
+11000100010101101011
+11000101001000110101
+11000101010000001100
+11000101010110000111
+11001000101110010110
+11001001111101111000
+11001011011100101000
+11001100100001011110
+11001111101010101110
+11010000001100010110
+11010111011000010110
+11011000010001111000
+11100100000000000010
+11100100001001010110
+11100101011100100000
+11101000100111010000
+11101001101110110000
+11101010110010010110
+11101100001011000010
+11101111100111111100
+11110110111111001010
+11111001101101010101
+Started at Sat Apr 26 01:35:56 +0100 2008
+Took 1893.750235 seconds
+Generation number 8
+00000010001101100011
+00000100000110000110
+00000100010110011101
+00000100100011111110
+00000100100101101110
+00000100110000111111
+00000101010110011110
+00000110000010101010
+00000110001100001110
+00000110011001001010
+00000110110011011111
+00001010011010101101
+00001011011101010011
+00001100011101101001
+00001100100001100101
+00001100100101011101
+00001100101000100101
+00001101010110000011
+00001101011111110111
+00001101101001100101
+00001110001000010101
+00001110111010000101
+00001110111010011101
+00001111001010110111
+00010000011101011000
+00010000110101111000
+00010010101010101101
+00010010101011100101
+00010100011101000010
+00010100100001101010
+00010100100110100110
+00010101011100101100
+00010101011100111000
+00010101111011010010
+00010101111011011110
+00010110011100001000
+00010111001000010111
+00010111010000010110
+00011010011100011011
+00011010101100001000
+00011100011111011011
+00011110111101111001
+00011110111111000000
+00011110111111000111
+00011111101111111001
+00100010011111111100
+00100100101001100101
+00100101011101100000
+00100101111010010000
+00100110000100110111
+00100111010101101000
+00101000010001111001
+00101010011110100000
+00101011011001010011
+00101100011010000010
+00101100011010110110
+00101101000110101011
+00101101101000000100
+00110000010010111001
+00110000110001111110
+00110001001111110001
+00110001110010001110
+00110010001001010101
+00110011001100000100
+00110101000111101011
+00110101010110000000
+00110101011010100111
+00110101100000010111
+00110101100001010010
+00110101101000010010
+00110110110011011110
+00110111001001110010
+00110111001001111011
+00110111011010011001
+00111000000010111101
+00111000000110100000
+00111000010100101100
+00111000010101101011
+00111000110111010010
+00111000111000111100
+00111001000010111011
+00111100011101011011
+00111100011111000000
+00111100100101100010
+00111101101111111000
+00111110000011101011
+00111110001101000000
+00111110010010011010
+00111110011010010101
+00111110011111111100
+00111111101010000111
+01000000011011101011
+01000000011101100011
+01000000100001101010
+01000001110000100010
+01000010011101100011
+01000100010101111011
+01000100101010000101
+01000100111010100111
+01000101110110111110
+01000101111010000110
+01000110010101101000
+01001000101011111011
+01001000101101101010
+01001000111101001100
+01001001011111110010
+01001010011000010100
+01001010011110000100
+01001011011100101000
+01001100100101011110
+01001100101010001000
+01001101010100111010
+01001101111010000110
+01001110000101001101
+01001110001010000101
+01001110011010000100
+01001110011110000000
+01001111001111111010
+01001111110100110100
+01010001001110101010
+01010100100101100000
+01010101110001110000
+01010110100101011101
+01010110100101100000
+01011000001100110110
+01011100100111111110
+01011101101000011100
+01011101110110100000
+01011110001010100111
+01100000110111111110
+01100001101111101100
+01100001110001100011
+01100011001100010101
+01100100000010111110
+01100100001010000100
+01100100001101111001
+01100110000100101011
+01100111001010001011
+01101000010001011000
+01101001001010010110
+01101101000100011111
+01101101100110101011
+01101111001010000101
+01101111001010101010
+01110000010100010110
+01110001100101111100
+01110001111111101010
+01110011001001111100
+01110100000111101011
+01110100001000001100
+01110100111010000111
+01110101101110101111
+01110101110011011111
+01110110111010011101
+01111000000001111001
+01111000010001100110
+01111000010001111001
+01111000110111010010
+01111000110111111111
+01111010000101101011
+01111011101010010110
+01111100100111111110
+01111100100111111111
+01111110101101011000
+10000001111110000101
+10000010000011001110
+10001100101010011011
+10001110010110110100
+10010010001100000010
+10010101111011011111
+10010110010000010001
+10010111010111011010
+10010111011110000101
+10011001110100100100
+10110001010110111100
+10110001010110111100
+10110001110110101101
+10110011001010100111
+10110011010110111110
+10110011101111100100
+10110101000111101011
+10110110010101101011
+10111100001010001110
+10111111111100010001
+11000100010100110110
+11000100100111011101
+11000101000010100110
+11001011011100101011
+11001111100011101101
+11010001001100010110
+11010100000101111010
+11010100111011111011
+11010111011000010110
+11101100001011000111
+11101101101110000010
+11110100011000011010
+11110110111110001000
+11111000010001110000
+11111001101101010101
+11111100010101101011
+Started at Sat Apr 26 02:07:30 +0100 2008
+Took 1722.345688 seconds
+Generation number 9
+00000100000110000110
+00000100010110000110
+00000100100011101101
+00000100101000100101
+00000101000010111101
+00000101010100000000
+00000101100011111100
+00000110110011011110
+00001000000100111011
+00001010011010111010
+00001011000100101011
+00001011011010011001
+00001011011100000100
+00001100001101101001
+00001100011010000010
+00001100101111011110
+00001101000100000011
+00001101011111111000
+00001101100001100101
+00001110001000010101
+00001110010011011111
+00001110011010111011
+00001110101010000101
+00001110111010000101
+00001111001010110111
+00001111001010111110
+00001111010101010111
+00001111011001111011
+00001111111101111000
+00010000100101100000
+00010001001111110001
+00010001110001100011
+00010010101011000101
+00010010101011100101
+00010010101110101111
+00010100100111001101
+00010100101010011011
+00010100111010000111
+00010101011100101100
+00010101011100111000
+00010101011110101110
+00010111010000010010
+00010111011000010000
+00011010011100011011
+00011100001111011011
+00011100010110100100
+00011110010010001001
+00011110011100000111
+00011110111011000111
+00011110111111000111
+00011110111111011011
+00100011010101101000
+00100100000100000110
+00100101000111101011
+00100101011100100000
+00100101111101100110
+00100111100101111000
+00101000010000111011
+00101000010101111001
+00101000101011111001
+00101001101000010010
+00101100111010011101
+00101101001000111001
+00101101001110101011
+00101111011101010011
+00110000001011110001
+00110000110001111010
+00110001001110110100
+00110001001111110001
+00110001110010001110
+00110011001100000100
+00110100010001110001
+00110100010110011101
+00110100010111000000
+00110100011000011010
+00110101010010111110
+00110101011101111011
+00110110001001010101
+00110110011010001101
+00110110111101010101
+00110111000000001011
+00111000010010111001
+00111000010100101100
+00111000010101101010
+00111000100001100010
+00111000100101011110
+00111000110000111101
+00111000110111010010
+00111001010111011011
+00111010000010101010
+00111011001101010011
+00111100000000010111
+00111100001101011011
+00111100010010111001
+00111100010101111011
+00111100011010010101
+00111100011101011011
+00111100011111000000
+00111100011111111100
+00111101101001100101
+00111110000011101010
+00111110010110110100
+00111110011111011101
+00111110011111111100
+00111110101010011011
+00111111100011101101
+01000000010011101000
+01000000011011101011
+01000001110000100110
+01000010000011001110
+01000010011101100011
+01000010011111111011
+01000011010111011010
+01000100010111011010
+01000100101010010110
+01000101111010000000
+01000110011011111100
+01001000011011101011
+01001010010001100110
+01001010011000010100
+01001010011110000100
+01001011011100101111
+01001100011001101001
+01001100101000001000
+01001100110101011110
+01001101000110101011
+01001110000100101101
+01001111001010000101
+01001111010011011011
+01010101000111101011
+01010110100101101100
+01010111001110000101
+01010111011100010110
+01011000110111010010
+01011110011010000101
+01100010101010101101
+01100011000001111100
+01100011010100101011
+01100100001110110111
+01100100100000010111
+01100111011010000000
+01100111101010001011
+01101001001011000001
+01101101000100011111
+01101101000110010110
+01101101010111010010
+01101101100110101001
+01101101111010000111
+01110000010100010110
+01110000010111011110
+01110011001001111100
+01110011011110000000
+01110100010100110100
+01110100111010001111
+01110101101110101101
+01110101110100111010
+01110111011010011001
+01111000000001111001
+01111000010001111001
+01111000101010101010
+01111000110111111000
+01111000111011101011
+01111000111111010010
+01111011100010010111
+01111011101001010110
+01111100000001111001
+01111100100111110100
+01111110100111111110
+01111111111111000011
+10000001010010100111
+10000101111110000100
+10001001011111110110
+10001100100001100101
+10001100110010011010
+10001101010110000011
+10001110010111110001
+10001111001010010111
+10010011101011100111
+10010100100001001000
+10010111011110000110
+10011001111111011011
+10101101000110111101
+10101110000100110111
+10110101000101101010
+10111000010001100110
+10111011101111100100
+11000100101010000101
+11001000000001111001
+11001000010001101001
+11001011011100101011
+11001110000011101011
+11001111110011101101
+11001111110100110100
+11010100000100010101
+11011100010101101010
+11011101001100101011
+11100110101100010101
+11110101010110000000
+11110101101000010010
+11111001100011001111
+Started at Sat Apr 26 02:36:12 +0100 2008
+Took 1926.564649 seconds
+Generation number 10
+00000001101010101100
+00000100000011101101
+00000100000110011101
+00000100100011101100
+00000101000010111101
+00000101010100000000
+00000101101100010111
+00001000000000111011
+00001000000111111100
+00001000011011101011
+00001011001100000100
+00001011011111100011
+00001011101010110111
+00001100010011011111
+00001100010110100100
+00001100011010000000
+00001100100101100000
+00001101000110000010
+00001101011111011000
+00001110001011111001
+00001110001111101001
+00001110010011011001
+00001110010011011111
+00001111000100101011
+00001111001010011010
+00001111001010111100
+00001111010100101011
+00001111011001111110
+00001111110100110100
+00001111111101110100
+00001111111101111000
+00010001001001111011
+00010100000000111100
+00010100100011100110
+00010101010000100100
+00010101010110100011
+00010101111010000100
+00010110010010001101
+00010111011000010010
+00011000010110111110
+00011000010111011110
+00011001101111001011
+00011010011100010011
+00011100001101101001
+00011100010110100100
+00011100011010010101
+00011110010001111010
+00011110111100010110
+00011110111111011011
+00100000001100000110
+00100000010101111010
+00100100000100010101
+00100100001110110111
+00100100011100001011
+00100101011100100000
+00101000010001100110
+00101000010100110111
+00101000011000010010
+00101000011011010101
+00101000110100111011
+00101000110101010010
+00101001101000011010
+00101011101111100100
+00101100001111011011
+00101100011010111011
+00101100111010011101
+00101101001000011001
+00101101001110001011
+00101101001111111000
+00110000010111011110
+00110000110001111011
+00110000110010001110
+00110000111000011010
+00110001001110100100
+00110001111100001111
+00110010000011101010
+00110010101011100101
+00110011001101111001
+00110100000100010101
+00110100010000111011
+00110100010011111010
+00110100011000010010
+00110100011000011010
+00110100011000011010
+00110101010010111011
+00110101110010101110
+00110110001001010101
+00110110001001010101
+00110111000000001011
+00110111000011101101
+00111000010101101001
+00111000010101101010
+00111000011101100010
+00111000100101011110
+00111000110000111101
+00111000111110000111
+00111010010010111001
+00111010010110110100
+00111011001100000101
+00111011110001111010
+00111100001001011011
+00111100001011000101
+00111100010100111001
+00111100011010010101
+00111100011010011101
+00111100011100111011
+00111101010111110010
+00111101101001100101
+00111101111101101010
+00111110000100110111
+00111110011101011101
+00111110011111010101
+00111110111100000111
+00111111001010111110
+01000000011011101011
+01000000011011101011
+01000100010111111000
+01000100010111111110
+01000100101110010110
+01000101100000111011
+01000110000011001101
+01001000100111111110
+01001010000000101101
+01001010010110010100
+01001010101010000101
+01001111010011011011
+01010000100101110000
+01010101000111101011
+01010101001110111111
+01010111000111101011
+01011001010111011011
+01011010110111010010
+01011100000011110011
+01100001000111011011
+01100011010111011010
+01100100000100000110
+01100100000111101011
+01100100011110110111
+01101000111010111011
+01101001001011101011
+01101011101001011011
+01101100010111000000
+01101101010100111010
+01101101010111000110
+01101101111010000011
+01101101111111010010
+01110000010111111101
+01110010011101100011
+01110101000100011111
+01110101101110101101
+01110101110100111010
+01110101110111010010
+01110110000011000111
+01111000010100101110
+01111000101001111011
+01111000111010011010
+01111000111011000001
+01111000111110101010
+01111010101011000101
+01111011100011101101
+01111100000000010111
+01111100001101000000
+01111101000100011111
+01111110011001111011
+01111110100111111111
+01111111011010001001
+10000101010000000001
+10000101010100000000
+10001001010010010010
+10001011110010010111
+10001100010110011010
+10001100100001100101
+10001100100001100110
+10001100100011101101
+10001100110011011010
+10001111011111001101
+10010000111111010010
+10010010110101101100
+10010011110111101000
+10011001111111011001
+10011010011100011011
+10011010110111010010
+10011100100111000001
+10011101010110001110
+10110101111101100110
+10110110011010001100
+11000101010010111110
+11000101011111110110
+11001000000000000100
+11001001010001001110
+11001001010001101001
+11001001111010000000
+11010100000100010101
+11010101011100100000
+11011100001011100111
+11100110101100010101
+11100111101110101011
+11101011100011001111
+11111000100101011110
+11111000101010101010
+Started at Sat Apr 26 03:08:19 +0100 2008
+Took 2014.162627 seconds
+Generation number 11
+00000010110101101000
+00000100000001101101
+00000100000011101101
+00000100011100110111
+00000100110110111010
+00000101011000010011
+00001000001101011011
+00001000010100101110
+00001000010111011100
+00001000011011101011
+00001000100001011111
+00001001011011101111
+00001001111010000010
+00001011001100000010
+00001011011111000011
+00001011101110100100
+00001100000100000110
+00001100010011011110
+00001100010011011111
+00001101010010011111
+00001101100101000000
+00001110010011011001
+00001110010011011010
+00001110010011011110
+00001111000011101101
+00001111010011011010
+00001111010100101011
+00010001000110101011
+00010100000000111100
+00010100100011100110
+00010100100100010011
+00010101010000100100
+00010101010110000110
+00010101111100010110
+00010110111110000111
+00010111111100000010
+00011000000011001010
+00011000101001100101
+00011000101010101010
+00011001010110111111
+00011010011011100110
+00011010011100010011
+00011010100111010010
+00011101110101101010
+00011110100000111011
+00011110111111011011
+00011111111111011011
+00011111111111011011
+00100000010101111000
+00100000011000011010
+00100010000001010101
+00100100011100001011
+00100101111111110010
+00100111001110111101
+00101000000011001101
+00101000010100110111
+00101000011000010010
+00101000011011000111
+00101000110100101011
+00101000110100110110
+00101000110101010110
+00101000111010111011
+00101000111110101010
+00101001101000011110
+00101010010011100011
+00101100011010111101
+00101100111010011101
+00101100111011011100
+00101101001110001011
+00101101001111000111
+00101101010110110101
+00101101010111011001
+00101101011010111011
+00101110001011111001
+00110000111000101111
+00110000111001011010
+00110001111110001111
+00110010000011101010
+00110010010010111110
+00110010111111010101
+00110100010011111010
+00110100010111111011
+00110100011000010010
+00110100011000010100
+00110100011011011010
+00110101101111001011
+00110101110010011011
+00110110010110010100
+00110111000000001011
+00110111000100101111
+00111000000010001101
+00111000110001001110
+00111000111110000111
+00111001010100111010
+00111001011100000001
+00111010011111011001
+00111011001100011001
+00111100000011001111
+00111100010101100110
+00111100010110111001
+00111100011001011011
+00111100011111101011
+00111100100111000001
+00111101101001000111
+00111110001100000101
+00111110111100010110
+00111111001110111110
+00111111010110010100
+00111111101001100101
+01000000011011010101
+01000000011011101011
+01000000011101101001
+01000100000111111100
+01000100010111111111
+01000100101110010110
+01000101100000111011
+01000110010111111110
+01000111111110101001
+01001000011011101011
+01001010010110010101
+01001010111011000000
+01001100100011101101
+01001111001010111101
+01010000011110101011
+01010101000111101011
+01010101010010110110
+01010111000111101011
+01010111000111101011
+01011001001110000100
+01011001010111011011
+01011001111010011011
+01011011010000001011
+01011110000011110011
+01011110101111111011
+01100100000010000100
+01100100000101100000
+01100100000110101011
+01100100000111101011
+01100100010111111000
+01100100100011101110
+01100111101110101011
+01101000010100110111
+01101000011000010010
+01101000111010101011
+01101011110011001111
+01101101001110001011
+01101101010010111010
+01101101010110000110
+01101101010111000110
+01101111010100101011
+01110000101011000001
+01110011010111011010
+01110011011101100001
+01110101110110111110
+01110101110111011110
+01110101111110100100
+01110110000011010101
+01111000010011101011
+01111000111110111001
+01111010011111000101
+01111010101011000101
+01111011100011101011
+01111100001101100010
+01111101000110111111
+01111101010100010101
+01111110011010011101
+01111110101000011010
+01111111011001111110
+10000101000000001111
+10001000001001000000
+10001001010000111101
+10001011110011010011
+10001100010100011010
+10001100010110011010
+10001100010110011010
+10001100110011011010
+10001111110100110100
+10010010110101101100
+10010100000110011101
+10010101011000010010
+10011001110110110100
+10011110010001111010
+10011110011010001100
+10100111101110101011
+10101011100011011111
+10110101000100010101
+10111001000111011001
+11000101011110111111
+11001001010000111001
+11001100100111111100
+11011011010111110010
+11011110111100010110
+11100100011100001011
+11100100011110110111
+11100101011110011011
+11101011101011101011
+11101011111011000101
+11101100010110000100
+11110101001111111011
+11110101111010000100
+Started at Sat Apr 26 03:41:53 +0100 2008
+Took 2051.893687 seconds
+Generation number 12
+00000001011000010011
+00000010010100111010
+00000100000110101011
+00000100010111111011
+00000100011100110101
+00000100011100110111
+00000100100110111010
+00000100110110111010
+00000101001110011011
+00001000011000010010
+00001000011011000111
+00001000011011110100
+00001000111111111011
+00001001010001101011
+00001001011011101101
+00001001111010001010
+00001010000001010101
+00001010001101011111
+00001011010100101011
+00001011011111000001
+00001011101110100101
+00001100010011011011
+00001110010010001011
+00001110010010101111
+00001110010011011001
+00001110010011111010
+00001110101000011010
+00010001000110101011
+00010001000110101011
+00010001010000100100
+00010010100111000010
+00010011010111110010
+00010100010100010101
+00010100100011100110
+00010100110100010011
+00011000101001100101
+00011001010110111111
+00011001110111001011
+00011010011100010011
+00011011101110110110
+00011011110001001111
+00011100011000011010
+00011110010011011001
+00011110010110111010
+00011110111111111011
+00011111010100100110
+00011111010110010100
+00011111111111001011
+00100000000101111000
+00100000011011101011
+00100000111000101101
+00100001011000011010
+00100010000001010100
+00100010110101101100
+00100100000100111100
+00100100010011101011
+00100100011100011010
+00100101011010110100
+00100111101000011110
+00101000001011011010
+00101000011011001011
+00101000011011101011
+00101000111010111011
+00101000111110110110
+00101100000011001101
+00101100011001010110
+00101100111011011110
+00101101001111000111
+00101101010011011011
+00101101011000011111
+00101111010100101011
+00110000111010011010
+00110000111111011111
+00110001101110001111
+00110001111110001111
+00110011011000010011
+00110100000111101011
+00110100010111111011
+00110100011000010111
+00110100011011010010
+00110100111110101010
+00110101101111001001
+00110110001000011100
+00110111000100101010
+00111000000000111111
+00111000010101100111
+00111000011111000111
+00111000100001001110
+00111000110011011110
+00111000111010100001
+00111001000000001100
+00111001001000100001
+00111001011100000001
+00111001110001101000
+00111010001111011010
+00111100010101100110
+00111100010101101011
+00111100010101111011
+00111100011011001011
+00111100011111101111
+00111101000010011111
+00111101010010110110
+00111101010010110111
+00111101010111011001
+00111101110010011011
+00111110001110111110
+00111110011010011101
+00111110011111011010
+00111111101001111011
+01000000010101100110
+01000000011011010101
+01000000011011101111
+01000100000101100001
+01000100011010110100
+01000101100010001101
+01000110010101111011
+01000110010111111110
+01001000011011101011
+01001111001010101111
+01010000011000000010
+01010001111100001111
+01010100100011100110
+01010100111001011011
+01010111000111100011
+01011001010110111101
+01011100010110011010
+01011110011100011010
+01011110101110101010
+01011110101111111110
+01100100000110101011
+01100100100011101110
+01100100101110010110
+01100101000110000110
+01100101101111001011
+01100101111110011011
+01101000011000001011
+01101000011000010010
+01101000011101100001
+01101000101000011010
+01101000111010101010
+01101001010100110111
+01101001111011000101
+01101010010011011010
+01101011100011001011
+01101101010000111000
+01101101010110000110
+01101101010110000110
+01101111101110101011
+01110000010011101011
+01110000101011010000
+01110010111110111001
+01110100011000010010
+01110100110111011110
+01110101110110011111
+01110101110110111110
+01110110000011010101
+01110110000011110100
+01110110000110011010
+01110110010110000100
+01110111001110011111
+01111000010001000101
+01111000110011101011
+01111001110110000111
+01111010011110000111
+01111010101011101111
+01111101010010011111
+01111101010011111010
+01111101010100010101
+01111110011010011101
+01111110101101111011
+01111110101111001110
+01111110111010101010
+10000100000011100111
+10000101000000000001
+10001100010011011100
+10001100010111010101
+10001100100111111100
+10001111110111010101
+10010001000110011001
+10010001110110101011
+10011010001010100110
+10011110001111111011
+10101000011000010011
+10101000011100001011
+10101011011100100011
+10110011000000000101
+10111000101111111100
+10111011010100001110
+11001001010000111001
+11001010011100001011
+11001100110011011010
+11010101011110001011
+11011010111111010111
+11100100100011101110
+11100101010010110000
+11100101010011110110
+11100101010111011110
+11101011101011101011
+11101100100111111100
+11111101000110111101
+Started at Sat Apr 26 04:16:05 +0100 2008
+Took 2131.171748 seconds
+Generation number 13
+00000000000110101011
+00000000010111010110
+00000000011011101001
+00000001011000010011
+00000010010110111110
+00000100010111111011
+00000100100011100110
+00000100100111101110
+00000100111000001011
+00000101011100110001
+00000101101110011011
+00000110010110111110
+00001000011000010011
+00001000111001001111
+00001001010001100011
+00001001010001101011
+00001001010110111111
+00001001011011101100
+00001001101010001011
+00001001110010001010
+00001001110110000101
+00001010000001010100
+00001010010111111110
+00001010011111000001
+00001011011110111110
+00001011101110100101
+00001011111101100101
+00001100000011011011
+00001100100011101110
+00001101010011011011
+00001110010010000011
+00001110010111111011
+00001111011010111111
+00010000000110101101
+00010001010000100101
+00010001110000100100
+00010011010000100101
+00010100110100010101
+00010100110110111010
+00010110101111001110
+00011000111111111011
+00011001011011100110
+00011011100101100110
+00011011101010110110
+00011011101110110110
+00011011101110111110
+00011011110001001101
+00011011110110001010
+00011110001110101011
+00011110010110111010
+00011110010110111011
+00011110110011101011
+00011111010110010100
+00011111011100011010
+00100000111000011010
+00100001011000010011
+00100011011000000111
+00100011101010011110
+00100100011000111011
+00100100011010010100
+00100100101111111110
+00100111101100011111
+00101000011011101011
+00101000111110110100
+00101001011001011010
+00101001011011001011
+00101010101011101111
+00101011010100001100
+00101011111100001011
+00101100000111111011
+00101101001111011010
+00101101011001010111
+00101101011111001011
+00101110001000011100
+00110000001011101101
+00110001000111101001
+00110001111111111011
+00110010111010011010
+00110011000100001010
+00110011001001011011
+00110110001000011100
+00110110001010011110
+00110110011100001011
+00110111000100100111
+00111000001011011010
+00111000010000111111
+00111000011010110110
+00111000011101000001
+00111000011111000111
+00111000110111010101
+00111000111010100011
+00111000111110001111
+00111001001001110111
+00111001010111011111
+00111001011100000001
+00111010011010100001
+00111100010101011011
+00111100010111000111
+00111100011000010111
+00111100011011001011
+00111100110010011010
+00111100111110101010
+00111101000010011110
+00111101010010100001
+00111101110010011011
+00111110011110101111
+00111110101011101011
+00111110110010110000
+00111111010011110110
+00111111101101111011
+01000010010000111000
+01000101010001101111
+01000101100010001101
+01001000111111111011
+01001001111011000101
+01001010001101011111
+01001011010100101011
+01010001000111101011
+01010110000011110100
+01011000111000100011
+01011010011110000101
+01011010101111111110
+01011100010110011011
+01011100101111000001
+01011110010011001011
+01100000011111100001
+01100100101110001110
+01100101010111110110
+01100101011110001011
+01100101111110010011
+01100110000011110110
+01101000011100110101
+01101001010111000100
+01101001011111001011
+01101001101000011010
+01101011101110100011
+01101011111011000101
+01101100000011111011
+01101101010000111110
+01101101010100110101
+01101101010110011101
+01101101010111010110
+01101111111011000101
+01110000010001101011
+01110000011011101011
+01110100010101100110
+01110100011011010001
+01110100110111011101
+01110101010011111110
+01110101110110011011
+01110110000110111010
+01110110110110000101
+01111000010011001101
+01111000011111101011
+01111000111111111011
+01111001101110111111
+01111010011110001010
+01111100010100010101
+01111100101111100010
+01111101000101001011
+01111101010010011101
+01111101010100010101
+01111110101101111011
+01111110101111001010
+01111110111010101010
+01111110111011000110
+10000001011000011010
+10000101011000010011
+10001001111011001011
+10001100000101000001
+10001100010011010101
+10001100010111010101
+10001100010111011100
+10001100011011110000
+10010001110110101010
+10011000101001000001
+10011001010001010110
+10011110111010100001
+10011111111110010101
+10101011001001100101
+10101100101110100101
+10101101011110000110
+10110011000000000111
+10111100010001100110
+10111101010010110110
+11000000010101100000
+11001000011011000010
+11001000011100001111
+11001001010000111000
+11001010011100001010
+11010100011000001011
+11010110000110111010
+11100100101010011101
+11100100110011011001
+11100101010010110000
+11100101011010110001
+11100111010011011110
+11101000011000001111
+11110101010111011110
+11111101000110111111
+Started at Sat Apr 26 04:51:36 +0100 2008
+Took 2193.372392 seconds
+Generation number 14
+00000000010111010110
+00000000011010101000
+00000001011011011001
+00000010000110111010
+00000010010110110110
+00000011010000100101
+00000100100110101110
+00000100111000001011
+00000101011100110001
+00000101101100011011
+00000101111100110011
+00000110010110111100
+00000110010110111110
+00000110011010101011
+00001000010001101011
+00001000111001001110
+00001001010001010110
+00001001010001100010
+00001001010001101011
+00001001010001111110
+00001001010010011011
+00001001010010110110
+00001001010101001010
+00001001010110111110
+00001001011011101100
+00001011010110111111
+00001011011101001101
+00001011011111000010
+00001011100101100110
+00001011101110100101
+00001011101110100101
+00001011101110110000
+00001011110110000101
+00001011111100000011
+00001011111100001011
+00001100000011011011
+00001100000110101011
+00001100000111111011
+00001100010111101001
+00001101010011011011
+00001110000011011011
+00001110010111111101
+00001110101010011100
+00001110101111001110
+00001110111011000110
+00001111011010111010
+00010000101010101010
+00010001000111101011
+00010001010000001011
+00010001010000100101
+00010100000011011011
+00010100011111100110
+00010100100011000110
+00010100110111000111
+00011000011100010011
+00011000111010100011
+00011001010011100110
+00011001110100010101
+00011001110110101111
+00011011100101101010
+00011011101101100110
+00011011101110000101
+00011011101110111111
+00011100010111111011
+00011100110011101011
+00011101011100110101
+00011110001100011010
+00011110001110101010
+00011110011100011010
+00011110111010110001
+00011111111110010101
+00100100011011011111
+00100110011101001011
+00101000110000001011
+00101000111111111011
+00101001010001111010
+00101001011001011010
+00101010011010100001
+00101101011001010111
+00101110001000011100
+00110000011000011011
+00110001011011001011
+00110010111010011010
+00110100101110001110
+00110100110110111010
+00110110011000010011
+00110111000100100111
+00111000010010001010
+00111000110110100001
+00111000110111010101
+00111000110111010101
+00111001010111010110
+00111001011100010111
+00111010011110000101
+00111011100011101111
+00111011100101100110
+00111100010110110010
+00111100010111010101
+00111100011000000101
+00111100011011001001
+00111100011011001011
+00111100110000011011
+00111100111011001011
+00111100111110101010
+00111100111110101011
+00111101010010011101
+00111101010011010101
+00111101100101001011
+00111110010111101111
+00111110011000001011
+00111110011110101111
+00111110101010101111
+00111110110000110011
+00111110110010110000
+00111110111111101011
+00111111010011110110
+00111111110010100101
+01000001100010001101
+01000101010010000011
+01001000011110111110
+01001000111110110100
+01001001011111000111
+01001010001101010100
+01001010010111010110
+01001011010100101011
+01001101110110000101
+01011010011110111110
+01011011110000110100
+01011100010011100101
+01011100101111000001
+01011110010011011110
+01100000010001101011
+01100101010111111110
+01100101011111110110
+01100110110110000101
+01101001111111001111
+01101100000011111011
+01101101000100110101
+01101101010000111110
+01101101010010011101
+01101110000110101011
+01101111010011101011
+01101111111011000101
+01110000011110110100
+01110100010101100111
+01110100011011010001
+01110101010111101011
+01110101111011101011
+01111000010011001101
+01111000011011101011
+01111000011111101011
+01111000011111101011
+01111001001110111110
+01111001101110111111
+01111011010100001100
+01111100101111100011
+01111100111101100010
+01111101000110111111
+01111101010011110110
+01111110100110010001
+01111110101111001110
+01111111111010101010
+01111111111010101101
+01111111111101100101
+10000001001010010011
+10000001101110111110
+10000101101110011000
+10001001011100000001
+10001010111100001010
+10001101001101111011
+10001101010010110001
+10011001010001010100
+10011001010001100001
+10011011000001101101
+10011111110110010100
+10101000010110011011
+10101011010100001100
+10101100111101000000
+10110001000111110111
+10110011000100001000
+10110110010110111100
+10111000111111001011
+10111101010010111110
+10111101010011110110
+11000100101010011101
+11000101010001101111
+11001000011100001111
+11001010011100001010
+11001010011110111110
+11001011010101100110
+11010100011000001011
+11011000010000111110
+11011110000110111010
+11100100101010011010
+11100100110000010011
+11100100110011011001
+11101100000011111011
+11101100011100110101
+11110100110111011101
+11111101000110111110
+Started at Sat Apr 26 05:28:09 +0100 2008
+Took 2335.23266 seconds
+Generation number 15
+00000000010011011011
+00000000011000101000
+00000001010000001011
+00000001011011000101
+00000001011011011001
+00000011010000100101
+00000011010000111001
+00000100101101100101
+00000101111101100111
+00000111110010100101
+00001000010011010101
+00001000010100100011
+00001000010101101011
+00001000010110110110
+00001000100110101001
+00001000111001001110
+00001001001001010110
+00001001010000001011
+00001001010000010110
+00001001010001010110
+00001001010001010111
+00001001010010110110
+00001001010010110110
+00001001011011101100
+00001001110111000110
+00001010111011101011
+00001011011110001011
+00001011100101100101
+00001011101010010101
+00001011101011110001
+00001011101110100110
+00001011110110000101
+00001011111010001011
+00001011111100001011
+00001011111110100101
+00001100000011011011
+00001100000011111011
+00001100000110101011
+00001100110010111010
+00001100111011101011
+00001101010010110001
+00001110000011011011
+00001110000011111011
+00001110001000011100
+00001110010010110000
+00001110010111100111
+00001110010111111001
+00001110110111010101
+00001111000011011011
+00001111001010111110
+00001111011110111010
+00010011101110100000
+00010100011110100110
+00010100101110111111
+00010100110111000111
+00010101000011111011
+00011000011100011111
+00011001101110110110
+00011001110100010101
+00011001110110100010
+00011001111100010011
+00011010011100011110
+00011011101001101110
+00011011101101100110
+00011011101110111111
+00011100000011011011
+00011100010111100101
+00011100101100100101
+00011100111110101011
+00011101010000010011
+00011101011011001000
+00011101110110101111
+00011110001100000101
+00011110001100011011
+00011110001100011011
+00011110001111001101
+00011110011100011010
+00011110111101100110
+00011111110110010100
+00011111110110010111
+00100000010001101011
+00100010010001101011
+00101000111001001110
+00101001010010011010
+00101001010101001000
+00101001010111000010
+00101001011010101000
+00101001110111010111
+00101100001011001011
+00101100010111100110
+00101101010000100010
+00101101010011010101
+00101111011110011010
+00110011010110111111
+00110100011001011010
+00110100011100000101
+00110100011111100110
+00110100100110100110
+00110100110110111010
+00110100110110111110
+00110100110111111010
+00110100110111111010
+00110110001100000010
+00110110010111101110
+00111000100110101110
+00111000110011010101
+00111000110110111110
+00111001010110111111
+00111001011100010001
+00111001011100100111
+00111001110011101111
+00111010011110000101
+00111010011110011010
+00111011010111010000
+00111100011000001010
+00111100110111011010
+00111100111110100010
+00111101010001100010
+00111101111000110101
+00111110010100000111
+00111110010111010110
+00111110011101101111
+00111110011110101111
+00111110110010111000
+00111110111100011010
+01000000010010011011
+01000001100010001101
+01000100101011000110
+01001000111110110100
+01001001011011101000
+01001010001101010100
+01001011010001111011
+01001011010100101011
+01001011010100110100
+01001011110110000101
+01001011111110110100
+01001100010111100001
+01001101110110000101
+01001101110110000101
+01010101111000001011
+01011010011110111010
+01011011010000110100
+01011110000110111011
+01100000010001101011
+01100000010101101011
+01100100110111011001
+01100101011111110110
+01100110110010001011
+01100110110100000110
+01101000010101000110
+01101001011111000111
+01101011111111001111
+01101100000011111011
+01101110101010011100
+01101110111101000000
+01101111111011000100
+01110000011110101001
+01110000011110110100
+01110010011001101011
+01110011010000001100
+01111000010010100010
+01111000110011010101
+01111001011011100010
+01111010101110101110
+01111100111101101101
+01111100111101110010
+01111101000110010011
+01111101010011110111
+01111101110011110010
+01111110101110001111
+01111111011101100101
+01111111110110101010
+10000100010110111100
+10000101101110011001
+10000101111110110011
+10001100000111101011
+10001101001101111010
+10011000010001101110
+10011100110011100101
+10011101001101110011
+10011110010011100010
+10011111110111111101
+10100000011000010011
+10101100110101010000
+10101111010000111110
+10110010110110111100
+10110101010001011011
+10111110101111001110
+11000100100101100110
+11001001010010011011
+11001010011001011011
+11001010011110111010
+11011000000000111101
+11011000010000010101
+11011110000110110101
+11100100101010011110
+11100100101010011110
+11100100110000010101
+11101100000011011011
+11111101000110111110
+Started at Sat Apr 26 06:07:05 +0100 2008
+Took 2289.021254 seconds
+Generation number 16
+00000000010011011011
+00000001010000010111
+00000010111011110111
+00000011000000111001
+00000011110110000010
+00000100100101100110
+00000100101011000110
+00000100110000010101
+00000101000110111110
+00000101111011001101
+00000111011011001000
+00000111100010100100
+00000111100010100101
+00000111110010001011
+00001000010010110000
+00001000010100100110
+00001000110001001110
+00001000110100010101
+00001000110110100101
+00001001000110100111
+00001001010000010110
+00001001010001011011
+00001001010101100111
+00001001010110111111
+00001001011011101100
+00001001111110010011
+00001010000001001011
+00001010111101100110
+00001011010010011110
+00001011101011110010
+00001011101011110100
+00001011101110100100
+00001011111100001001
+00001011111100011011
+00001011111110110100
+00001100010010111000
+00001100011001101011
+00001101010001001010
+00001101010010110001
+00001101110110101010
+00001101111011011001
+00001110000011011011
+00001110000111101011
+00001110010000001011
+00001110010010110000
+00001110010011100111
+00001110100110100110
+00001111001010111110
+00001111001010111110
+00001111001010111110
+00001111100101100101
+00001111110110000100
+00010000011000101000
+00010011101110101111
+00010100011001011011
+00010100011110100010
+00010101000011110101
+00011000011100011111
+00011000110110111110
+00011001010001010101
+00011001110100010101
+00011001110100101110
+00011010010000011011
+00011011010100110100
+00011011101011101011
+00011011101101101110
+00011011101111011101
+00011100000011111110
+00011100001100001011
+00011100010100001111
+00011100101100100101
+00011100101101000101
+00011101000000111111
+00011101110010101011
+00011101110110101010
+00011110001100000101
+00011110111101100110
+00011111000010010000
+00011111011100011110
+00011111110110010101
+00011111111100001010
+00100000010001100010
+00100010010001101111
+00100010010011000010
+00100011010001101011
+00100011010010100101
+00100101010010100001
+00101001010010011010
+00101001010110000101
+00101001110111010111
+00101010111011000011
+00101011111100100101
+00101100001011001011
+00101100001011010100
+00101100010001011001
+00101101010111001011
+00101101110111010000
+00101110111101000000
+00110000010110101010
+00110000110000001010
+00110011010010110110
+00110011011110110111
+00110011110110100000
+00110100010110111110
+00110100011011101100
+00110100011100000101
+00110100110110111010
+00110110001100010010
+00110110110111101010
+00111000100110101110
+00111000101110101010
+00111001000011011011
+00111001010010011010
+00111001011100110110
+00111010001110000101
+00111010010111100111
+00111010011110000101
+00111011010000110100
+00111011010011010000
+00111011010111100110
+00111100011110111010
+00111100110111011000
+00111100111110000010
+00111101110111111010
+00111110010100000110
+00111110011011111010
+00111110011101101111
+00111110011110000101
+01000100101010000110
+01000100101011000110
+01001001010001110111
+01001001110111111010
+01001010011100101011
+01001011011110111010
+01001011100110010101
+01001100101011000110
+01001110101110101011
+01001110110110101111
+01010001011001101011
+01011000001010111010
+01011000011100011111
+01011000110011010101
+01011000110011110101
+01011011100011110001
+01011011110101000000
+01011100001001011110
+01011111110110000101
+01100000010100100011
+01100100110001100110
+01100100110111111001
+01100110110010011011
+01101000010000001011
+01101101010000100011
+01110001011110101001
+01110011010110011110
+01111000010010100010
+01111000100011010101
+01111000100110101100
+01111000110011110101
+01111010111110101110
+01111100111101101101
+01111101100011111111
+01111111011011001100
+01111111110110101111
+10000000001000100101
+10000100010110111100
+10001000110100101011
+10001001011011101100
+10001001110111000110
+10001011011110001011
+10001110000111101011
+10001111010110111111
+10010101110110101111
+10011000010001010101
+10011010010011100010
+10011010011110011010
+10011101101100100101
+10011101110101010111
+10011110000010100101
+10101001011000101000
+10101111010011111011
+10110101010001010110
+10111001111001001110
+11000001011011000101
+11000100101011000110
+11001001010010011011
+11001010011001011010
+11001011010010100101
+11001101001101011010
+11001101010010110001
+11010000010000010101
+11011000000000111001
+11011000010000010100
+11011000010001001111
+11011000010010010101
+11011001010011011011
+11100000010001101011
+11100100101010011011
+11111000111101101101
+11111001100010001111
+Started at Sat Apr 26 06:45:14 +0100 2008
+Took 2222.522446 seconds
+Generation number 17
+00000000000000010010
+00000000001010101000
+00000000010000101011
+00000010000000111001
+00000010011011100011
+00000011000000000101
+00000011000000111001
+00000011101110110100
+00000011110110000010
+00000100100000010101
+00000100101101111010
+00000100110000010101
+00000101000110111110
+00000101110100010101
+00000101111011001101
+00000110001001011010
+00000111010001110111
+00000111011011001001
+00000111110010100100
+00001000010010110100
+00001000010100100111
+00001000110110100101
+00001000110110100101
+00001001010000010110
+00001001010001001010
+00001001010011011111
+00001001010110101001
+00001001011011101100
+00001001100010100101
+00001001110011011011
+00001001111100000001
+00001001111110010011
+00001010000001001011
+00001010111100011011
+00001010111101100011
+00001011001110100100
+00001011010110111111
+00001011101011110001
+00001011101011110011
+00001011110110101010
+00001011111100001001
+00001100010011110001
+00001100101111100110
+00001100110001101110
+00001101001101011010
+00001101010001101010
+00001101010111100110
+00001101010111101011
+00001
\ No newline at end of file
--- /dev/null
+K 25
+svn:wc:ra_dav:version-url
+V 41
+/svn/njae/!svn/ver/6/TrapTheCap/trunk/lib
+END
--- /dev/null
+8
+
+dir
+68
+http://scripts.njae.me.uk/svn/njae/TrapTheCap/trunk/lib
+http://scripts.njae.me.uk/svn/njae
+
+
+
+2008-04-25T21:36:06.714616Z
+6
+neil
+
+
+svn:special svn:externals svn:needs-lock
+
+
+
+
+
+
+
+
+
+
+
+0ada9808-85ab-4924-adda-5bf89eae3818
+\f
+libttc.rb
+file
+69
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+deleted
+\f
+libpplayer.rb
+file
+69
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+deleted
+\f
+libgenetics.rb
+file
+69
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+deleted
+\f
--- /dev/null
+# == Synopsis
+#
+# Library to support a Trap the Cap player that uses potentials to select the
+# best move
+#
+# == Author
+# Neil Smith
+#
+# == Change history
+# Version 1.1:: 23 April 2008
+
+require 'lib/libttc'
+require 'lib/libgenetics'
+
+
+# Play Trap the Cap by using potential fields. For each possible move,
+# calculate the field strength and pick the move with the lowest potential
+class Potential_player
+
+ attr_reader :friend_pull, :enemy_pull, :base_pull,
+ :safe_bonus, :capture_bonus
+
+ def initialize(args, verbose = false)
+ @friend_pull = args[:friend_pull] || 1
+ @enemy_pull = args[:enemy_pull] || 0.5
+ @base_pull = args[:base_pull] || 2
+ @safe_bonus = args[:safe_bonus] || 8
+ @capture_bonus = args[:capture_bonus] || 10
+
+ @verbose = verbose
+ end
+
+ # Find the best move of the possible ones
+ def best_move(game, die_result)
+ me = game.current_player
+ possible_moves = game.possible_moves(die_result, me)
+ scored_moves = possible_moves.collect do |m|
+ begin
+ game.apply_move! m
+ score = score_position(game, me)
+# game.undo_move!
+ rescue GameWonNotice
+ score = 10000
+ ensure
+ game.undo_move!
+ end
+ puts "#{m} scores #{score}" if @verbose
+ [m, score]
+ end
+ best_move = (scored_moves.max {|a, b| a[1] <=> b[1]})[0]
+ end
+
+ # Calculate the potential score of a position for a given player
+ def score_position(game, player)
+ score = 0
+ game.pieces.each_value do |piece|
+ here = piece.position
+ if piece.colour == player
+ game.pieces.each_value do |other_piece|
+ if other_piece.colour == player
+ score += game.board.distance_between[here.place][other_piece.position.place] * @friend_pull
+ else
+ score += game.board.distance_between[here.place][other_piece.position.place] * @enemy_pull
+ end
+ end
+ score += piece.contains.length * @capture_bonus
+ score += game.board.distance_between[here.place][game.board.positions[player].place] *
+ piece.contains.length * @base_pull
+ elsif here == game.board.positions[player]
+ score += @safe_bonus
+ end
+ end
+ score
+ end
+
+
+ # Convert a player to a bitstring
+ def to_bitstring
+ (@friend_pull * 4).to_i.to_bitstring(4).gray_encode +
+ (@enemy_pull * 4).to_i.to_bitstring(4).gray_encode +
+ (@base_pull * 4).to_i.to_bitstring(4).gray_encode +
+ @safe_bonus.to_bitstring(4).gray_encode +
+ @capture_bonus.to_bitstring(4).gray_encode
+ end
+
+ # Convert a player to a genome
+ def to_genome
+ Genome.new(self.to_bitstring)
+ end
+end
+
+
+class Genome
+
+ # Create a potential player from a genome
+ def to_potential_player
+ friend_pull = @genome[0, 4].gray_decode.to_decimal.to_f / 4
+ enemy_pull = @genome[4, 4].gray_decode.to_decimal.to_f / 4
+ base_pull = @genome[8, 4].gray_decode.to_decimal.to_f / 4
+ safe_bonus = @genome[12, 4].gray_decode.to_decimal
+ capture_bonus = @genome[16, 4].gray_decode.to_decimal
+ Potential_player.new({:friend_pull => friend_pull,
+ :enemy_pull => enemy_pull, :base_pull => base_pull,
+ :safe_bonus => safe_bonus, :capture_bonus => capture_bonus})
+ end
+end
--- /dev/null
+# == Synopsis
+#
+# Library to support Trap the Cap play
+#
+# == Author
+# Neil Smith
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# == Change history
+# Version 1.1:: 07 Sep 2007
+# * Changed format for showing moves via bases.
+# * Raise error when moving via base without captured pieces
+# * Raise error when moving onto a safe space with 3 or more
+# pieces already there
+# Version 1.2:: 10 Sep 2007
+# * Incorporated changes in move legality above into
+# Game#possible_moves
+# Version 1.3:: 25 Mar 2008
+# * Fixed bug to detect a winner, and also eliminate players
+# that have no uncaptured pieces.
+
+# Errors for a game
+
+# Pieces can only capture pieces that they're on.
+class InvalidCaptureError < StandardError
+end
+
+# Moves can only be [1..6] spaces
+class InvalidMoveError < StandardError
+end
+
+# Game is won when only one player has uncaptured pieces
+class GameWonNotice < StandardError
+end
+
+
+# Each possible position for a piece is an object
+# Each neighbour is another position object
+class Position
+ attr_reader :place # the name of this place
+ attr_accessor :contains # the pieces it contains
+ attr_accessor :neighbours # the positions that neighbour it
+
+ def initialize(place, safety, base)
+ @place = place
+ @safe = safety
+ @base = base
+ @neighbours = Array.new
+ end
+
+ # is this position a safety one (i.e. no captures allowed)?
+ def safe?
+ @safe
+ end
+
+ # Is this position a base?
+ def base?
+ @base
+ end
+
+ def to_s
+ @place
+ end
+
+ def to_str
+ to_s
+ end
+
+end
+
+
+# The game board
+class Board
+
+ attr_reader :positions
+ attr_reader :valid_moves
+ attr_reader :distance_between
+ attr_reader :centre
+
+
+ # A laborious procedure to create all the positions and tie them all together
+ def initialize(spokes, spoke_length, arc_length)
+ # A hash of all positions, indexed by position names
+ @positions = Hash.new
+ @centre = Position.new('ac' + spoke_length.to_s, false, false)
+ @positions['ac' + spoke_length.to_s] = centre
+ a1_corner = nil
+ end_of_previous_arc = nil
+
+ # Do each arc-spoke-base set
+ (?a...(?a + spokes)).each do |arc_code|
+ arc = arc_code.chr
+ base = Position.new(arc, false, true)
+ this_arc = Array.new
+
+ # build the arc
+ (1..arc_length).each do |arc_position|
+ position_name = arc + arc_position.to_s
+ arc_place = Position.new(position_name, arc_position == 4, false)
+ arc_place.neighbours = []
+ @positions[position_name] = arc_place
+ this_arc << arc_place
+ a1_corner = a1_corner || arc_place
+ end
+ (0...arc_length).each do |arc_position|
+ if arc_position > 0
+ this_arc[arc_position].neighbours << this_arc[arc_position - 1]
+ end
+ if arc_position < (arc_length - 1)
+ this_arc[arc_position].neighbours << this_arc[arc_position + 1]
+ end
+ end
+
+ # build the spoke
+ this_spoke = Array.new
+ (1..(spoke_length - 1)).each do |spoke_position|
+ position_name = arc + "c" + spoke_position.to_s
+ spoke_place = Position.new(position_name, spoke_position == 3, false)
+ spoke_place.neighbours = []
+ @positions[position_name] = spoke_place
+ this_spoke << spoke_place
+ end
+ (0...(spoke_length - 1)).each do |spoke_position|
+ if spoke_position > 0
+ this_spoke[spoke_position].neighbours << this_spoke[spoke_position - 1]
+ end
+ if spoke_position < spoke_length - 2
+ this_spoke[spoke_position].neighbours << this_spoke[spoke_position + 1]
+ end
+ end
+
+ # tie the spoke and arc together,
+ this_arc[0].neighbours << this_spoke[0]
+ this_spoke[0].neighbours << this_arc[0]
+
+ # tie the spoke to the centre, and
+ this_spoke[-1].neighbours << @centre
+ @centre.neighbours << this_spoke[-1]
+
+ # tie the base to the arc
+ base = Position.new(arc, false, true)
+ @positions[arc] = base
+ base.neighbours << this_arc[0]
+ this_arc[0].neighbours << base
+
+ # record the ends of the arc for tying to adjacent arcs
+ if end_of_previous_arc
+ end_of_previous_arc.neighbours << this_arc[0]
+ this_arc[0].neighbours << end_of_previous_arc
+ end
+ end_of_previous_arc = this_arc[-1]
+
+ end # arc
+
+ # tie both ends of the rim together
+ a1_corner.neighbours << end_of_previous_arc
+ end_of_previous_arc.neighbours << a1_corner
+
+ cache_valid_moves
+
+ end # def
+
+ def to_s
+ layout
+ end
+
+ def to_str
+ to_s
+ end
+
+
+ # For each position, show its name and what it touches
+ def layout
+ out_string = ""
+ @positions.keys.sort.each do |position|
+ out_string << sprintf("%s touches ", @positions[position])
+ @positions[position].neighbours.each do |neighbour|
+ out_string << sprintf("%s, ", neighbour)
+ end
+ out_string << sprintf("\n")
+ end
+ out_string
+ end
+
+
+ # Precompute the valid moves for this board, and the distances between each
+ # pair of positions
+ def cache_valid_moves
+ # A hash of arrays. The has key is the name of a positions. The array
+ # element [i] stores the positions that are i spaces from here
+ @valid_moves = Hash.new
+ # A hash of hashes. Given two names, return the shortest distance between
+ # the two locations
+ @distance_between = Hash.new
+ @positions.each do |place, position|
+ @valid_moves[place] = Array.new
+ @distance_between[place] = Hash.new
+ @valid_moves[place][0] = [@positions[place]]
+ @distance_between[place][place] = 0
+ # Find the shortest routes by Dijkstra's algorithm
+ agenda = [position]
+ closed_list = [position]
+ i = 1
+ while not agenda.empty?
+ @valid_moves[place][i] = []
+ new_agenda = []
+ agenda.each do |pos|
+ valid_extensions = pos.neighbours.reject {|new_position| closed_list.include?(new_position) }
+ @valid_moves[place][i] += valid_extensions
+ valid_extensions.each {|ext| @distance_between[place][ext.place] ||= i }
+ closed_list += valid_extensions
+ new_agenda += valid_extensions
+ end
+ agenda = new_agenda
+ i += 1
+ end
+ end
+ end
+
+end
+
+
+# Each piece on the board is an object
+class Piece
+ attr_reader :colour
+ attr_accessor :position, :contains, :captured
+
+ def initialize(number, position, colour)
+ @number = number
+ @position = position
+ @colour = colour
+ @captured = false
+ @contains = []
+ end
+
+ def name
+ @colour + @number.to_s
+ end
+
+ def to_s
+ self.name
+ end
+
+ def to_str
+ to_s
+ end
+
+ def move_to(new_position)
+ @position = new_position
+ @contains.each {|c| c.move_to(new_position)}
+ end
+
+ # Caputre another piece
+ def capture(other_piece)
+ if @position = other_piece.position
+ @contains << other_piece
+ @contains += other_piece.contains
+ other_piece.contains = []
+ other_piece.captured = true
+ else
+ raise(InvalidCaptureError,
+ "Piece #{self.name} cannot capture #{other_piece.name}: different locations")
+ end
+ end
+
+end
+
+
+# A move in a game
+class Move
+ attr_reader :piece, :destination
+
+ def initialize(piece, destination, via_base = false)
+ @piece = piece
+ @destination = destination
+ @via_base = via_base
+ end
+
+ def via_base?
+ @via_base
+ end
+
+ # Write a move to a string
+ # Note the inverse, String#to_move, is defined below
+ def to_s
+ if @via_base
+ if @destination.base?
+ @piece.to_s + " " + @destination.to_s
+ else
+ @piece.to_s + " " + piece.colour + " " + @destination.to_s
+ end
+ else
+ @piece.to_s + " " + @destination.to_s
+ end
+ end
+
+ def to_str
+ to_s
+ end
+
+end
+
+
+
+# A class to record each of the states previously found in a game.
+# Note that this is a deep copy of the pieces and what they've captured, so
+# you'll need to convert back
+class GameState
+ attr_accessor :move, :player, :pieces_after_move
+
+ def initialize(move, player, pieces)
+ @move = move
+ @player = player
+ @pieces_after_move = Hash.new
+ pieces.each {|k, p| @pieces_after_move[k] = p.dup}
+ @pieces_after_move.each_value {|p| p.contains = []}
+ # and now to make the captured pieces point to the copies
+ pieces.each do |k, p|
+ p.contains.each do |captured_piece|
+ @pieces_after_move[k].capture(@pieces_after_move[captured_piece.name])
+ end
+ end
+ end
+
+ def ==(other)
+ @move.to_s == other.move.to_s and
+ @player == other.player and
+ @piece_after_move == other.pieces_after_move
+ end
+
+end
+
+
+# A game of Trap the Cap. It keeps a history of all previous states.
+class Game
+
+ attr_reader :history
+ attr_reader :current_player, :players
+ attr_reader :board
+ attr_reader :pieces
+
+ # Create a new game
+ def initialize(players = 6, spokes = 6, spoke_length = 6, arc_length = 6,
+ pieces_each = 6)
+ @board = Board.new(spokes, spoke_length, arc_length)
+ @history = []
+ @pieces = Hash.new
+ @players = case
+ when players == 2 ; ['a', 'd']
+ when players == 3 ; ['a', 'c', 'e']
+ when players == 4 ; ['a', 'b', 'd', 'e']
+ when players == 5 ; ['a', 'b', 'c', 'd', 'e']
+ when players == 6 ; ['a', 'b', 'c', 'd', 'e', 'f']
+ end
+ @current_player = 'a'
+ @players.each do |player|
+ players_base = @board.positions[player]
+ (1..pieces_each).each do |count|
+ piece = Piece.new(count, players_base, player)
+ @pieces[player + count.to_s] = piece
+ end
+ end
+ end
+
+
+ # Apply a single move to a game.
+ def apply_move!(move, player = @current_player)
+ # Check the move is a valid one
+ raise(InvalidMoveError, "Piece #{move.piece} does not exist") unless @pieces.has_key?(move.piece.name)
+ raise(InvalidMoveError, "Player #{player} moving piece #{move.piece}") unless move.piece.colour == player
+ raise(InvalidMoveError, "Attempting to move captured piece #{move.piece}") if move.piece.captured
+ raise(InvalidMoveError, "Attempting to move #{move.piece} onto or via base without captured pieces") if move.via_base? and move.piece.contains.empty?
+ if move.destination.safe?
+ if (@pieces.find_all {|k, p| p.position == move.destination}).length >= 3
+ raise(InvalidMoveError, "Attempting to move #{move.piece} onto safe position #{move.destination} when there are already three or more pieces there")
+ end
+ end
+ if move.via_base?
+ moved_distance = board.distance_between[move.piece.position.place][player] +
+ board.distance_between[player][move.destination.place]
+ else
+ moved_distance = board.distance_between[move.piece.position.place][move.destination.place]
+ end
+ raise(InvalidMoveError, "Attempting to move piece #{move.piece} #{moved_distance} places (from #{move.piece.position} to #{move.destination})") if moved_distance < 1 or moved_distance > 6
+
+ # Apply this move
+ move.piece.move_to(move.destination)
+
+ # Capture anything already there (unless it's a safe place or a base,
+ # or our own colour, or already captured)
+ unless move.destination.safe? or move.destination.base?
+ @pieces.each do |name, target_piece|
+ if target_piece.position == move.destination and
+ target_piece != move.piece and
+ not move.piece.contains.member?(target_piece) and
+ target_piece.colour != player and
+ not target_piece.captured
+ move.piece.capture(target_piece)
+ end
+ end
+ end
+
+ # If the move was via our base, drop all captured pieces
+ if move.via_base?
+ capturers_base = board.positions[move.piece.colour]
+ move.piece.contains.each do |captured_piece|
+ captured_piece.move_to capturers_base
+ captured_piece.captured = false if captured_piece.colour == move.piece.colour
+ end
+ move.piece.contains = []
+ end
+
+ # Record the new stae
+ this_game_state = GameState.new(move, player, @pieces)
+ @history << this_game_state
+
+ # Retain only players that have uncaptured pieces.
+ # If there's only one player with uncaptured pieces, declare a win.
+ potential_players = []
+ @players.each do |p|
+ if (@pieces.values.select {|piece| piece.colour == p}).any? {|piece| not piece.captured}
+ potential_players << p
+ end
+ # potential_players << p if (@pieces.values.select {|p| p.colour == @current_player}).any? {|p| not p.captured}
+ end
+ if potential_players.length <= 1
+ raise(GameWonNotice, "Game won by #{potential_players[0]}")
+ end
+ @players = potential_players.sort
+ end
+
+ # Undo a move
+ def undo_move!
+ if @history.length > 1
+ # general case
+ state_to_restore = @history[-2]
+ @current_player = @history[-1].player
+ @pieces.each do |name, piece|
+ copy_piece = state_to_restore.pieces_after_move[name]
+ piece.position = copy_piece.position
+ piece.captured = copy_piece.captured
+ piece.contains = []
+ copy_piece.contains.each do |p|
+# piece.capture(@pieces[p.name])
+ piece.contains << @pieces[p.name]
+ end
+ end
+ @history.pop
+ elsif @history.length == 1
+ # reset to start
+ @current_player = 'a'
+ @pieces.each do |name, piece|
+ piece.position = @board.positions[piece.colour]
+ piece.captured = false
+ piece.contains = []
+ end
+ @history.pop
+ end
+ end
+
+ # Apply a list of moves in order
+ def apply_moves!(moves)
+ moves.each do |move|
+ if move.via_base?
+ moved_distance = board.distance_between[move.piece.position.place][@current_player] +
+ board.distance_between[@current_player][move.destination.place]
+ else
+ moved_distance = board.distance_between[move.piece.position.place][move.destination.place]
+ end
+ self.apply_move!(move, @current_player)
+ next_player! unless moved_distance == 6
+ end
+ end
+
+
+ # Set the current player to be the next player
+ def next_player!
+ original_player = @current_player
+ begin
+ if @current_player == @players[-1]
+ @current_player = @players[0]
+ else
+ @current_player = @players[@players.index(@current_player) + 1]
+ end
+ end while (@pieces.values.select {|p| p.colour == @current_player}).all? {|p| p.captured} and @current_player != original_player
+ @current_player
+ end
+
+
+ # Return an array of all possible moves from this state, given the die roll
+ # and the active player
+ def possible_moves(die_result, player = @current_player)
+ moves = []
+ @pieces.each do |key, piece|
+ # only move current player's pieces, and only if they're not captured
+ if piece.colour == player and (not piece.captured)
+ (@board.valid_moves[piece.position.place][die_result]).each do |destination|
+ if destination.safe?
+ if (@pieces.find_all {|k, p| p.position == destination}).length < 3
+ moves << Move.new(piece, destination, false)
+ end
+ else
+ moves << Move.new(piece, destination, false) unless destination.base?
+ end
+ end
+ # if we can move to our base (but not already on it), add moves via that...
+ if @board.distance_between[piece.position.place][player] <= die_result and
+ not piece.position.place == player and
+ not piece.contains.empty?
+ distance_after_base = die_result - @board.distance_between[piece.position.place][player]
+ (@board.valid_moves[player][distance_after_base]).each do |destination|
+ if destination.safe?
+ if (@pieces.find_all {|k, p| p.position == destination}).length < 3
+ moves << Move.new(piece, destination, true)
+ end
+ else
+ moves << Move.new(piece, destination, true)
+ end
+ end
+ end
+ end
+ end
+ moves
+ end
+
+
+ def build_state_string
+ outstr = "Current player = #{@current_player}\n"
+ @pieces.keys.sort.each do |piece_name|
+ if @pieces[piece_name].captured
+ outstr << "Piece #{piece_name} captured, at #{@pieces[piece_name].position}\n"
+ else
+ outstr << "Piece #{piece_name} is at #{@pieces[piece_name].position}, holds #{(@pieces[piece_name].contains.collect{|c| c.name}).join(' ')}\n"
+ end
+ end
+ outstr
+ end
+
+ # Show the state of the board
+ def show_state
+ puts build_state_string
+# @pieces.keys.sort.each do |piece_name|
+# if @pieces[piece_name].captured
+# puts "Piece #{piece_name} captured, at #{@pieces[piece_name].position}"
+# else
+# puts "Piece #{piece_name} is at #{@pieces[piece_name].position}, holds #{(@pieces[piece_name].contains.collect{|c| c.name}).join(' ')}"
+# end
+# end
+ end
+
+ def to_s
+ show_state
+ end
+
+ def to_str
+ to_s
+ end
+
+
+ # Given a set of lines from an input file, turn them into a Game object and
+ # a set of Move objects.
+ # Note the multiple return values.
+ # Class method
+ def Game.read_game(gamelines)
+ gamelines.each {|l| l.chomp!}
+ game = Game.new(gamelines[0].to_i, 6, 6, 6, 6)
+ moves = []
+ gamelines[1..-2].each {|m| moves << m.to_move(game)}
+ return game, moves, gamelines[-1].to_i
+ end
+
+
+end
+
+
+# Extension to String class to convert a move-description string into a Move object.
+# This is the inverse of the Move#to_s method
+class String
+ def to_move(game)
+ move_elements = self.downcase.split
+ piece_name = move_elements[0]
+ destination_name = move_elements[-1]
+ if destination_name.length > 2 and
+ destination_name[-2,2] == game.board.centre.place[-2,2]
+ destination_name = game.board.centre.place
+ end
+ raise(InvalidMoveError, "Invalid piece in move read") unless game.pieces.has_key?(piece_name)
+ raise(InvalidMoveError, "Invalid destination in move read") unless game.board.positions.has_key?(destination_name)
+ # Deal with the synonyms for the centre position
+ via_base = (destination_name.length == 1 or move_elements.length > 2)
+ Move.new(game.pieces[piece_name], game.board.positions[destination_name], via_base)
+ end
+end
+
+
+# Read a game description file and convert it into a Game object and set of Move objects.
+# Note that Game.read_game method returns multiple values, so this one does too.
+class IO
+ def IO.read_game(filename)
+ gamelines = IO.readlines(filename)
+ return Game.read_game(gamelines)
+ end
+end
--- /dev/null
+# == Synopsis
+#
+# Library to support a Trap the Cap player that uses potentials to select the
+# best move
+#
+# == Author
+# Neil Smith
+#
+# == Change history
+# Version 1.1:: 23 April 2008
+
+require 'libttc'
+require 'libgenetics'
+
+
+# Play Trap the Cap by using potential fields. For each possible move,
+# calculate the field strength and pick the move with the lowest potential
+class Potential_player
+
+ attr_reader :friend_pull, :enemy_pull, :base_pull,
+ :safe_bonus, :capture_bonus
+
+ def initialize(args, verbose = false)
+ @friend_pull = args[:friend_pull] || 1
+ @enemy_pull = args[:enemy_pull] || 0.5
+ @base_pull = args[:base_pull] || 2
+ @safe_bonus = args[:safe_bonus] || 8
+ @capture_bonus = args[:capture_bonus] || 10
+
+ @verbose = verbose
+ end
+
+ # Find the best move of the possible ones
+ def best_move(game, die_result)
+ me = game.current_player
+ possible_moves = game.possible_moves(die_result, me)
+ scored_moves = possible_moves.collect do |m|
+ begin
+ game.apply_move! m
+ score = score_position(game, me)
+# game.undo_move!
+ rescue GameWonNotice
+ score = 10000
+ ensure
+ game.undo_move!
+ end
+ puts "#{m} scores #{score}" if @verbose
+ [m, score]
+ end
+ best_move = (scored_moves.max {|a, b| a[1] <=> b[1]})[0]
+ end
+
+ # Calculate the potential score of a position for a given player
+ def score_position(game, player)
+ score = 0
+ game.pieces.each_value do |piece|
+ here = piece.position
+ if piece.colour == player
+ game.pieces.each_value do |other_piece|
+ if other_piece.colour == player
+ score += game.board.distance_between[here.place][other_piece.position.place] * @friend_pull
+ else
+ score += game.board.distance_between[here.place][other_piece.position.place] * @enemy_pull
+ end
+ end
+ score += piece.contains.length * @capture_bonus
+ score += game.board.distance_between[here.place][game.board.positions[player].place] *
+ piece.contains.length * @base_pull
+ elsif here == game.board.positions[player]
+ score += @safe_bonus
+ end
+ end
+ score
+ end
+
+
+ # Convert a player to a bitstring
+ def to_bitstring
+ (@friend_pull * 4).to_i.to_bitstring(4).gray_encode +
+ (@enemy_pull * 4).to_i.to_bitstring(4).gray_encode +
+ (@base_pull * 4).to_i.to_bitstring(4).gray_encode +
+ @safe_bonus.to_bitstring(4).gray_encode +
+ @capture_bonus.to_bitstring(4).gray_encode
+ end
+
+ # Convert a player to a genome
+ def to_genome
+ Genome.new(self.to_bitstring)
+ end
+end
+
+
+class Genome
+
+ # Create a potential player from a genome
+ def to_potential_player
+ friend_pull = @genome[0, 4].gray_decode.to_decimal.to_f / 4
+ enemy_pull = @genome[4, 4].gray_decode.to_decimal.to_f / 4
+ base_pull = @genome[8, 4].gray_decode.to_decimal.to_f / 4
+ safe_bonus = @genome[12, 4].gray_decode.to_decimal
+ capture_bonus = @genome[16, 4].gray_decode.to_decimal
+ Potential_player.new({:friend_pull => friend_pull,
+ :enemy_pull => enemy_pull, :base_pull => base_pull,
+ :safe_bonus => safe_bonus, :capture_bonus => capture_bonus})
+ end
+end
--- /dev/null
+#!/usr/bin/ruby -w
+
+require 'src/play'
+require 'src/selection'
+
+pop1 = Population.new(100, 20)
+
+start = Time.now
+puts "Started at #{start}"
+pop1.tournament_select_population(0.8, 1000, true)
+finish = Time.now
+puts "Took #{finish - start}"
+
--- /dev/null
+K 25
+svn:wc:ra_dav:version-url
+V 48
+/svn/njae/!svn/ver/24/TrapTheCap/trunk/nbproject
+END
+project.properties
+K 25
+svn:wc:ra_dav:version-url
+V 67
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/nbproject/project.properties
+END
+project.xml
+K 25
+svn:wc:ra_dav:version-url
+V 60
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/nbproject/project.xml
+END
--- /dev/null
+K 10
+svn:ignore
+V 8
+private
+
+END
--- /dev/null
+8
+
+dir
+68
+http://scripts.njae.me.uk/svn/njae/TrapTheCap/trunk/nbproject
+http://scripts.njae.me.uk/svn/njae
+
+
+
+2008-03-28T15:47:09.723420Z
+24
+neil
+has-props
+
+svn:special svn:externals svn:needs-lock
+
+
+
+
+
+
+
+
+
+
+
+0ada9808-85ab-4924-adda-5bf89eae3818
+\f
+project.properties
+file
+
+
+
+
+2008-03-25T11:44:50.000000Z
+4903a98656892131addae4aea0a77d22
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+project.xml
+file
+
+
+
+
+2008-03-25T11:44:50.000000Z
+9ff3dc942c9d9890138a20443f2eda06
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
--- /dev/null
+javac.classpath=
+main.file=ttc.rb
+ruby.includejava=false
+source.encoding=UTF-8
+src.dir=lib
+src.src.dir=src
+test.src.dir=test
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+ <type>org.netbeans.modules.ruby.rubyproject</type>
+ <configuration>
+ <data xmlns="http://www.netbeans.org/ns/ruby-project/1">
+ <name>TrapTheCap</name>
+ <source-roots>
+ <root id="src.src.dir" name="Source Files"/>
+ <root id="src.dir" name="Libraries"/>
+ </source-roots>
+ <test-roots>
+ <root id="test.src.dir"/>
+ </test-roots>
+ </data>
+ </configuration>
+</project>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
+ <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
+ <open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/1">
+ <file>file:/home/neil/programming/ruby/TrapTheCap/src/clockwise-cloud.rb</file>
+ <file>file:/home/neil/programming/ruby/TrapTheCap/src/gen1006.rb</file>
+ <file>file:/home/neil/programming/ruby/TrapTheCap/src/html-files/interface.html</file>
+ <file>file:/home/neil/programming/ruby/TrapTheCap/src/html-files/simple.html</file>
+ <file>file:/home/neil/programming/ruby/TrapTheCap/src/libttc-pplayer.rb</file>
+ <file>file:/home/neil/programming/ruby/TrapTheCap/src/libttc.rb</file>
+ <file>file:/home/neil/programming/ruby/TrapTheCap/src/sample-game.txt</file>
+ <file>file:/home/neil/programming/ruby/TrapTheCap/src/selection.rb</file>
+ <file>file:/home/neil/programming/ruby/TrapTheCap/src/ttc-ga-clustering.rb</file>
+ </open-files>
+</project-private>
--- /dev/null
+(in /home/neil/programming/ruby/TrapTheCap)
--- /dev/null
+javac.classpath=
+main.file=ttc.rb
+ruby.includejava=false
+source.encoding=UTF-8
+src.dir=lib
+src.src.dir=src
+test.src.dir=test
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://www.netbeans.org/ns/project/1">
+ <type>org.netbeans.modules.ruby.rubyproject</type>
+ <configuration>
+ <data xmlns="http://www.netbeans.org/ns/ruby-project/1">
+ <name>TrapTheCap</name>
+ <source-roots>
+ <root id="src.src.dir" name="Source Files"/>
+ <root id="src.dir" name="Libraries"/>
+ </source-roots>
+ <test-roots>
+ <root id="test.src.dir"/>
+ </test-roots>
+ </data>
+ </configuration>
+</project>
--- /dev/null
+#!/usr/bin/ruby -w
+
+require 'src/play'
+require 'src/selection'
+
+winner_success_chance = 0.8
+
+player_bitstrings = readlines.collect {|l| l.chomp.split(//).collect {|x| x.to_i}}
+
+# File.open('player.log', 'a') do |f|
+# player_bitstrings.each {|b| f.puts "Process #{Process.pid}: Received #{b}"}
+# end
+
+players = player_bitstrings.collect {|b| Genome.new(b).to_potential_player}
+
+handler = GameHandler.new(players, 1000)
+winner, moves = handler.play
+
+if winner == :draw or rand > winner_success_chance
+ successful_player = players[rand(players.length)]
+else
+ successful_player = winner
+end
+
+# File.open('player.log', 'a') do |f|
+# f.puts "Process #{Process.pid}: winner is #{successful_player.to_bitstring}"
+# end
+
+puts "#{successful_player.to_bitstring}"
\ No newline at end of file
--- /dev/null
+#!/usr/bin/ruby -w
+
+require 'src/play'
+require 'src/selection'
+# require 'systemu'
+
+pop = Population.new(5, 20)
+generation_count = 1
+max_generations = 3
+
+if File.file? 'player.log'
+ File.delete 'player.log'
+end
+
+puts "Generation number #{generation_count}"
+pop.individuals.sort {|x, y| x.genome <=> y.genome}.each {|i| puts "#{i.genome}"}
+
+while generation_count <= max_generations
+ start = Time.now
+ puts "Started at #{start}"
+
+ new_population = []
+ threads = []
+ 1.upto(pop.individuals.length) do |i|
+ threads << Thread.new do
+ puts "Starting thread #{i}"
+ sleep 2
+ player_count = rand(5) + 2
+ pool_size = pop.individuals.length
+ players = []
+ 1.upto(player_count) { players << pop.individuals[rand(pool_size)] }
+ IO.popen('ruby play-one-game.rb', 'r+') do |pipe|
+ players.each {|p| pipe << "#{p.genome}\n" ; puts "Game #{i}: putting player #{p.genome}"}
+# players.each {|p| pipe << "#{p.genome}\n"}
+ pipe.close_write
+ new_population << Genome.new(pipe.readline.chomp.split(//).collect {|x| x.to_i})
+ puts "Got result #{new_population[-1].genome}"
+ end
+# game_input = (players.collect {|p| p.genome.to_s}).join("\n")
+# game_result = ''
+# puts "Calling game #{i} with input #{game_input}"
+# status, game_result, stderr = systemu 'ruby play-one-game.rb', 'stdin' => game_input
+# puts "Game #{i} returned #{game_result}"
+# new_population << Genome.new(game_result.chomp.split(//).collect {|x| x.to_i})
+ end
+ threads.each {|t| t.join}
+ end
+
+ pop.individuals = new_population
+
+ finish = Time.now
+ puts "Took #{finish - start} seconds"
+ pop1 = pop.crossover(0.7)
+ pop = pop1.mutation(0.05)
+ generation_count += 1
+ puts "Generation number #{generation_count}"
+ pop.individuals.sort {|x, y| x.genome <=> y.genome}.each {|i| puts "#{i.genome}"}
+ $stdout.flush
+end
\ No newline at end of file
--- /dev/null
+K 25
+svn:wc:ra_dav:version-url
+V 42
+/svn/njae/!svn/ver/68/TrapTheCap/trunk/src
+END
+gen1006-clusters.txt
+K 25
+svn:wc:ra_dav:version-url
+V 63
+/svn/njae/!svn/ver/69/TrapTheCap/trunk/src/gen1006-clusters.txt
+END
+gen1006.rb
+K 25
+svn:wc:ra_dav:version-url
+V 53
+/svn/njae/!svn/ver/69/TrapTheCap/trunk/src/gen1006.rb
+END
+clockwise-p1.rb
+K 25
+svn:wc:ra_dav:version-url
+V 58
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/src/clockwise-p1.rb
+END
+libttc.rb
+K 25
+svn:wc:ra_dav:version-url
+V 52
+/svn/njae/!svn/ver/69/TrapTheCap/trunk/src/libttc.rb
+END
+sample-game.txt
+K 25
+svn:wc:ra_dav:version-url
+V 58
+/svn/njae/!svn/ver/69/TrapTheCap/trunk/src/sample-game.txt
+END
+play.rb
+K 25
+svn:wc:ra_dav:version-url
+V 50
+/svn/njae/!svn/ver/27/TrapTheCap/trunk/src/play.rb
+END
+selection.rb
+K 25
+svn:wc:ra_dav:version-url
+V 55
+/svn/njae/!svn/ver/69/TrapTheCap/trunk/src/selection.rb
+END
+clockwise-cloud.rb
+K 25
+svn:wc:ra_dav:version-url
+V 61
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/src/clockwise-cloud.rb
+END
+libgenetics.rb
+K 25
+svn:wc:ra_dav:version-url
+V 57
+/svn/njae/!svn/ver/69/TrapTheCap/trunk/src/libgenetics.rb
+END
+ttc.rb
+K 25
+svn:wc:ra_dav:version-url
+V 49
+/svn/njae/!svn/ver/23/TrapTheCap/trunk/src/ttc.rb
+END
+gen1006-clusters-old.txt
+K 25
+svn:wc:ra_dav:version-url
+V 67
+/svn/njae/!svn/ver/69/TrapTheCap/trunk/src/gen1006-clusters-old.txt
+END
+libttc-pplayer.rb
+K 25
+svn:wc:ra_dav:version-url
+V 60
+/svn/njae/!svn/ver/69/TrapTheCap/trunk/src/libttc-pplayer.rb
+END
+ttc-ga-clustering.rb
+K 25
+svn:wc:ra_dav:version-url
+V 63
+/svn/njae/!svn/ver/69/TrapTheCap/trunk/src/ttc-ga-clustering.rb
+END
--- /dev/null
+8
+
+dir
+68
+http://scripts.njae.me.uk/svn/njae/TrapTheCap/trunk/src
+http://scripts.njae.me.uk/svn/njae
+
+
+
+2009-02-19T08:59:38.293071Z
+68
+neil
+
+
+svn:special svn:externals svn:needs-lock
+
+
+
+
+
+
+
+
+
+
+
+0ada9808-85ab-4924-adda-5bf89eae3818
+\f
+gen1006.rb
+file
+69
+
+
+
+2009-02-23T13:32:58.000000Z
+597c993fb86e5502356a806a91127c5e
+2009-02-23T14:02:44.812274Z
+69
+
+has-props
+\f
+libttc.rb
+file
+69
+
+
+
+2009-02-23T13:25:21.000000Z
+7a2bf3e4c83b3d2b06850a96bca4c4bc
+2009-02-23T14:02:44.812274Z
+69
+\f
+selection.rb
+file
+69
+
+
+
+2009-02-23T13:26:05.000000Z
+a2a08d4d875fb316d0bd647564006a25
+2009-02-23T14:02:44.812274Z
+69
+neil
+\f
+clockwise-cloud.rb
+file
+
+
+
+
+2007-08-31T19:04:34.000000Z
+b53aaefb7e9da9aaf2ac304930c98504
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+libgenetics.rb
+file
+69
+
+
+
+2009-02-23T13:25:19.000000Z
+9eeccabbfc44763ad8898e77c2b65358
+2009-02-23T14:02:44.812274Z
+69
+\f
+ttc.rb
+file
+
+
+
+
+2008-03-25T11:46:58.000000Z
+5609521da79d911a6144fded55f32d3f
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+libttc-pplayer.rb
+file
+69
+
+
+
+2009-02-23T13:25:20.000000Z
+8c24369e159246ae762ba26115879019
+2009-02-23T14:02:44.812274Z
+69
+\f
+ttc-ga-clustering.rb
+file
+69
+
+
+
+2009-02-23T13:24:21.000000Z
+26b1e7b75853a57bf4af2854c3920b55
+2009-02-23T14:02:44.812274Z
+69
+\f
+gen1006-clusters.txt
+file
+69
+
+
+
+2009-02-20T16:29:20.000000Z
+8b954bea91eb9fb38495c3989a835a3e
+2009-02-23T14:02:44.812274Z
+69
+\f
+cgi-files
+dir
+\f
+clockwise-p1.rb
+file
+
+
+
+
+2007-08-31T11:19:53.000000Z
+7af8c3a0bb94e558fedf57c8b2cb035d
+2008-03-25T12:46:59.166018Z
+23
+neil
+\f
+html-files
+dir
+\f
+sample-game.txt
+file
+69
+
+
+
+2009-02-23T13:53:03.000000Z
+4a8276396b008060afd58562390d28d9
+2009-02-23T14:02:44.812274Z
+69
+\f
+play.rb
+file
+
+
+
+
+2008-04-23T19:32:54.000000Z
+8f509d131f0ad009f369c4cd7a46fbcc
+2008-04-23T19:36:22.892674Z
+27
+neil
+\f
+gen1006-clusters-old.txt
+file
+69
+
+
+
+2009-02-20T16:26:52.000000Z
+e06ee3749f74806beeb62c62b0a2557f
+2009-02-23T14:02:44.812274Z
+69
+\f
--- /dev/null
+K 14
+svn:executable
+V 1
+*
+END
--- /dev/null
+#!/usr/bin/ruby
+#
+# == Synopsis
+#
+# Play one move of a Trap the Cap game
+#
+# == Usage
+# clockwise-p1
+# Game state file read on STDIN
+# Move produced on STDOUT
+#
+# == Author
+# Neil Smith
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+require 'libttc'
+
+def more_clockwise(this, other)
+ here = this.place
+ there = other.place
+
+ # if both are on a spoke, choose the one with the lowest number (nearer the rim)
+ if here =~ /.c./ and there =~ /.c./
+ # break ties by preferring the most clockwise arc
+ if here[-1] == there[-1]
+ return here[0] <=> there[0]
+ else
+ return -1 * (here[-1] <=> there[-1])
+ end
+ # If one is one a spoke and the other is on the rim, choose the one on the rim
+ elsif here =~ /.c./ or there =~ /.c./
+ return -1 * (here.length <=> there.length)
+ # If one is in the 'f' rim section and the other in the 'a' rim section, choose the 'a'
+ elsif here[0,1] == 'a' and there[0,1] == 'f'
+ return +1
+ elsif here[0,1] == 'f' and there[0,1] == 'a'
+ return -1
+ # Otherwise, choose the one with highest arc code
+ else
+ return here <=> there
+ end
+
+end
+
+# Get the current game state
+game_lines = readlines
+game, moves, next_roll = Game.read_game(game_lines)
+game.apply_moves moves
+
+
+# The piece to move is the least clockwise of my uncaptured pieces
+# Always move pieces on the base first
+my_pieces = game.pieces.values.select {|p| p.colour == game.current_player and not p.captured}
+piece_to_move = (my_pieces.sort {|x, y| more_clockwise x.position, y.position})[0]
+
+# Find the most clockwise move for this piece
+potential_moves = game.possible_moves(next_roll).select {|m| m.piece == piece_to_move}
+sorted_moves = potential_moves.sort {|x, y| more_clockwise x.destination, y.destination}
+best_move = sorted_moves[-1]
+
+# return that move
+puts best_move
+
+
--- /dev/null
+#!/usr/bin/ruby
+#
+# == Synopsis
+#
+# Play one move of a Trap the Cap game
+#
+# == Usage
+# clockwise-p1
+# Game state file read on STDIN
+# Move produced on STDOUT
+#
+# == Author
+# Neil Smith
+
+
+require 'libttc'
+require 'rdoc/usage'
+
+def more_clockwise(this, other)
+ here = this.destination.place
+ there = other.destination.place
+
+ # if both are on a spoke, choose the one with the lowest number (nearer the rim)
+ if here =~ /.c./ and there =~ /.c./
+ # break ties by preferring the most clockwise arc
+ if here[-1] == there[-1]
+ return here[0] <=> there[0]
+ else
+ return -1 * (here[-1] <=> there[-1])
+ end
+ # If one is one a spoke and the other is on the rim, choose the one on the rim
+ elsif here =~ /.c./ or there =~ /.c./
+ return -1 * (here.length <=> there.length)
+ # If one is in the 'f' rim section and the other in the 'a' rim section, choose the 'a'
+ elsif here[0,1] == 'a' and there[0,1] == 'f'
+ return +1
+ elsif here[0,1] == 'f' and there[0,1] == 'a'
+ return -1
+ # Otherwise, choose the one with highest arc code
+ else
+ return here <=> there
+ end
+
+end
+
+# Get the current game state
+game_lines = readlines
+game, moves, next_roll = Game.read_game(game_lines)
+game.apply_moves moves
+
+# The piece to move is the uncaptured one of mine with the lowest number
+my_pieces = game.pieces.values.select {|p| p.colour == game.current_player and not p.captured}
+piece_to_move = (my_pieces.sort_by {|p| p.name})[0]
+
+# find the most clockwise move
+potential_moves = game.possible_moves(next_roll).select {|m| m.piece == piece_to_move}
+sorted_moves = potential_moves.sort {|x, y| more_clockwise x, y}
+best_move = sorted_moves[-1]
+
+# return that move
+puts best_move
+
+
--- /dev/null
+#!/usr/bin/ruby
+#
+# == Synopsis
+#
+# Play one move of a Trap the Cap game
+#
+# == Usage
+# clockwise-p1
+# Game state file read on STDIN
+# Move produced on STDOUT
+#
+# == Author
+# Neil Smith
+
+
+require 'libttc'
+require 'rdoc/usage'
+
+def more_clockwise(this, other)
+ here = this.destination.place
+ there = other.destination.place
+
+ # if both are on a spoke, choose the one with the lowest number (nearer the rim)
+ if here =~ /.c./ and there =~ /.c./
+ # break ties by preferring the most clockwise arc
+ if here[-1] == there[-1]
+ return here[0] <=> there[0]
+ else
+ return -1 * (here[-1] <=> there[-1])
+ end
+ # If one is one a spoke and the other is on the rim, choose the one on the rim
+ elsif here =~ /.c./ or there =~ /.c./
+ return -1 * (here.length <=> there.length)
+ # If one is in the 'f' rim section and the other in the 'a' rim section, choose the 'a'
+ elsif here[0,1] == 'a' and there[0,1] == 'f'
+ return +1
+ elsif here[0,1] == 'f' and there[0,1] == 'a'
+ return -1
+ # Otherwise, choose the one with highest arc code
+ else
+ return here <=> there
+ end
+
+end
+
+# Get the current game state
+game_lines = readlines
+game, moves, next_roll = Game.read_game(game_lines)
+game.apply_moves moves
+
+# The piece to move is the uncaptured one of mine with the lowest number
+my_pieces = game.pieces.values.select {|p| p.colour == game.current_player and not p.captured}
+piece_to_move = (my_pieces.sort_by {|p| p.name})[0]
+
+# find the most clockwise move
+potential_moves = game.possible_moves(next_roll).select {|m| m.piece == piece_to_move}
+sorted_moves = potential_moves.sort {|x, y| more_clockwise x, y}
+best_move = sorted_moves[-1]
+
+# return that move
+puts best_move
+
+
--- /dev/null
+[[0,0,0,0,0,1,0,0,1,1,1,0,1,1,1,1,0,0,1,1], 16]
+[[0,0,1,0,0,0,0,0,0,1,0,1,1,1,0,1,0,0,1,1], 17]
+[[0,0,0,0,0,0,0,1,0,0,1,0,0,1,0,1,0,0,1,1], 19]
+[[0,0,0,0,1,0,1,1,0,1,1,1,0,1,1,1,1,0,0,1], 20]
+[[0,0,0,0,0,0,1,0,1,0,1,1,0,0,1,1,0,1,0,1], 22]
+[[0,0,0,0,0,0,1,0,1,0,0,0,1,0,0,1,0,1,1,0], 27]
+[[0,0,0,0,0,1,0,0,0,0,1,0,1,0,0,0,1,1,1,0], 31]
+[[0,0,0,1,0,0,1,0,0,0,0,1,1,0,0,0,1,1,1,1], 43]
+[[0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,1,0], 65]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,1,1], 140]
+--
+[[0,0,0,1,0,0,1,0,1,1,0,0,1,0,0,1,0,0,1,1], 19]
+[[0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,1,1,0], 26]
+[[0,0,0,1,0,1,1,0,0,0,1,1,1,0,0,0,1,1,0,0], 29]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,0,1,0], 29]
+[[0,0,0,0,0,0,0,1,0,1,1,1,1,0,0,0,1,1,1,1], 29]
+[[0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,1,0,0], 29]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0], 45]
+[[0,0,0,0,0,0,0,1,0,0,1,0,0,1,1,1,0,0,0,1], 48]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1,1], 65]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,1,0], 81]
+--
+[[0,1,0,0,1,1,1,0,1,1,0,1,0,1,0,1,0,1,0,1], 10]
+[[0,0,0,0,0,0,1,0,1,1,1,0,0,0,1,1,1,0,1,0], 17]
+[[0,0,0,0,1,0,1,0,0,0,0,0,1,1,1,1,1,0,0,0], 20]
+[[0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,0,1,1,1], 31]
+[[0,0,0,1,0,1,1,1,0,0,1,1,1,0,0,0,1,1,1,0], 34]
+[[0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,1,1], 38]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,1,1], 40]
+[[0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,1,0,0,0], 56]
+[[0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,1,1], 73]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0], 81]
+--
+[[0,0,0,0,0,0,1,0,1,0,1,0,1,0,1,0,0,1,0,0], 17]
+[[0,0,0,0,0,0,1,1,0,0,0,0,1,0,0,0,1,1,1,1], 23]
+[[0,1,0,1,0,1,1,0,1,0,0,1,1,0,0,0,1,0,1,0], 26]
+[[0,0,0,0,1,0,0,1,0,0,1,0,1,1,0,0,0,0,1,0], 29]
+[[0,0,0,0,0,0,0,0,0,1,1,1,1,0,1,1,1,0,0,0], 29]
+[[0,0,0,0,0,0,1,0,1,0,0,0,0,1,1,1,0,1,1,0], 35]
+[[0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,1,0,0,0], 49]
+[[0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,0,0,1,0], 51]
+[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1], 67]
+[[0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1], 74]
+--
+[[0,0,1,0,0,1,0,0,0,1,0,1,0,0,0,0,1,0,1,1], 12]
+[[0,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,0,1,1], 15]
+[[0,0,0,0,0,0,0,1,0,1,1,0,1,0,0,1,0,0,1,1], 23]
+[[0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,1,0,0,1], 26]
+[[0,0,0,1,0,1,1,0,0,0,0,1,1,0,0,0,1,1,1,0], 33]
+[[0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,1,0,1,0,0], 39]
+[[0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,0,0,1,0], 45]
+[[0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,1], 54]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,1,1,1], 58]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0], 95]
+--
+[[0,0,0,1,1,0,1,1,0,1,1,1,1,1,0,1,1,0,1,1], 16]
+[[0,1,0,1,0,1,0,0,0,0,1,1,1,0,1,0,0,0,1,1], 20]
+[[0,0,0,0,0,1,0,0,0,0,0,0,1,0,1,1,0,1,0,0], 23]
+[[0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,1,0,0,1], 26]
+[[0,0,0,1,0,0,1,1,0,0,0,0,1,0,0,0,0,1,0,0], 39]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0], 46]
+[[0,0,0,0,0,0,0,0,0,1,0,1,1,1,0,1,0,1,0,1], 48]
+[[0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,1,0,0,0], 49]
+[[0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,1,1], 64]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,1,1], 69]
+--
+[[1,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,1,0,1,1], 8]
+[[0,0,1,0,0,0,1,0,1,0,0,0,1,0,1,1,1,1,1,1], 16]
+[[0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,1,0,1,1,1], 22]
+[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1], 27]
+[[0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,1,0], 29]
+[[0,0,0,0,0,1,0,0,0,0,1,0,1,0,0,0,0,0,0,0], 40]
+[[0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,1,1,0], 48]
+[[0,0,0,0,0,0,0,1,0,0,0,0,1,1,1,1,1,0,0,1], 51]
+[[0,0,0,0,0,0,0,0,0,1,0,0,1,0,1,0,0,1,0,0], 58]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,1,0], 101]
+--
+[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1], 20]
+[[0,0,0,0,0,0,0,1,1,0,0,1,1,1,0,0,0,0,1,0], 25]
+[[0,1,0,1,1,1,0,0,0,0,1,0,1,0,0,0,1,0,1,0], 26]
+[[0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,0,0,0,0], 28]
+[[0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,1,1], 35]
+[[0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,0,1,1,0], 38]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,0], 48]
+[[0,0,0,0,0,0,1,0,0,0,0,0,1,1,1,1,1,1,0,0], 55]
+[[0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,1,1], 57]
+[[0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,1], 68]
+--
+[[0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,0], 0]
+[[0,0,0,0,1,1,1,0,0,0,0,0,0,1,1,1,1,0,0,1], 13]
+[[0,0,0,1,0,1,1,0,0,0,1,1,1,0,0,0,1,0,1,0], 22]
+[[0,0,0,0,0,0,0,1,0,0,0,0,1,0,1,1,1,1,0,0], 26]
+[[0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,1], 33]
+[[0,0,0,0,0,0,1,0,1,0,1,0,0,0,1,0,1,1,0,0], 33]
+[[0,0,0,0,0,0,0,0,1,0,0,0,1,1,1,1,0,0,1,1], 58]
+[[0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,1,1,0], 64]
+[[0,0,0,0,0,0,0,1,0,0,1,0,1,1,0,1,0,0,1,1], 75]
+[[0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,0], 76]
+--
+[[0,0,1,0,0,0,1,0,1,0,0,0,0,1,1,1,1,1,1,1], 12]
+[[0,0,0,0,1,0,1,0,1,0,1,0,0,1,1,1,1,0,1,1], 15]
+[[0,0,0,1,1,0,0,1,0,1,1,1,1,0,0,1,0,0,1,1], 16]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,1,1], 21]
+[[0,0,0,0,0,0,0,0,1,0,0,0,1,1,0,0,0,0,1,0], 26]
+[[0,0,0,1,0,0,1,0,0,0,0,1,1,0,0,0,0,1,1,0], 27]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,1], 47]
+[[0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,0], 55]
+[[0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0,1,0], 61]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,1,1], 120]
+--
+[[0,1,0,1,1,1,0,0,0,1,1,0,1,1,1,1,0,0,0,0], 11]
+[[0,0,0,0,1,1,0,0,1,0,1,0,1,0,0,0,1,0,1,0], 14]
+[[0,0,0,0,0,0,1,0,0,0,1,1,0,1,0,1,1,0,1,1], 21]
+[[0,0,0,0,0,0,0,1,0,1,1,1,1,0,0,0,0,1,1,1], 21]
+[[0,0,0,1,0,0,1,0,0,0,0,0,1,1,1,1,0,1,1,0], 28]
+[[0,0,0,0,0,0,0,0,0,1,0,0,1,1,1,1,1,0,0,1], 28]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,0], 40]
+[[0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,1,1,0], 65]
+[[0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,0,0,1,1], 84]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,1,1], 88]
+--
+[[0,0,1,0,0,0,1,0,1,1,0,0,1,0,0,0,0,1,1,0], 18]
+[[0,0,0,1,1,1,0,0,0,0,1,0,1,0,0,0,1,0,1,0], 21]
+[[0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,0,0,1,0], 28]
+[[0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,1,1,1], 36]
+[[0,0,0,0,0,1,0,0,1,0,0,0,1,1,0,1,0,0,1,1], 37]
+[[0,0,0,0,0,0,1,1,0,0,0,0,1,0,0,1,0,0,0,1], 39]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,1,0,1], 42]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0], 54]
+[[0,0,0,0,0,0,0,0,0,1,0,0,0,1,1,1,0,0,1,1], 56]
+[[0,0,0,0,0,0,1,0,0,0,0,1,1,1,1,1,0,0,1,0], 69]
+--
+[[0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,1,1,0], 10]
+[[0,0,0,0,0,0,0,0,1,0,0,0,1,1,1,0,0,1,1,1], 28]
+[[0,1,0,0,0,0,1,0,0,0,0,1,1,0,0,0,1,1,1,0], 29]
+[[0,0,0,0,0,1,0,0,0,0,0,1,0,1,1,1,0,1,0,1], 31]
+[[0,0,0,0,1,1,0,0,0,1,1,1,1,0,0,0,1,0,1,0], 31]
+[[0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,1,0], 36]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,1], 36]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,1,1,0], 42]
+[[0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,1,0,0,1,0], 58]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,1,1], 99]
+--
+[[0,0,0,0,0,1,0,0,1,1,1,0,1,1,1,1,0,0,1,1], 16] [[0,0,1,0,0,0,0,0,0,1,0,1,1,1,0,1,0,0,1,1], 17] [[0,0,0,0,0,0,0,1,0,0,1,0,0,1,0,1,0,0,1,1], 19] [[0,0,0,0,1,0,1,1,0,1,1,1,0,1,1,1,1,0,0,1], 20] [[0,0,0,0,0,0,1,0,1,0,1,1,0,0,1,1,0,1,0,1], 22] [[0,0,0,0,0,0,1,0,1,0,0,0,1,0,0,1,0,1,1,0], 27] [[0,0,0,0,0,1,0,0,0,0,1,0,1,0,0,0,1,1,1,0], 31] [[0,0,0,1,0,0,1,0,0,0,0,1,1,0,0,0,1,1,1,1], 43] [[0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,1,0], 65] [[0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,1,1], 140]
+[[0,0,0,1,0,0,1,0,1,1,0,0,1,0,0,1,0,0,1,1], 19] [[0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,1,1,0], 26] [[0,0,0,1,0,1,1,0,0,0,1,1,1,0,0,0,1,1,0,0], 29] [[0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,0,1,0], 29] [[0,0,0,0,0,0,0,1,0,1,1,1,1,0,0,0,1,1,1,1], 29] [[0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,1,0,0], 29] [[0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0], 45] [[0,0,0,0,0,0,0,1,0,0,1,0,0,1,1,1,0,0,0,1], 48] [[0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1,1], 65] [[0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,1,0], 81]
+[[0,1,0,0,1,1,1,0,1,1,0,1,0,1,0,1,0,1,0,1], 10] [[0,0,0,0,0,0,1,0,1,1,1,0,0,0,1,1,1,0,1,0], 17] [[0,0,0,0,1,0,1,0,0,0,0,0,1,1,1,1,1,0,0,0], 20] [[0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,0,1,1,1], 31] [[0,0,0,1,0,1,1,1,0,0,1,1,1,0,0,0,1,1,1,0], 34] [[0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,1,1], 38] [[0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,1,1], 40] [[0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,1,0,0,0], 56] [[0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,1,1], 73] [[0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0], 81]
+[[0,0,0,0,0,0,1,0,1,0,1,0,1,0,1,0,0,1,0,0], 17] [[0,0,0,0,0,0,1,1,0,0,0,0,1,0,0,0,1,1,1,1], 23] [[0,1,0,1,0,1,1,0,1,0,0,1,1,0,0,0,1,0,1,0], 26] [[0,0,0,0,1,0,0,1,0,0,1,0,1,1,0,0,0,0,1,0], 29] [[0,0,0,0,0,0,0,0,0,1,1,1,1,0,1,1,1,0,0,0], 29] [[0,0,0,0,0,0,1,0,1,0,0,0,0,1,1,1,0,1,1,0], 35] [[0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,1,0,0,0], 49] [[0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,0,0,1,0], 51] [[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1], 67] [[0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1], 74]
+[[0,0,1,0,0,1,0,0,0,1,0,1,0,0,0,0,1,0,1,1], 12] [[0,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,0,1,1], 15] [[0,0,0,0,0,0,0,1,0,1,1,0,1,0,0,1,0,0,1,1], 23] [[0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,1,0,0,1], 26] [[0,0,0,1,0,1,1,0,0,0,0,1,1,0,0,0,1,1,1,0], 33] [[0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,1,0,1,0,0], 39] [[0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,0,0,1,0], 45] [[0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,1], 54] [[0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,1,1,1], 58] [[0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0], 95]
+[[0,0,0,1,1,0,1,1,0,1,1,1,1,1,0,1,1,0,1,1], 16] [[0,1,0,1,0,1,0,0,0,0,1,1,1,0,1,0,0,0,1,1], 20] [[0,0,0,0,0,1,0,0,0,0,0,0,1,0,1,1,0,1,0,0], 23] [[0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,1,0,0,1], 26] [[0,0,0,1,0,0,1,1,0,0,0,0,1,0,0,0,0,1,0,0], 39] [[0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0], 46] [[0,0,0,0,0,0,0,0,0,1,0,1,1,1,0,1,0,1,0,1], 48] [[0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,1,0,0,0], 49] [[0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,1,1], 64] [[0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,1,1], 69]
+[[1,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,1,0,1,1], 8] [[0,0,1,0,0,0,1,0,1,0,0,0,1,0,1,1,1,1,1,1], 16] [[0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,1,0,1,1,1], 22] [[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1], 27] [[0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,1,0], 29] [[0,0,0,0,0,1,0,0,0,0,1,0,1,0,0,0,0,0,0,0], 40] [[0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,1,1,0], 48] [[0,0,0,0,0,0,0,1,0,0,0,0,1,1,1,1,1,0,0,1], 51] [[0,0,0,0,0,0,0,0,0,1,0,0,1,0,1,0,0,1,0,0], 58] [[0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,1,0], 101]
+[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1], 20] [[0,0,0,0,0,0,0,1,1,0,0,1,1,1,0,0,0,0,1,0], 25] [[0,1,0,1,1,1,0,0,0,0,1,0,1,0,0,0,1,0,1,0], 26] [[0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,0,0,0,0], 28] [[0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,1,1], 35] [[0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,0,1,1,0], 38] [[0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,0], 48] [[0,0,0,0,0,0,1,0,0,0,0,0,1,1,1,1,1,1,0,0], 55] [[0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,1,1], 57] [[0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,1], 68]
+[[0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,0], 0] [[0,0,0,0,1,1,1,0,0,0,0,0,0,1,1,1,1,0,0,1], 13] [[0,0,0,1,0,1,1,0,0,0,1,1,1,0,0,0,1,0,1,0], 22] [[0,0,0,0,0,0,0,1,0,0,0,0,1,0,1,1,1,1,0,0], 26] [[0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,1], 33] [[0,0,0,0,0,0,1,0,1,0,1,0,0,0,1,0,1,1,0,0], 33] [[0,0,0,0,0,0,0,0,1,0,0,0,1,1,1,1,0,0,1,1], 58] [[0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,1,1,0], 64] [[0,0,0,0,0,0,0,1,0,0,1,0,1,1,0,1,0,0,1,1], 75] [[0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,0], 76]
+[[0,0,1,0,0,0,1,0,1,0,0,0,0,1,1,1,1,1,1,1], 12] [[0,0,0,0,1,0,1,0,1,0,1,0,0,1,1,1,1,0,1,1], 15] [[0,0,0,1,1,0,0,1,0,1,1,1,1,0,0,1,0,0,1,1], 16] [[0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,1,1], 21] [[0,0,0,0,0,0,0,0,1,0,0,0,1,1,0,0,0,0,1,0], 26] [[0,0,0,1,0,0,1,0,0,0,0,1,1,0,0,0,0,1,1,0], 27] [[0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,1], 47] [[0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,0], 55] [[0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0,1,0], 61] [[0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,1,1], 120]
+[[0,1,0,1,1,1,0,0,0,1,1,0,1,1,1,1,0,0,0,0], 11] [[0,0,0,0,1,1,0,0,1,0,1,0,1,0,0,0,1,0,1,0], 14] [[0,0,0,0,0,0,1,0,0,0,1,1,0,1,0,1,1,0,1,1], 21] [[0,0,0,0,0,0,0,1,0,1,1,1,1,0,0,0,0,1,1,1], 21] [[0,0,0,1,0,0,1,0,0,0,0,0,1,1,1,1,0,1,1,0], 28] [[0,0,0,0,0,0,0,0,0,1,0,0,1,1,1,1,1,0,0,1], 28] [[0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,0], 40] [[0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,1,1,0], 65] [[0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,0,0,1,1], 84] [[0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,1,1], 88]
+[[0,0,1,0,0,0,1,0,1,1,0,0,1,0,0,0,0,1,1,0], 18] [[0,0,0,1,1,1,0,0,0,0,1,0,1,0,0,0,1,0,1,0], 21] [[0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,0,0,1,0], 28] [[0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,1,1,1], 36] [[0,0,0,0,0,1,0,0,1,0,0,0,1,1,0,1,0,0,1,1], 37] [[0,0,0,0,0,0,1,1,0,0,0,0,1,0,0,1,0,0,0,1], 39] [[0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,1,0,1], 42] [[0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0], 54] [[0,0,0,0,0,0,0,0,0,1,0,0,0,1,1,1,0,0,1,1], 56] [[0,0,0,0,0,0,1,0,0,0,0,1,1,1,1,1,0,0,1,0], 69]
+[[0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,1,1,0], 10] [[0,0,0,0,0,0,0,0,1,0,0,0,1,1,1,0,0,1,1,1], 28] [[0,1,0,0,0,0,1,0,0,0,0,1,1,0,0,0,1,1,1,0], 29] [[0,0,0,0,0,1,0,0,0,0,0,1,0,1,1,1,0,1,0,1], 31] [[0,0,0,0,1,1,0,0,0,1,1,1,1,0,0,0,1,0,1,0], 31] [[0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,1,0], 36] [[0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,1], 36] [[0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,1,1,0], 42] [[0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,1,0,0,1,0], 58] [[0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,1,1], 99]
--- /dev/null
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,1,1], 140] [[0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,1,0], 65] [[0,0,0,1,0,0,1,0,0,0,0,1,1,0,0,0,1,1,1,1], 43] [[0,0,0,0,0,1,0,0,0,0,1,0,1,0,0,0,1,1,1,0], 31] [[0,0,0,0,0,0,1,0,1,0,0,0,1,0,0,1,0,1,1,0], 27] [[0,0,0,0,0,0,1,0,1,0,1,1,0,0,1,1,0,1,0,1], 22] [[0,0,0,0,1,0,1,1,0,1,1,1,0,1,1,1,1,0,0,1], 20] [[0,0,0,0,0,0,0,1,0,0,1,0,0,1,0,1,0,0,1,1], 19] [[0,0,1,0,0,0,0,0,0,1,0,1,1,1,0,1,0,0,1,1], 17] [[0,0,0,0,0,1,0,0,1,1,1,0,1,1,1,1,0,0,1,1], 16]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,1,0], 81] [[0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1,1], 65] [[0,0,0,0,0,0,0,1,0,0,1,0,0,1,1,1,0,0,0,1], 48] [[0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0], 45] [[0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,1,0,0], 29] [[0,0,0,0,0,0,0,1,0,1,1,1,1,0,0,0,1,1,1,1], 29] [[0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,0,1,0], 29] [[0,0,0,1,0,1,1,0,0,0,1,1,1,0,0,0,1,1,0,0], 29] [[0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,1,1,0], 26] [[0,0,0,1,0,0,1,0,1,1,0,0,1,0,0,1,0,0,1,1], 19]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0], 81] [[0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,1,1], 73] [[0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,1,0,0,0], 56] [[0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,1,1], 40] [[0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,1,1], 38] [[0,0,0,1,0,1,1,1,0,0,1,1,1,0,0,0,1,1,1,0], 34] [[0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,0,1,1,1], 31] [[0,0,0,0,1,0,1,0,0,0,0,0,1,1,1,1,1,0,0,0], 20] [[0,0,0,0,0,0,1,0,1,1,1,0,0,0,1,1,1,0,1,0], 17] [[0,1,0,0,1,1,1,0,1,1,0,1,0,1,0,1,0,1,0,1], 10]
+[[0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1], 74] [[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1], 67] [[0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,0,0,1,0], 51] [[0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,1,0,0,0], 49] [[0,0,0,0,0,0,1,0,1,0,0,0,0,1,1,1,0,1,1,0], 35] [[0,0,0,0,0,0,0,0,0,1,1,1,1,0,1,1,1,0,0,0], 29] [[0,0,0,0,1,0,0,1,0,0,1,0,1,1,0,0,0,0,1,0], 29] [[0,1,0,1,0,1,1,0,1,0,0,1,1,0,0,0,1,0,1,0], 26] [[0,0,0,0,0,0,1,1,0,0,0,0,1,0,0,0,1,1,1,1], 23] [[0,0,0,0,0,0,1,0,1,0,1,0,1,0,1,0,0,1,0,0], 17]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0], 95] [[0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,1,1,1], 58] [[0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,1], 54] [[0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,0,0,1,0], 45] [[0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,1,0,1,0,0], 39] [[0,0,0,1,0,1,1,0,0,0,0,1,1,0,0,0,1,1,1,0], 33] [[0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,1,0,0,1], 26] [[0,0,0,0,0,0,0,1,0,1,1,0,1,0,0,1,0,0,1,1], 23] [[0,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,0,1,1], 15] [[0,0,1,0,0,1,0,0,0,1,0,1,0,0,0,0,1,0,1,1], 12]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,1,1], 69] [[0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,1,1], 64] [[0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,1,0,0,0], 49] [[0,0,0,0,0,0,0,0,0,1,0,1,1,1,0,1,0,1,0,1], 48] [[0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0], 46] [[0,0,0,1,0,0,1,1,0,0,0,0,1,0,0,0,0,1,0,0], 39] [[0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,1,0,0,1], 26] [[0,0,0,0,0,1,0,0,0,0,0,0,1,0,1,1,0,1,0,0], 23] [[0,1,0,1,0,1,0,0,0,0,1,1,1,0,1,0,0,0,1,1], 20] [[0,0,0,1,1,0,1,1,0,1,1,1,1,1,0,1,1,0,1,1], 16]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,1,0], 101] [[0,0,0,0,0,0,0,0,0,1,0,0,1,0,1,0,0,1,0,0], 58] [[0,0,0,0,0,0,0,1,0,0,0,0,1,1,1,1,1,0,0,1], 51] [[0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,1,1,0], 48] [[0,0,0,0,0,1,0,0,0,0,1,0,1,0,0,0,0,0,0,0], 40] [[0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,1,0], 29] [[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1], 27] [[0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,1,0,1,1,1], 22] [[0,0,1,0,0,0,1,0,1,0,0,0,1,0,1,1,1,1,1,1], 16] [[1,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,1,0,1,1], 8]
+[[0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,1], 68] [[0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,1,1], 57] [[0,0,0,0,0,0,1,0,0,0,0,0,1,1,1,1,1,1,0,0], 55] [[0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,0], 48] [[0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,0,1,1,0], 38] [[0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,1,1], 35] [[0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,0,0,0,0], 28] [[0,1,0,1,1,1,0,0,0,0,1,0,1,0,0,0,1,0,1,0], 26] [[0,0,0,0,0,0,0,1,1,0,0,1,1,1,0,0,0,0,1,0], 25] [[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1], 20]
+[[0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,0], 76] [[0,0,0,0,0,0,0,1,0,0,1,0,1,1,0,1,0,0,1,1], 75] [[0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,1,1,0], 64] [[0,0,0,0,0,0,0,0,1,0,0,0,1,1,1,1,0,0,1,1], 58] [[0,0,0,0,0,0,1,0,1,0,1,0,0,0,1,0,1,1,0,0], 33] [[0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,1], 33] [[0,0,0,0,0,0,0,1,0,0,0,0,1,0,1,1,1,1,0,0], 26] [[0,0,0,1,0,1,1,0,0,0,1,1,1,0,0,0,1,0,1,0], 22] [[0,0,0,0,1,1,1,0,0,0,0,0,0,1,1,1,1,0,0,1], 13] [[0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,0], 0]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,1,1], 120] [[0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0,1,0], 61] [[0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,0], 55] [[0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,1], 47] [[0,0,0,1,0,0,1,0,0,0,0,1,1,0,0,0,0,1,1,0], 27] [[0,0,0,0,0,0,0,0,1,0,0,0,1,1,0,0,0,0,1,0], 26] [[0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,1,1], 21] [[0,0,0,1,1,0,0,1,0,1,1,1,1,0,0,1,0,0,1,1], 16] [[0,0,0,0,1,0,1,0,1,0,1,0,0,1,1,1,1,0,1,1], 15] [[0,0,1,0,0,0,1,0,1,0,0,0,0,1,1,1,1,1,1,1], 12]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,1,1], 88] [[0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,0,0,1,1], 84] [[0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,1,1,0], 65] [[0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,0], 40] [[0,0,0,0,0,0,0,0,0,1,0,0,1,1,1,1,1,0,0,1], 28] [[0,0,0,1,0,0,1,0,0,0,0,0,1,1,1,1,0,1,1,0], 28] [[0,0,0,0,0,0,0,1,0,1,1,1,1,0,0,0,0,1,1,1], 21] [[0,0,0,0,0,0,1,0,0,0,1,1,0,1,0,1,1,0,1,1], 21] [[0,0,0,0,1,1,0,0,1,0,1,0,1,0,0,0,1,0,1,0], 14] [[0,1,0,1,1,1,0,0,0,1,1,0,1,1,1,1,0,0,0,0], 11]
+[[0,0,0,0,0,0,1,0,0,0,0,1,1,1,1,1,0,0,1,0], 69] [[0,0,0,0,0,0,0,0,0,1,0,0,0,1,1,1,0,0,1,1], 56] [[0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0], 54] [[0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,1,0,1], 42] [[0,0,0,0,0,0,1,1,0,0,0,0,1,0,0,1,0,0,0,1], 39] [[0,0,0,0,0,1,0,0,1,0,0,0,1,1,0,1,0,0,1,1], 37] [[0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,1,1,1], 36] [[0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,0,0,1,0], 28] [[0,0,0,1,1,1,0,0,0,0,1,0,1,0,0,0,1,0,1,0], 21] [[0,0,1,0,0,0,1,0,1,1,0,0,1,0,0,0,0,1,1,0], 18]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,1,1], 99] [[0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,1,0,0,1,0], 58] [[0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,1,1,0], 42] [[0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,1], 36] [[0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,1,0], 36] [[0,0,0,0,1,1,0,0,0,1,1,1,1,0,0,0,1,0,1,0], 31] [[0,0,0,0,0,1,0,0,0,0,0,1,0,1,1,1,0,1,0,1], 31] [[0,1,0,0,0,0,1,0,0,0,0,1,1,0,0,0,1,1,1,0], 29] [[0,0,0,0,0,0,0,0,1,0,0,0,1,1,1,0,0,1,1,1], 28] [[0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,1,1,0], 10]
--- /dev/null
+#!/usr/bin/ruby
+#
+# == Synopsis
+#
+# Play one move of a Trap the Cap game
+#
+# == Usage
+# clockwise-p1
+# Game state file read on STDIN
+# Move produced on STDOUT
+#
+# == Author
+# Neil Smith
+
+
+require 'libttc'
+require 'libttc-pplayer'
+require 'rdoc/usage'
+
+
+# Get the current game state
+game_lines = readlines
+game, moves, next_roll = Game.read_game(game_lines)
+game.apply_moves! moves
+
+player = Potential_player.new({:friend_pull => 0.0,
+ :enemy_pull => 0.0,
+ :base_pull => 0.0,
+ :safe_bonus => 10,
+ :capture_bonus => 2})
+
+best_move = player.best_move(game, next_roll)
+
+# return that move
+puts best_move
--- /dev/null
+# == Synopsis
+#
+# Library to support genetic algorithms
+#
+# == Author
+# Neil Smith
+#
+# == Change history
+# Version 1.1:: 23 April 2008
+
+# A single genome in a population
+class Genome
+
+ attr_accessor :genome
+
+ # Create a random genome of the given length
+ def initialize(bitstring_or_length)
+ if bitstring_or_length.class == Fixnum
+ @genome = []
+ (1..bitstring_or_length).each do |i|
+ @genome << rand(2)
+ end
+ else
+ @genome = bitstring_or_length
+ end
+ end
+
+ # Mutate a genome with the given rate per bit
+ def mutate(mutation_probability = 0.05)
+ new_genome = Genome.new(@genome.length)
+ (0...@genome.length).each do |i|
+ if rand < mutation_probability
+ if @genome[i] == 0
+ new_genome.genome[i] = 1
+ else
+ new_genome.genome[i] = 0
+ end
+ else
+ new_genome.genome[i] = @genome[i]
+ end
+ end
+ new_genome
+ end
+
+ # Mutate a genome in-place with the given rate per bit
+ def mutate!(mutation_probability = 0.05)
+ (0...@genome.length).each do |i|
+ if rand < mutation_probability
+ if @genome[i] == 0
+ @genome[i] = 1
+ else
+ @genome[i] = 0
+ end
+ end
+ end
+ @genome
+ end
+
+ # Crossover two genomes at the given point
+ def crossover(other_genome, crossover_point)
+ raise ArgumentError, "Different size genomes" if @genome.length != other_genome.genome.length
+ raise ArgumentError, "Our of bounds crossover point" if crossover_point < 0 or crossover_point > @genome.length
+ child1 = Genome.new(0)
+ child2 = Genome.new(0)
+ child1.genome = @genome[0, crossover_point] + other_genome.genome[crossover_point, @genome.length]
+ child2.genome = other_genome.genome[0, crossover_point] + @genome[crossover_point, @genome.length]
+ [child1, child2]
+ end
+
+end
+
+
+class Array
+ def to_decimal
+ val = 0
+ bits = self.dup
+ while not bits.empty?
+ val = val * 2 + bits[0]
+ bits = bits[1..bits.length]
+ end
+ val
+ end
+
+ def gray_encode
+ gray = self[0..0]
+ (1...self.length).each do |i|
+ if (self[i - 1] == 1) ^ (self[i] == 1)
+ gray << 1
+ else
+ gray << 0
+ end
+ end
+ gray
+ end
+
+ def gray_decode
+ binary = self[0..0]
+ (1...self.length).each do |i|
+ if (binary[i - 1] == 1) ^ (self[i] == 1)
+ binary << 1
+ else
+ binary << 0
+ end
+ end
+ binary
+ end
+
+end
+
+class Fixnum
+ def to_bitstring(min_length = 0)
+ bits = []
+ k = self
+ while k > 0 do
+ if k % 2 == 1
+ bits << 1
+ else
+ bits << 0
+ end
+ k = k >> 1
+ end
+ while bits.length < min_length do
+ bits << 0
+ end
+ bits.reverse
+ end
+end
+
+
+# A population of genomes
+class Population
+ attr_accessor :individuals
+
+ # Create a population of a given size
+ def initialize(population_size, genome_length = 0)
+ @individuals = []
+ 1.upto(population_size) { @individuals << Genome.new(genome_length) }
+ end
+
+ # Perform the crossover step in a population, giving a new population
+ def crossover(crossover_rate)
+ parents = @individuals.dup # genomes that haven't been parents yet
+ next_population = Population.new(0)
+ while parents.length > 1
+ parent1 = parents.delete_at(rand(parents.length)).dup
+ parent2 = parents.delete_at(rand(parents.length)).dup
+ if rand < crossover_rate
+ child1, child2 = parent1.crossover parent2, rand(parent1.genome.length)
+ next_population.individuals << child1 << child2
+ else
+ next_population.individuals << parent1 << parent2
+ end
+ end
+ next_population.individuals.concat parents # pick up any parents that didn't get a chance to mate
+ next_population
+ end
+
+ # Perform the mutation step in a population, giving a new population
+ def mutation(mutation_rate)
+ parents = @individuals.dup # genomes that haven't been parents yet
+ next_population = Population.new(0)
+ while parents.length > 0
+ parent = parents.pop.dup
+ child = parent.mutate mutation_rate
+ next_population.individuals << child
+ end
+ next_population
+ end
+
+ def make_next_generation(tournament_winner_success_rate = 0.8, game_length = 1000, crossover_rate = 0.7, mutation_rate = 0.05)
+ @individuals = tournament_select_population(tournament_winner_success_rate, game_length, false)
+ @individuals = crossover(crossover_rate)
+ @individuals = mutation(mutation_rate)
+ end
+
+end
--- /dev/null
+# == Synopsis
+#
+# Library to support a Trap the Cap player that uses potentials to select the
+# best move
+#
+# == Author
+# Neil Smith
+#
+# == Change history
+# Version 1.1:: 23 April 2008
+
+require 'libttc'
+
+# Play Trap the Cap by using potential fields. For each possible move,
+# calculate the field strength and pick the move with the lowest potential
+class Potential_player
+
+ attr_reader :friend_pull, :enemy_pull, :base_pull,
+ :safe_bonus, :capture_bonus
+
+ def initialize(args, verbose = false)
+ @friend_pull = args[:friend_pull] || 1
+ @enemy_pull = args[:enemy_pull] || 0.5
+ @base_pull = args[:base_pull] || 2
+ @safe_bonus = args[:safe_bonus] || 8
+ @capture_bonus = args[:capture_bonus] || 10
+
+ @verbose = verbose
+ end
+
+ # Find the best move of the possible ones
+ def best_move(game, die_result)
+ me = game.current_player
+ possible_moves = game.possible_moves(die_result, me)
+ scored_moves = possible_moves.collect do |m|
+ begin
+ game.apply_move! m
+ score = score_position(game, me)
+# game.undo_move!
+ rescue GameWonNotice
+ score = 10000
+ ensure
+ game.undo_move!
+ end
+ puts "#{m} scores #{score}" if @verbose
+ [m, score]
+ end
+ best_move = (scored_moves.max {|a, b| a[1] <=> b[1]})[0]
+ end
+
+ # Calculate the potential score of a position for a given player
+ def score_position(game, player)
+ score = 0
+ game.pieces.each_value do |piece|
+ here = piece.position
+ if piece.colour == player
+ game.pieces.each_value do |other_piece|
+ if other_piece.colour == player
+ score += game.board.distance_between[here.place][other_piece.position.place] * @friend_pull
+ else
+ score += game.board.distance_between[here.place][other_piece.position.place] * @enemy_pull
+ end
+ end
+ score += piece.contains.length * @capture_bonus
+ score += game.board.distance_between[here.place][game.board.positions[player].place] *
+ piece.contains.length * @base_pull
+ elsif here == game.board.positions[player]
+ score += @safe_bonus
+ end
+ end
+ score
+ end
+
+end
--- /dev/null
+# == Synopsis
+#
+# Library to support Trap the Cap play
+#
+# == Author
+# Neil Smith
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# == Change history
+# Version 1.1:: 07 Sep 2007
+# * Changed format for showing moves via bases.
+# * Raise error when moving via base without captured pieces
+# * Raise error when moving onto a safe space with 3 or more
+# pieces already there
+# Version 1.2:: 10 Sep 2007
+# * Incorporated changes in move legality above into
+# Game#possible_moves
+# Version 1.3:: 25 Mar 2008
+# * Fixed bug to detect a winner, and also eliminate players
+# that have no uncaptured pieces.
+
+# Errors for a game
+
+# Pieces can only capture pieces that they're on.
+class InvalidCaptureError < StandardError
+end
+
+# Moves can only be [1..6] spaces
+class InvalidMoveError < StandardError
+end
+
+# Game is won when only one player has uncaptured pieces
+class GameWonNotice < StandardError
+end
+
+
+# Each possible position for a piece is an object
+# Each neighbour is another position object
+class Position
+ attr_reader :place # the name of this place
+ attr_accessor :contains # the pieces it contains
+ attr_accessor :neighbours # the positions that neighbour it
+
+ def initialize(place, safety, base)
+ @place = place
+ @safe = safety
+ @base = base
+ @neighbours = Array.new
+ end
+
+ # is this position a safety one (i.e. no captures allowed)?
+ def safe?
+ @safe
+ end
+
+ # Is this position a base?
+ def base?
+ @base
+ end
+
+ def to_s
+ @place
+ end
+
+ def to_str
+ to_s
+ end
+
+end
+
+
+# The game board
+class Board
+
+ attr_reader :positions
+ attr_reader :valid_moves
+ attr_reader :distance_between
+ attr_reader :centre
+
+
+ # A laborious procedure to create all the positions and tie them all together
+ def initialize(spokes, spoke_length, arc_length)
+ # A hash of all positions, indexed by position names
+ @positions = Hash.new
+ @centre = Position.new('ac' + spoke_length.to_s, false, false)
+ @positions['ac' + spoke_length.to_s] = centre
+ a1_corner = nil
+ end_of_previous_arc = nil
+
+ # Do each arc-spoke-base set
+ (?a...(?a + spokes)).each do |arc_code|
+ arc = arc_code.chr
+ base = Position.new(arc, false, true)
+ this_arc = Array.new
+
+ # build the arc
+ (1..arc_length).each do |arc_position|
+ position_name = arc + arc_position.to_s
+ arc_place = Position.new(position_name, arc_position == 4, false)
+ arc_place.neighbours = []
+ @positions[position_name] = arc_place
+ this_arc << arc_place
+ a1_corner = a1_corner || arc_place
+ end
+ (0...arc_length).each do |arc_position|
+ if arc_position > 0
+ this_arc[arc_position].neighbours << this_arc[arc_position - 1]
+ end
+ if arc_position < (arc_length - 1)
+ this_arc[arc_position].neighbours << this_arc[arc_position + 1]
+ end
+ end
+
+ # build the spoke
+ this_spoke = Array.new
+ (1..(spoke_length - 1)).each do |spoke_position|
+ position_name = arc + "c" + spoke_position.to_s
+ spoke_place = Position.new(position_name, spoke_position == 3, false)
+ spoke_place.neighbours = []
+ @positions[position_name] = spoke_place
+ this_spoke << spoke_place
+ end
+ (0...(spoke_length - 1)).each do |spoke_position|
+ if spoke_position > 0
+ this_spoke[spoke_position].neighbours << this_spoke[spoke_position - 1]
+ end
+ if spoke_position < spoke_length - 2
+ this_spoke[spoke_position].neighbours << this_spoke[spoke_position + 1]
+ end
+ end
+
+ # tie the spoke and arc together,
+ this_arc[0].neighbours << this_spoke[0]
+ this_spoke[0].neighbours << this_arc[0]
+
+ # tie the spoke to the centre, and
+ this_spoke[-1].neighbours << @centre
+ @centre.neighbours << this_spoke[-1]
+
+ # tie the base to the arc
+ base = Position.new(arc, false, true)
+ @positions[arc] = base
+ base.neighbours << this_arc[0]
+ this_arc[0].neighbours << base
+
+ # record the ends of the arc for tying to adjacent arcs
+ if end_of_previous_arc
+ end_of_previous_arc.neighbours << this_arc[0]
+ this_arc[0].neighbours << end_of_previous_arc
+ end
+ end_of_previous_arc = this_arc[-1]
+
+ end # arc
+
+ # tie both ends of the rim together
+ a1_corner.neighbours << end_of_previous_arc
+ end_of_previous_arc.neighbours << a1_corner
+
+ cache_valid_moves
+
+ end # def
+
+ def to_s
+ layout
+ end
+
+ def to_str
+ to_s
+ end
+
+
+ # For each position, show its name and what it touches
+ def layout
+ out_string = ""
+ @positions.keys.sort.each do |position|
+ out_string << sprintf("%s touches ", @positions[position])
+ @positions[position].neighbours.each do |neighbour|
+ out_string << sprintf("%s, ", neighbour)
+ end
+ out_string << sprintf("\n")
+ end
+ out_string
+ end
+
+
+ # Precompute the valid moves for this board, and the distances between each
+ # pair of positions
+ def cache_valid_moves
+ # A hash of arrays. The has key is the name of a positions. The array
+ # element [i] stores the positions that are i spaces from here
+ @valid_moves = Hash.new
+ # A hash of hashes. Given two names, return the shortest distance between
+ # the two locations
+ @distance_between = Hash.new
+ @positions.each do |place, position|
+ @valid_moves[place] = Array.new
+ @distance_between[place] = Hash.new
+ @valid_moves[place][0] = [@positions[place]]
+ @distance_between[place][place] = 0
+ # Find the shortest routes by Dijkstra's algorithm
+ agenda = [position]
+ closed_list = [position]
+ i = 1
+ while not agenda.empty?
+ @valid_moves[place][i] = []
+ new_agenda = []
+ agenda.each do |pos|
+ valid_extensions = pos.neighbours.reject {|new_position| closed_list.include?(new_position) }
+ @valid_moves[place][i] += valid_extensions
+ valid_extensions.each {|ext| @distance_between[place][ext.place] ||= i }
+ closed_list += valid_extensions
+ new_agenda += valid_extensions
+ end
+ agenda = new_agenda
+ i += 1
+ end
+ end
+ end
+
+end
+
+
+# Each piece on the board is an object
+class Piece
+ attr_reader :colour
+ attr_accessor :position, :contains, :captured
+
+ def initialize(number, position, colour)
+ @number = number
+ @position = position
+ @colour = colour
+ @captured = false
+ @contains = []
+ end
+
+ def name
+ @colour + @number.to_s
+ end
+
+ def to_s
+ self.name
+ end
+
+ def to_str
+ to_s
+ end
+
+ def move_to(new_position)
+ @position = new_position
+ @contains.each {|c| c.move_to(new_position)}
+ end
+
+ # Caputre another piece
+ def capture(other_piece)
+ if @position = other_piece.position
+ @contains << other_piece
+ @contains += other_piece.contains
+ other_piece.contains = []
+ other_piece.captured = true
+ else
+ raise(InvalidCaptureError,
+ "Piece #{self.name} cannot capture #{other_piece.name}: different locations")
+ end
+ end
+
+end
+
+
+# A move in a game
+class Move
+ attr_reader :piece, :destination
+
+ def initialize(piece, destination, via_base = false)
+ @piece = piece
+ @destination = destination
+ @via_base = via_base
+ end
+
+ def via_base?
+ @via_base
+ end
+
+ # Write a move to a string
+ # Note the inverse, String#to_move, is defined below
+ def to_s
+ if @via_base
+ if @destination.base?
+ @piece.to_s + " " + @destination.to_s
+ else
+ @piece.to_s + " " + piece.colour + " " + @destination.to_s
+ end
+ else
+ @piece.to_s + " " + @destination.to_s
+ end
+ end
+
+ def to_str
+ to_s
+ end
+
+end
+
+
+
+# A class to record each of the states previously found in a game.
+# Note that this is a deep copy of the pieces and what they've captured, so
+# you'll need to convert back
+class GameState
+ attr_accessor :move, :player, :pieces_after_move
+
+ def initialize(move, player, pieces)
+ @move = move
+ @player = player
+ @pieces_after_move = Hash.new
+ pieces.each {|k, p| @pieces_after_move[k] = p.dup}
+ @pieces_after_move.each_value {|p| p.contains = []}
+ # and now to make the captured pieces point to the copies
+ pieces.each do |k, p|
+ p.contains.each do |captured_piece|
+ @pieces_after_move[k].capture(@pieces_after_move[captured_piece.name])
+ end
+ end
+ end
+
+ def ==(other)
+ @move.to_s == other.move.to_s and
+ @player == other.player and
+ @piece_after_move == other.pieces_after_move
+ end
+
+end
+
+
+# A game of Trap the Cap. It keeps a history of all previous states.
+class Game
+
+ attr_reader :history
+ attr_reader :current_player, :players
+ attr_reader :board
+ attr_reader :pieces
+
+ # Create a new game
+ def initialize(players = 6, spokes = 6, spoke_length = 6, arc_length = 6,
+ pieces_each = 6)
+ @board = Board.new(spokes, spoke_length, arc_length)
+ @history = []
+ @pieces = Hash.new
+ @players = case
+ when players == 2 ; ['a', 'd']
+ when players == 3 ; ['a', 'c', 'e']
+ when players == 4 ; ['a', 'b', 'd', 'e']
+ when players == 5 ; ['a', 'b', 'c', 'd', 'e']
+ when players == 6 ; ['a', 'b', 'c', 'd', 'e', 'f']
+ end
+ @current_player = 'a'
+ @players.each do |player|
+ players_base = @board.positions[player]
+ (1..pieces_each).each do |count|
+ piece = Piece.new(count, players_base, player)
+ @pieces[player + count.to_s] = piece
+ end
+ end
+ end
+
+
+ # Apply a single move to a game.
+ def apply_move!(move, player = @current_player)
+ # Check the move is a valid one
+ raise(InvalidMoveError, "Piece #{move.piece} does not exist") unless @pieces.has_key?(move.piece.name)
+ raise(InvalidMoveError, "Player #{player} moving piece #{move.piece}") unless move.piece.colour == player
+ raise(InvalidMoveError, "Attempting to move captured piece #{move.piece}") if move.piece.captured
+ raise(InvalidMoveError, "Attempting to move #{move.piece} onto or via base without captured pieces") if move.via_base? and move.piece.contains.empty?
+ if move.destination.safe?
+ if (@pieces.find_all {|k, p| p.position == move.destination}).length >= 3
+ raise(InvalidMoveError, "Attempting to move #{move.piece} onto safe position #{move.destination} when there are already three or more pieces there")
+ end
+ end
+ if move.via_base?
+ moved_distance = board.distance_between[move.piece.position.place][player] +
+ board.distance_between[player][move.destination.place]
+ else
+ moved_distance = board.distance_between[move.piece.position.place][move.destination.place]
+ end
+ raise(InvalidMoveError, "Attempting to move piece #{move.piece} #{moved_distance} places (from #{move.piece.position} to #{move.destination})") if moved_distance < 1 or moved_distance > 6
+
+ # Apply this move
+ move.piece.move_to(move.destination)
+
+ # Capture anything already there (unless it's a safe place or a base,
+ # or our own colour, or already captured)
+ unless move.destination.safe? or move.destination.base?
+ @pieces.each do |name, target_piece|
+ if target_piece.position == move.destination and
+ target_piece != move.piece and
+ not move.piece.contains.member?(target_piece) and
+ target_piece.colour != player and
+ not target_piece.captured
+ move.piece.capture(target_piece)
+ end
+ end
+ end
+
+ # If the move was via our base, drop all captured pieces
+ if move.via_base?
+ capturers_base = board.positions[move.piece.colour]
+ move.piece.contains.each do |captured_piece|
+ captured_piece.move_to capturers_base
+ captured_piece.captured = false if captured_piece.colour == move.piece.colour
+ end
+ move.piece.contains = []
+ end
+
+ # Record the new stae
+ this_game_state = GameState.new(move, player, @pieces)
+ @history << this_game_state
+
+ # Retain only players that have uncaptured pieces.
+ # If there's only one player with uncaptured pieces, declare a win.
+ potential_players = []
+ @players.each do |p|
+ if (@pieces.values.select {|piece| piece.colour == p}).any? {|piece| not piece.captured}
+ potential_players << p
+ end
+ # potential_players << p if (@pieces.values.select {|p| p.colour == @current_player}).any? {|p| not p.captured}
+ end
+ if potential_players.length <= 1
+ raise(GameWonNotice, "Game won by #{potential_players[0]}")
+ end
+ @players = potential_players.sort
+ end
+
+ # Undo a move
+ def undo_move!
+ if @history.length > 1
+ # general case
+ state_to_restore = @history[-2]
+ @current_player = @history[-1].player
+ @pieces.each do |name, piece|
+ copy_piece = state_to_restore.pieces_after_move[name]
+ piece.position = copy_piece.position
+ piece.captured = copy_piece.captured
+ piece.contains = []
+ copy_piece.contains.each do |p|
+# piece.capture(@pieces[p.name])
+ piece.contains << @pieces[p.name]
+ end
+ end
+ @history.pop
+ elsif @history.length == 1
+ # reset to start
+ @current_player = 'a'
+ @pieces.each do |name, piece|
+ piece.position = @board.positions[piece.colour]
+ piece.captured = false
+ piece.contains = []
+ end
+ @history.pop
+ end
+ end
+
+ # Apply a list of moves in order
+ def apply_moves!(moves)
+ moves.each do |move|
+ if move.via_base?
+ moved_distance = board.distance_between[move.piece.position.place][@current_player] +
+ board.distance_between[@current_player][move.destination.place]
+ else
+ moved_distance = board.distance_between[move.piece.position.place][move.destination.place]
+ end
+ self.apply_move!(move, @current_player)
+ next_player! unless moved_distance == 6
+ end
+ end
+
+
+ # Set the current player to be the next player
+ def next_player!
+ original_player = @current_player
+ begin
+ if @current_player == @players[-1]
+ @current_player = @players[0]
+ else
+ @current_player = @players[@players.index(@current_player) + 1]
+ end
+ end while (@pieces.values.select {|p| p.colour == @current_player}).all? {|p| p.captured} and @current_player != original_player
+ @current_player
+ end
+
+
+ # Return an array of all possible moves from this state, given the die roll
+ # and the active player
+ def possible_moves(die_result, player = @current_player)
+ moves = []
+ @pieces.each do |key, piece|
+ # only move current player's pieces, and only if they're not captured
+ if piece.colour == player and (not piece.captured)
+ (@board.valid_moves[piece.position.place][die_result]).each do |destination|
+ if destination.safe?
+ if (@pieces.find_all {|k, p| p.position == destination}).length < 3
+ moves << Move.new(piece, destination, false)
+ end
+ else
+ moves << Move.new(piece, destination, false) unless destination.base?
+ end
+ end
+ # if we can move to our base (but not already on it), add moves via that...
+ if @board.distance_between[piece.position.place][player] <= die_result and
+ not piece.position.place == player and
+ not piece.contains.empty?
+ distance_after_base = die_result - @board.distance_between[piece.position.place][player]
+ (@board.valid_moves[player][distance_after_base]).each do |destination|
+ if destination.safe?
+ if (@pieces.find_all {|k, p| p.position == destination}).length < 3
+ moves << Move.new(piece, destination, true)
+ end
+ else
+ moves << Move.new(piece, destination, true)
+ end
+ end
+ end
+ end
+ end
+ moves
+ end
+
+
+ def build_state_string
+ outstr = "Current player = #{@current_player}\n"
+ @pieces.keys.sort.each do |piece_name|
+ if @pieces[piece_name].captured
+ outstr << "Piece #{piece_name} captured, at #{@pieces[piece_name].position}\n"
+ else
+ outstr << "Piece #{piece_name} is at #{@pieces[piece_name].position}, holds #{(@pieces[piece_name].contains.collect{|c| c.name}).join(' ')}\n"
+ end
+ end
+ outstr
+ end
+
+ # Show the state of the board
+ def show_state
+ puts build_state_string
+# @pieces.keys.sort.each do |piece_name|
+# if @pieces[piece_name].captured
+# puts "Piece #{piece_name} captured, at #{@pieces[piece_name].position}"
+# else
+# puts "Piece #{piece_name} is at #{@pieces[piece_name].position}, holds #{(@pieces[piece_name].contains.collect{|c| c.name}).join(' ')}"
+# end
+# end
+ end
+
+ def to_s
+ show_state
+ end
+
+ def to_str
+ to_s
+ end
+
+
+ # Given a set of lines from an input file, turn them into a Game object and
+ # a set of Move objects.
+ # Note the multiple return values.
+ # Class method
+ def Game.read_game(gamelines)
+ gamelines.each {|l| l.chomp!}
+ game = Game.new(gamelines[0].to_i, 6, 6, 6, 6)
+ moves = []
+ gamelines[1..-2].each {|m| moves << m.to_move(game)}
+ return game, moves, gamelines[-1].to_i
+ end
+
+
+end
+
+
+# Extension to String class to convert a move-description string into a Move object.
+# This is the inverse of the Move#to_s method
+class String
+ def to_move(game)
+ move_elements = self.downcase.split
+ piece_name = move_elements[0]
+ destination_name = move_elements[-1]
+ if destination_name.length > 2 and
+ destination_name[-2,2] == game.board.centre.place[-2,2]
+ destination_name = game.board.centre.place
+ end
+ raise(InvalidMoveError, "Invalid piece in move read") unless game.pieces.has_key?(piece_name)
+ raise(InvalidMoveError, "Invalid destination in move read") unless game.board.positions.has_key?(destination_name)
+ # Deal with the synonyms for the centre position
+ via_base = (destination_name.length == 1 or move_elements.length > 2)
+ Move.new(game.pieces[piece_name], game.board.positions[destination_name], via_base)
+ end
+end
+
+
+# Read a game description file and convert it into a Game object and set of Move objects.
+# Note that Game.read_game method returns multiple values, so this one does too.
+class IO
+ def IO.read_game(filename)
+ gamelines = IO.readlines(filename)
+ return Game.read_game(gamelines)
+ end
+end
--- /dev/null
+# == Synopsis
+#
+# Play a game of Trap the Cap.
+#
+# == Author
+# Neil Smith
+#
+# == Change history
+# Version 1.1:: 23 April 2008
+
+require 'lib/libttc'
+require 'lib/libpplayer'
+
+# Play a game to completion, given a set of player agents.
+class GameHandler
+
+ attr_reader :game
+
+ # Create a game handler that uses a set of players
+ def initialize(players, limit = 5000, verbose = false, very_verbose = false)
+ @game = Game.new(players.length)
+ @verbose = verbose
+ @very_verbose = very_verbose
+ @limit = limit
+
+ # Give each player a name
+ @named_players = Hash.new
+ (@game.players.zip players).each do |kv|
+ @named_players[kv[0]] = kv[1]
+ end
+ end
+
+ # Play a game of Trap the Cap. If players make illegal moves, disqualify them and restart the game.
+ # Terminate the game if there's a winner, there's only one player left,
+ # or the game has gone on too long.
+ def play
+ while @game.history.length < @limit
+ roll = rand(6) + 1
+ move_to_apply = @named_players[@game.current_player].best_move(@game, roll)
+ puts "Move #{@game.history.length + 1}: Player #{@game.current_player} rolled #{roll}: making move #{move_to_apply}" if @verbose
+ @game.apply_moves! [move_to_apply]
+ puts @game if @very_verbose
+ end
+ puts "Game terminated after #{@game.history.length} moves" if @verbose
+ [:draw, @limit]
+ rescue GameWonNotice => win_notification
+ winner = win_notification.message[-1,1]
+ puts "Game won by #{winner} in #{@game.history.length} moves" if @verbose
+ [@named_players[winner], @game.history.length]
+ rescue InvalidCaptureError, InvalidMoveError
+ puts "Disqualifying player #{@game.current_player}" if @verbose
+ @named_players.delete @game.current_player
+ if @named_players.length > 1
+ retry
+ else
+ puts "Game won by #{@named_players.keys[0]} by default" if @verbose
+ [@named_players[@named_players.keys[0]], 0]
+ end
+ end
+end
+
\ No newline at end of file
--- /dev/null
+# == Synopsis
+#
+# Play a game of Trap the Cap.
+#
+# == Author
+# Neil Smith
+#
+# == Change history
+# Version 1.1:: 23 April 2008
+
+require 'lib/libttc'
+require 'lib/libpplayer'
+
+# Play a game to completion, given a set of player agents.
+class GameHandler
+
+ attr_reader :game
+
+ # Create a game handler that uses a set of players
+ def initialize(players, limit = 5000, verbose = false, very_verbose = false)
+ @game = Game.new(players.length)
+ @verbose = verbose
+ @very_verbose = very_verbose
+ @limit = limit
+
+ # Give each player a name
+ @named_players = Hash.new
+ (@game.players.zip players).each do |kv|
+ @named_players[kv[0]] = kv[1]
+ end
+ end
+
+ # Play a game of Trap the Cap. If players make illegal moves, disqualify them and restart the game.
+ # Terminate the game if there's a winner, there's only one player left,
+ # or the game has gone on too long.
+ def play
+ while @game.history.length < @limit
+ roll = rand(6) + 1
+ move_to_apply = @named_players[@game.current_player].best_move(@game, roll)
+ puts "Move #{@game.history.length + 1}: Player #{@game.current_player} rolled #{roll}: making move #{move_to_apply}" if @verbose
+ @game.apply_moves! [move_to_apply]
+ puts @game if @very_verbose
+ end
+ puts "Game terminated after #{@game.history.length} moves" if @verbose
+ [:draw, @limit]
+ rescue GameWonNotice => win_notification
+ winner = win_notification.message[-1,1]
+ puts "Game won by #{winner} in #{@game.history.length} moves" if @verbose
+ [@named_players[winner], @game.history.length]
+ rescue InvalidCaptureError, InvalidMoveError
+ puts "Disqualifying player #{@game.current_player}" if @verbose
+ @named_players.delete @game.current_player
+ if @named_players.length > 1
+ retry
+ else
+ puts "Game won by #{@named_players.keys[0]} by default" if @verbose
+ [@named_players[@named_players.keys[0]], 0]
+ end
+ end
+end
+
\ No newline at end of file
--- /dev/null
+3
+A1 AC2
+C4 B5
+E1 EC5
+E2 E3
+A1 EC5
+C4 B2
+4
\ No newline at end of file
--- /dev/null
+# == Synopsis
+#
+# Use a GA to breed a good potential player
+#
+# == Author
+# Neil Smith
+#
+# == Change history
+# Version 1.1:: 23 April 2008
+
+
+require 'libttc'
+require 'libpplayer'
+require 'libgenetics'
+require 'play'
+
+class Population
+ # Use tournament selection to pick an individual for the next generation
+ def tournament_select_one(winner_success_chance = 0.8, max_game_length= 1000, verbose = false)
+ player_count = rand(5) + 2
+ pool_size = @individuals.length
+ players = []
+ 1.upto(player_count) { players << @individuals[rand(pool_size)].to_potential_player }
+ game = GameHandler.new(players, max_game_length, false, false)
+ winner, length = game.play
+ puts "Winner = #{winner} in #{length} moves. Game had #{player_count} players" if verbose
+ # If the game was a draw, or the winner is unlucky, pick a parent at random
+ if winner == :draw or rand > winner_success_chance
+ successful_player = players[rand(player_count)]
+ else
+ successful_player = winner
+ end
+ successful_player
+ end
+
+ # Select a new population the same size as the current population
+ def tournament_select_population(winner_success_chance = 0.8, max_game_length = 1000, verbose = false)
+ new_population = []
+ 1.upto(@individuals.length) do
+ new_population << tournament_select_one(winner_success_chance, max_game_length, verbose).to_genome
+ puts "Created #{new_population.length} indivduals" if verbose
+ end
+ new_population
+ end
+
+end
+
+class Potential_player
+ # Convert a player to a bitstring
+ def to_bitstring
+ (@friend_pull * 4).to_i.to_bitstring(4).gray_encode +
+ (@enemy_pull * 4).to_i.to_bitstring(4).gray_encode +
+ (@base_pull * 4).to_i.to_bitstring(4).gray_encode +
+ @safe_bonus.to_bitstring(4).gray_encode +
+ @capture_bonus.to_bitstring(4).gray_encode
+ end
+
+ # Convert a player to a genome
+ def to_genome
+ Genome.new(self.to_bitstring)
+ end
+end
+
+
+class Genome
+
+ # Create a potential player from a genome
+ def to_potential_player
+ friend_pull = @genome[0, 4].gray_decode.to_decimal.to_f / 4
+ enemy_pull = @genome[4, 4].gray_decode.to_decimal.to_f / 4
+ base_pull = @genome[8, 4].gray_decode.to_decimal.to_f / 4
+ safe_bonus = @genome[12, 4].gray_decode.to_decimal
+ capture_bonus = @genome[16, 4].gray_decode.to_decimal
+ Potential_player.new({:friend_pull => friend_pull,
+ :enemy_pull => enemy_pull, :base_pull => base_pull,
+ :safe_bonus => safe_bonus, :capture_bonus => capture_bonus})
+ end
+end
--- /dev/null
+require '/home/neil/programming/ruby/programming-collective/intelligence/k-means-clustering'\r
+\r
+def read_genome_file(filename)\r
+ genomes = []\r
+ IO.foreach(filename) { |line| genomes << line.chomp.split('').collect {|i| i.to_i} }\r
+ genomes\r
+end\r
+\r
+def find_centroid_sets(rows, k = 10, n = 10)\r
+ centroid_set = []\r
+ 1.upto(n) do\r
+ centroid_set << (k_means_cluster(rows, k, :domain => :discrete) {|x, y| hamming_distance x, y})\r
+ end\r
+ centroid_set\r
+end\r
+\r
+def order_centroids_by_cluster_size(centroids, rows)\r
+ clusters = clusters_of_centroids(centroids, rows) {|x, y| hamming_distance x, y}\r
+ cluster_sizes = clusters.collect {|c| c.length}\r
+ sized_centroids = centroid.zip(cluster_sizes)\r
+ sorted_sized_centroids = (sized_centroids.sort_by {|t| t[1]}).reverse\r
+end\r
+\r
+def best_centroids(centroid_set)\r
+ centroid_set.collect {|tc| tc[0][0]}\r
+end\r
+
\ No newline at end of file
--- /dev/null
+#!/usr/bin/ruby -w
+#
+# == Synopsis
+#
+# Play one move of a Trap the Cap game
+#
+# == Usage
+# ttc [ -b | --board-size SIZE ] [ -i | --input FILE ] [ -r | --robot ROBOT ] [ -h | --help ]
+#
+# == Author
+# Neil Smith
+
+require File.join(File.dirname(__FILE__), '..', 'lib', 'libttc')
+require 'open3'
+require 'timeout'
+require 'optparse'
+require 'rdoc/usage'
+
+
+class InvalidRobotError < StandardError
+end
+
+class NoInputFileError < StandardError
+end
+
+class InvalidMoveInHistoryError < StandardError
+end
+
+class GameWonInHistoryError < StandardError
+end
+
+
+
+board = Board.new(6, 5, 6)
+puts board
+
--- /dev/null
+K 25
+svn:wc:ra_dav:version-url
+V 52
+/svn/njae/!svn/ver/65/TrapTheCap/trunk/src/cgi-files
+END
+ttc-simple.rb
+K 25
+svn:wc:ra_dav:version-url
+V 66
+/svn/njae/!svn/ver/71/TrapTheCap/trunk/src/cgi-files/ttc-simple.rb
+END
--- /dev/null
+8
+
+dir
+68
+http://scripts.njae.me.uk/svn/njae/TrapTheCap/trunk/src/cgi-files
+http://scripts.njae.me.uk/svn/njae
+
+
+
+2009-01-30T14:59:52.075953Z
+65
+
+
+
+svn:special svn:externals svn:needs-lock
+
+
+
+
+
+
+
+
+
+
+
+0ada9808-85ab-4924-adda-5bf89eae3818
+\f
+ttc-simple.rb
+file
+71
+
+
+
+2009-02-23T14:20:37.000000Z
+ba2f5d4e3bfffbcc1393e87df9638fcd
+2009-02-23T14:20:51.158868Z
+71
+
+has-props
+\f
--- /dev/null
+K 14
+svn:executable
+V 1
+*
+END
--- /dev/null
+#!/usr/bin/ruby -w
+#
+# == Synopsis
+#
+# Play one move of a Trap the Cap game
+#
+# == Usage
+# ttc [ -b | --board-size SIZE ] [ -i | --input FILE ] [ -r | --robot ROBOT ] [ -h | --help ]
+#
+# == Author
+# Neil Smith
+
+require 'libttc'
+require 'cgi'
+require 'open3'
+require 'timeout'
+
+# Prevent dangerous operations
+$SAFE = 1
+
+class InvalidRobotError < StandardError
+end
+
+class NoInputFileError < StandardError
+end
+
+class InvalidMoveInHistoryError < StandardError
+end
+
+class GameWonInHistoryError < StandardError
+end
+
+
+# A table of the known game-playing robots
+
+$ROBOT_NAME_TABLE = {
+ 'Always clockwise simple' => '/var/www/scripts.njae.me.uk/trap-the-cap/robots/1',
+ 'Clockwise cloud' => '/var/www/scripts.njae.me.uk/trap-the-cap/robots/2',
+ 'GA generation 1006' => '/var/www/scripts.njae.me.uk/trap-the-cap/robots/3'
+}
+
+$ROBOT_CODE_TABLE = {
+ '1' => '/var/www/scripts.njae.me.uk/trap-the-cap/robots/1',
+ '2' => '/var/www/scripts.njae.me.uk/trap-the-cap/robots/2',
+ '3' => '/var/www/scripts.njae.me.uk/trap-the-cap/robots/3'
+}
+
+
+# How long the robot has to respond
+$ROBOT_TIMEOUT = 10
+
+
+def generate_output(cgi, returned_move, annotation)
+ if returned_move.empty?
+ return_part = ""
+ else
+ return_part = cgi.p { "Result is: " } + "\n" + cgi.h1 { returned_move } + "\n"
+ end
+
+ if annotation.empty?
+ annotation_part = ""
+ else
+ annotation_part = cgi.p { annotation }
+ end
+
+ cgi.html {
+ cgi.head { "\n" + cgi.title{"Move result"} } + "\n" +
+ cgi.body { return_part + annotation_part }
+ }
+end
+
+
+begin
+
+ cgi = CGI.new("html4")
+
+ chosen_robot = cgi['robot']
+ if $ROBOT_NAME_TABLE.has_key? chosen_robot
+ chosen_robot_dir = $ROBOT_NAME_TABLE[chosen_robot]
+ chosen_robot_dir.untaint
+ else
+ raise InvalidRobotError, "#{chosen_robot} is not a valid robot code"
+ end
+
+ begin
+ game, moves, next_roll = Game.read_game(cgi['moves'].downcase.split("\n"))
+ game.apply_moves! moves
+ rescue InvalidMoveError => error
+ raise(InvalidMoveInHistoryError, error.message)
+ rescue GameWonNotice => error
+ raise(GameWonInHistoryError, error.message)
+ end
+
+ current_directory = Dir.pwd
+ current_directory.untaint
+ Dir.chdir chosen_robot_dir
+
+ returned_move = ""
+ returned_error = ""
+ robot_input = game.players.length.to_s + "\n"
+ robot_input += (moves.collect {|m| m.to_s}).join("\n") + "\n" if not moves.empty?
+ robot_input += next_roll.to_s
+
+# cgi.out { generate_output(cgi, "", "passing robot #{game.players.length.to_s + "#" + (moves.collect {|m| m.to_s}).join('!\n!') + "#" + next_roll.to_s}!") }
+# cgi.out { generate_output(cgi, "", "passing robot #{robot_input}!") }
+
+
+ Timeout.timeout($ROBOT_TIMEOUT + 1) do
+ Open3.popen3('./runme') do |robot_in, robot_out, robot_err|
+ robot_in << robot_input
+ robot_in.close_write
+ returned_move = robot_out.gets
+ returned_error = robot_err.gets
+ end
+ end
+
+ Dir.chdir current_directory
+
+# cgi.out { generate_output(cgi, "", "Returned move #{returned_move}; robot error was #{returned_error}!") }
+
+ raise(InvalidMoveError, "Robot returned error '#{returned_error}'") if returned_error != nil
+ raise(InvalidMoveError, "Null move") if returned_move.nil? or returned_move.empty?
+ next_move = returned_move.chomp.to_move(game)
+ game.apply_move! next_move
+
+# cgi.out { generate_output(cgi, "", "Applied move #{returned_move}!") }
+ cgi.out { generate_output(cgi, returned_move, "") }
+
+rescue InvalidMoveInHistoryError => error
+ cgi.out { generate_output(cgi, "", "Invalid move in history: #{error}") }
+# puts "Invalid move in history: #{error}"
+rescue GameWonInHistoryError => error
+ cgi.out { generate_output(cgi, "", "Game already won in historic moves: #{error}") }
+# puts "Game already won in historic moves: #{error}"
+
+rescue InvalidMoveError => error
+ cgi.out { generate_output(cgi, "", "Robot returned invalid move: #{error}") }
+# puts "Robot returned invalid move: #{error}"
+rescue GameWonNotice => error
+ cgi.out { generate_output(cgi, returned_move, "Game won: #{error}") }
+# puts "Robot returned #{returned_move}"
+# puts "Game won: #{error}"
+
+rescue InvalidRobotError => error
+ cgi.out { generate_output(cgi, "", "Invalid robot selection: #{error}") }
+# puts "Invalid robot selection: #{error}"
+rescue Timeout::Error => error
+ cgi.out { generate_output(cgi, "", "Robot timed out") }
+# puts "Robot timeout: #{error}"
+
+end
--- /dev/null
+#!/usr/bin/ruby -w
+#
+# == Synopsis
+#
+# Play one move of a Trap the Cap game
+#
+# == Usage
+# ttc [ -b | --board-size SIZE ] [ -i | --input FILE ] [ -r | --robot ROBOT ] [ -h | --help ]
+#
+# == Author
+# Neil Smith
+
+require 'libttc'
+require 'cgi'
+require 'open3'
+require 'timeout'
+
+# Prevent dangerous operations
+$SAFE = 1
+
+class InvalidRobotError < StandardError
+end
+
+class NoInputFileError < StandardError
+end
+
+class InvalidMoveInHistoryError < StandardError
+end
+
+class GameWonInHistoryError < StandardError
+end
+
+
+# A table of the known game-playing robots
+
+$ROBOT_NAME_TABLE = {
+ 'Always clockwise simple' => '/var/www/scripts.njae.me.uk/trap-the-cap/robots/1',
+ 'Clockwise cloud' => '/var/www/scripts.njae.me.uk/trap-the-cap/robots/2',
+ 'GA generation 1006' => '/var/www/scripts.njae.me.uk/trap-the-cap/robots/3'
+}
+
+$ROBOT_CODE_TABLE = {
+ '1' => '/var/www/scripts.njae.me.uk/trap-the-cap/robots/1',
+ '2' => '/var/www/scripts.njae.me.uk/trap-the-cap/robots/2',
+ '3' => '/var/www/scripts.njae.me.uk/trap-the-cap/robots/3'
+}
+
+
+# How long the robot has to respond
+$ROBOT_TIMEOUT = 10
+
+
+def generate_output(cgi, returned_move, annotation)
+ if returned_move.empty?
+ return_part = ""
+ else
+ return_part = cgi.p { "Result is: " } + "\n" + cgi.h1 { returned_move } + "\n"
+ end
+
+ if annotation.empty?
+ annotation_part = ""
+ else
+ annotation_part = cgi.p { annotation }
+ end
+
+ cgi.html {
+ cgi.head { "\n" + cgi.title{"Move result"} } + "\n" +
+ cgi.body { return_part + annotation_part }
+ }
+end
+
+
+begin
+
+ cgi = CGI.new("html4")
+
+ chosen_robot = cgi['robot']
+ if $ROBOT_NAME_TABLE.has_key? chosen_robot
+ chosen_robot_dir = $ROBOT_NAME_TABLE[chosen_robot]
+ chosen_robot_dir.untaint
+ else
+ raise InvalidRobotError, "#{chosen_robot} is not a valid robot code"
+ end
+
+ begin
+ game, moves, next_roll = Game.read_game(cgi['moves'].downcase.split("\n"))
+ game.apply_moves! moves
+ rescue InvalidMoveError => error
+ raise(InvalidMoveInHistoryError, error.message)
+ rescue GameWonNotice => error
+ raise(GameWonInHistoryError, error.message)
+ end
+
+ current_directory = Dir.pwd
+ current_directory.untaint
+ Dir.chdir chosen_robot_dir
+
+ returned_move = ""
+ returned_error = ""
+ robot_input = game.players.length.to_s + "\n"
+ robot_input += (moves.collect {|m| m.to_s}).join("\n") + "\n" if not moves.empty?
+ robot_input += next_roll.to_s
+
+# cgi.out { generate_output(cgi, "", "passing robot #{game.players.length.to_s + "#" + (moves.collect {|m| m.to_s}).join('!\n!') + "#" + next_roll.to_s}!") }
+# cgi.out { generate_output(cgi, "", "passing robot #{robot_input}!") }
+
+
+ Timeout.timeout($ROBOT_TIMEOUT + 1) do
+ Open3.popen3('./runme') do |robot_in, robot_out, robot_err|
+ robot_in << robot_input
+ robot_in.close_write
+ returned_move = robot_out.gets
+ returned_error = robot_err.gets
+ end
+ end
+
+ Dir.chdir current_directory
+
+# cgi.out { generate_output(cgi, "", "Returned move #{returned_move}; robot error was #{returned_error}!") }
+
+ raise(InvalidMoveError, "Robot returned error '#{returned_error}'") if returned_error != nil
+ raise(InvalidMoveError, "Null move") if returned_move.nil? or returned_move.empty?
+ next_move = returned_move.chomp.to_move(game)
+ game.apply_move! next_move
+
+# cgi.out { generate_output(cgi, "", "Applied move #{returned_move}!") }
+ cgi.out { generate_output(cgi, returned_move, "") }
+
+rescue InvalidMoveInHistoryError => error
+ cgi.out { generate_output(cgi, "", "Invalid move in history: #{error}") }
+# puts "Invalid move in history: #{error}"
+rescue GameWonInHistoryError => error
+ cgi.out { generate_output(cgi, "", "Game already won in historic moves: #{error}") }
+# puts "Game already won in historic moves: #{error}"
+
+rescue InvalidMoveError => error
+ cgi.out { generate_output(cgi, "", "Robot returned invalid move: #{error}") }
+# puts "Robot returned invalid move: #{error}"
+rescue GameWonNotice => error
+ cgi.out { generate_output(cgi, returned_move, "Game won: #{error}") }
+# puts "Robot returned #{returned_move}"
+# puts "Game won: #{error}"
+
+rescue InvalidRobotError => error
+ cgi.out { generate_output(cgi, "", "Invalid robot selection: #{error}") }
+# puts "Invalid robot selection: #{error}"
+rescue Timeout::Error => error
+ cgi.out { generate_output(cgi, "", "Robot timed out") }
+# puts "Robot timeout: #{error}"
+
+end
--- /dev/null
+#!/usr/bin/ruby
+#
+# == Synopsis
+#
+# Play one move of a Trap the Cap game
+#
+# == Usage
+# clockwise-p1
+# Game state file read on STDIN
+# Move produced on STDOUT
+#
+# == Author
+# Neil Smith
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+require 'libttc'
+
+def more_clockwise(this, other)
+ here = this.place
+ there = other.place
+
+ # if both are on a spoke, choose the one with the lowest number (nearer the rim)
+ if here =~ /.c./ and there =~ /.c./
+ # break ties by preferring the most clockwise arc
+ if here[-1] == there[-1]
+ return here[0] <=> there[0]
+ else
+ return -1 * (here[-1] <=> there[-1])
+ end
+ # If one is one a spoke and the other is on the rim, choose the one on the rim
+ elsif here =~ /.c./ or there =~ /.c./
+ return -1 * (here.length <=> there.length)
+ # If one is in the 'f' rim section and the other in the 'a' rim section, choose the 'a'
+ elsif here[0,1] == 'a' and there[0,1] == 'f'
+ return +1
+ elsif here[0,1] == 'f' and there[0,1] == 'a'
+ return -1
+ # Otherwise, choose the one with highest arc code
+ else
+ return here <=> there
+ end
+
+end
+
+# Get the current game state
+game_lines = readlines
+game, moves, next_roll = Game.read_game(game_lines)
+game.apply_moves moves
+
+
+# The piece to move is the least clockwise of my uncaptured pieces
+# Always move pieces on the base first
+my_pieces = game.pieces.values.select {|p| p.colour == game.current_player and not p.captured}
+piece_to_move = (my_pieces.sort {|x, y| more_clockwise x.position, y.position})[0]
+
+# Find the most clockwise move for this piece
+potential_moves = game.possible_moves(next_roll).select {|m| m.piece == piece_to_move}
+sorted_moves = potential_moves.sort {|x, y| more_clockwise x.destination, y.destination}
+best_move = sorted_moves[-1]
+
+# return that move
+puts best_move
+
+
--- /dev/null
+#!/usr/bin/ruby
+#
+# == Synopsis
+#
+# Play one move of a Trap the Cap game
+#
+# == Usage
+# clockwise-p1
+# Game state file read on STDIN
+# Move produced on STDOUT
+#
+# == Author
+# Neil Smith
+
+
+require 'libttc'
+require 'rdoc/usage'
+
+def more_clockwise(this, other)
+ here = this.destination.place
+ there = other.destination.place
+
+ # if both are on a spoke, choose the one with the lowest number (nearer the rim)
+ if here =~ /.c./ and there =~ /.c./
+ # break ties by preferring the most clockwise arc
+ if here[-1] == there[-1]
+ return here[0] <=> there[0]
+ else
+ return -1 * (here[-1] <=> there[-1])
+ end
+ # If one is one a spoke and the other is on the rim, choose the one on the rim
+ elsif here =~ /.c./ or there =~ /.c./
+ return -1 * (here.length <=> there.length)
+ # If one is in the 'f' rim section and the other in the 'a' rim section, choose the 'a'
+ elsif here[0,1] == 'a' and there[0,1] == 'f'
+ return +1
+ elsif here[0,1] == 'f' and there[0,1] == 'a'
+ return -1
+ # Otherwise, choose the one with highest arc code
+ else
+ return here <=> there
+ end
+
+end
+
+# Get the current game state
+game_lines = readlines
+game, moves, next_roll = Game.read_game(game_lines)
+game.apply_moves moves
+
+# The piece to move is the uncaptured one of mine with the lowest number
+my_pieces = game.pieces.values.select {|p| p.colour == game.current_player and not p.captured}
+piece_to_move = (my_pieces.sort_by {|p| p.name})[0]
+
+# find the most clockwise move
+potential_moves = game.possible_moves(next_roll).select {|m| m.piece == piece_to_move}
+sorted_moves = potential_moves.sort {|x, y| more_clockwise x, y}
+best_move = sorted_moves[-1]
+
+# return that move
+puts best_move
+
+
--- /dev/null
+[[0,0,0,0,0,1,0,0,1,1,1,0,1,1,1,1,0,0,1,1], 16]
+[[0,0,1,0,0,0,0,0,0,1,0,1,1,1,0,1,0,0,1,1], 17]
+[[0,0,0,0,0,0,0,1,0,0,1,0,0,1,0,1,0,0,1,1], 19]
+[[0,0,0,0,1,0,1,1,0,1,1,1,0,1,1,1,1,0,0,1], 20]
+[[0,0,0,0,0,0,1,0,1,0,1,1,0,0,1,1,0,1,0,1], 22]
+[[0,0,0,0,0,0,1,0,1,0,0,0,1,0,0,1,0,1,1,0], 27]
+[[0,0,0,0,0,1,0,0,0,0,1,0,1,0,0,0,1,1,1,0], 31]
+[[0,0,0,1,0,0,1,0,0,0,0,1,1,0,0,0,1,1,1,1], 43]
+[[0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,1,0], 65]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,1,1], 140]
+--
+[[0,0,0,1,0,0,1,0,1,1,0,0,1,0,0,1,0,0,1,1], 19]
+[[0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,1,1,0], 26]
+[[0,0,0,1,0,1,1,0,0,0,1,1,1,0,0,0,1,1,0,0], 29]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,0,1,0], 29]
+[[0,0,0,0,0,0,0,1,0,1,1,1,1,0,0,0,1,1,1,1], 29]
+[[0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,1,0,0], 29]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0], 45]
+[[0,0,0,0,0,0,0,1,0,0,1,0,0,1,1,1,0,0,0,1], 48]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1,1], 65]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,1,0], 81]
+--
+[[0,1,0,0,1,1,1,0,1,1,0,1,0,1,0,1,0,1,0,1], 10]
+[[0,0,0,0,0,0,1,0,1,1,1,0,0,0,1,1,1,0,1,0], 17]
+[[0,0,0,0,1,0,1,0,0,0,0,0,1,1,1,1,1,0,0,0], 20]
+[[0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,0,1,1,1], 31]
+[[0,0,0,1,0,1,1,1,0,0,1,1,1,0,0,0,1,1,1,0], 34]
+[[0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,1,1], 38]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,1,1], 40]
+[[0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,1,0,0,0], 56]
+[[0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,1,1], 73]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0], 81]
+--
+[[0,0,0,0,0,0,1,0,1,0,1,0,1,0,1,0,0,1,0,0], 17]
+[[0,0,0,0,0,0,1,1,0,0,0,0,1,0,0,0,1,1,1,1], 23]
+[[0,1,0,1,0,1,1,0,1,0,0,1,1,0,0,0,1,0,1,0], 26]
+[[0,0,0,0,1,0,0,1,0,0,1,0,1,1,0,0,0,0,1,0], 29]
+[[0,0,0,0,0,0,0,0,0,1,1,1,1,0,1,1,1,0,0,0], 29]
+[[0,0,0,0,0,0,1,0,1,0,0,0,0,1,1,1,0,1,1,0], 35]
+[[0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,1,0,0,0], 49]
+[[0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,0,0,1,0], 51]
+[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1], 67]
+[[0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1], 74]
+--
+[[0,0,1,0,0,1,0,0,0,1,0,1,0,0,0,0,1,0,1,1], 12]
+[[0,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,0,1,1], 15]
+[[0,0,0,0,0,0,0,1,0,1,1,0,1,0,0,1,0,0,1,1], 23]
+[[0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,1,0,0,1], 26]
+[[0,0,0,1,0,1,1,0,0,0,0,1,1,0,0,0,1,1,1,0], 33]
+[[0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,1,0,1,0,0], 39]
+[[0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,0,0,1,0], 45]
+[[0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,1], 54]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,1,1,1], 58]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0], 95]
+--
+[[0,0,0,1,1,0,1,1,0,1,1,1,1,1,0,1,1,0,1,1], 16]
+[[0,1,0,1,0,1,0,0,0,0,1,1,1,0,1,0,0,0,1,1], 20]
+[[0,0,0,0,0,1,0,0,0,0,0,0,1,0,1,1,0,1,0,0], 23]
+[[0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,1,0,0,1], 26]
+[[0,0,0,1,0,0,1,1,0,0,0,0,1,0,0,0,0,1,0,0], 39]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0], 46]
+[[0,0,0,0,0,0,0,0,0,1,0,1,1,1,0,1,0,1,0,1], 48]
+[[0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,1,0,0,0], 49]
+[[0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,1,1], 64]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,1,1], 69]
+--
+[[1,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,1,0,1,1], 8]
+[[0,0,1,0,0,0,1,0,1,0,0,0,1,0,1,1,1,1,1,1], 16]
+[[0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,1,0,1,1,1], 22]
+[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1], 27]
+[[0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,1,0], 29]
+[[0,0,0,0,0,1,0,0,0,0,1,0,1,0,0,0,0,0,0,0], 40]
+[[0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,1,1,0], 48]
+[[0,0,0,0,0,0,0,1,0,0,0,0,1,1,1,1,1,0,0,1], 51]
+[[0,0,0,0,0,0,0,0,0,1,0,0,1,0,1,0,0,1,0,0], 58]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,1,0], 101]
+--
+[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1], 20]
+[[0,0,0,0,0,0,0,1,1,0,0,1,1,1,0,0,0,0,1,0], 25]
+[[0,1,0,1,1,1,0,0,0,0,1,0,1,0,0,0,1,0,1,0], 26]
+[[0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,0,0,0,0], 28]
+[[0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,1,1], 35]
+[[0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,0,1,1,0], 38]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,0], 48]
+[[0,0,0,0,0,0,1,0,0,0,0,0,1,1,1,1,1,1,0,0], 55]
+[[0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,1,1], 57]
+[[0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,1], 68]
+--
+[[0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,0], 0]
+[[0,0,0,0,1,1,1,0,0,0,0,0,0,1,1,1,1,0,0,1], 13]
+[[0,0,0,1,0,1,1,0,0,0,1,1,1,0,0,0,1,0,1,0], 22]
+[[0,0,0,0,0,0,0,1,0,0,0,0,1,0,1,1,1,1,0,0], 26]
+[[0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,1], 33]
+[[0,0,0,0,0,0,1,0,1,0,1,0,0,0,1,0,1,1,0,0], 33]
+[[0,0,0,0,0,0,0,0,1,0,0,0,1,1,1,1,0,0,1,1], 58]
+[[0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,1,1,0], 64]
+[[0,0,0,0,0,0,0,1,0,0,1,0,1,1,0,1,0,0,1,1], 75]
+[[0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,0], 76]
+--
+[[0,0,1,0,0,0,1,0,1,0,0,0,0,1,1,1,1,1,1,1], 12]
+[[0,0,0,0,1,0,1,0,1,0,1,0,0,1,1,1,1,0,1,1], 15]
+[[0,0,0,1,1,0,0,1,0,1,1,1,1,0,0,1,0,0,1,1], 16]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,1,1], 21]
+[[0,0,0,0,0,0,0,0,1,0,0,0,1,1,0,0,0,0,1,0], 26]
+[[0,0,0,1,0,0,1,0,0,0,0,1,1,0,0,0,0,1,1,0], 27]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,1], 47]
+[[0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,0], 55]
+[[0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0,1,0], 61]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,1,1], 120]
+--
+[[0,1,0,1,1,1,0,0,0,1,1,0,1,1,1,1,0,0,0,0], 11]
+[[0,0,0,0,1,1,0,0,1,0,1,0,1,0,0,0,1,0,1,0], 14]
+[[0,0,0,0,0,0,1,0,0,0,1,1,0,1,0,1,1,0,1,1], 21]
+[[0,0,0,0,0,0,0,1,0,1,1,1,1,0,0,0,0,1,1,1], 21]
+[[0,0,0,1,0,0,1,0,0,0,0,0,1,1,1,1,0,1,1,0], 28]
+[[0,0,0,0,0,0,0,0,0,1,0,0,1,1,1,1,1,0,0,1], 28]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,0], 40]
+[[0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,1,1,0], 65]
+[[0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,0,0,1,1], 84]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,1,1], 88]
+--
+[[0,0,1,0,0,0,1,0,1,1,0,0,1,0,0,0,0,1,1,0], 18]
+[[0,0,0,1,1,1,0,0,0,0,1,0,1,0,0,0,1,0,1,0], 21]
+[[0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,0,0,1,0], 28]
+[[0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,1,1,1], 36]
+[[0,0,0,0,0,1,0,0,1,0,0,0,1,1,0,1,0,0,1,1], 37]
+[[0,0,0,0,0,0,1,1,0,0,0,0,1,0,0,1,0,0,0,1], 39]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,1,0,1], 42]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0], 54]
+[[0,0,0,0,0,0,0,0,0,1,0,0,0,1,1,1,0,0,1,1], 56]
+[[0,0,0,0,0,0,1,0,0,0,0,1,1,1,1,1,0,0,1,0], 69]
+--
+[[0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,1,1,0], 10]
+[[0,0,0,0,0,0,0,0,1,0,0,0,1,1,1,0,0,1,1,1], 28]
+[[0,1,0,0,0,0,1,0,0,0,0,1,1,0,0,0,1,1,1,0], 29]
+[[0,0,0,0,0,1,0,0,0,0,0,1,0,1,1,1,0,1,0,1], 31]
+[[0,0,0,0,1,1,0,0,0,1,1,1,1,0,0,0,1,0,1,0], 31]
+[[0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,1,0], 36]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,1], 36]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,1,1,0], 42]
+[[0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,1,0,0,1,0], 58]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,1,1], 99]
+--
+[[0,0,0,0,0,1,0,0,1,1,1,0,1,1,1,1,0,0,1,1], 16] [[0,0,1,0,0,0,0,0,0,1,0,1,1,1,0,1,0,0,1,1], 17] [[0,0,0,0,0,0,0,1,0,0,1,0,0,1,0,1,0,0,1,1], 19] [[0,0,0,0,1,0,1,1,0,1,1,1,0,1,1,1,1,0,0,1], 20] [[0,0,0,0,0,0,1,0,1,0,1,1,0,0,1,1,0,1,0,1], 22] [[0,0,0,0,0,0,1,0,1,0,0,0,1,0,0,1,0,1,1,0], 27] [[0,0,0,0,0,1,0,0,0,0,1,0,1,0,0,0,1,1,1,0], 31] [[0,0,0,1,0,0,1,0,0,0,0,1,1,0,0,0,1,1,1,1], 43] [[0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,1,0], 65] [[0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,1,1], 140]
+[[0,0,0,1,0,0,1,0,1,1,0,0,1,0,0,1,0,0,1,1], 19] [[0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,1,1,0], 26] [[0,0,0,1,0,1,1,0,0,0,1,1,1,0,0,0,1,1,0,0], 29] [[0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,0,1,0], 29] [[0,0,0,0,0,0,0,1,0,1,1,1,1,0,0,0,1,1,1,1], 29] [[0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,1,0,0], 29] [[0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0], 45] [[0,0,0,0,0,0,0,1,0,0,1,0,0,1,1,1,0,0,0,1], 48] [[0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1,1], 65] [[0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,1,0], 81]
+[[0,1,0,0,1,1,1,0,1,1,0,1,0,1,0,1,0,1,0,1], 10] [[0,0,0,0,0,0,1,0,1,1,1,0,0,0,1,1,1,0,1,0], 17] [[0,0,0,0,1,0,1,0,0,0,0,0,1,1,1,1,1,0,0,0], 20] [[0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,0,1,1,1], 31] [[0,0,0,1,0,1,1,1,0,0,1,1,1,0,0,0,1,1,1,0], 34] [[0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,1,1], 38] [[0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,1,1], 40] [[0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,1,0,0,0], 56] [[0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,1,1], 73] [[0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0], 81]
+[[0,0,0,0,0,0,1,0,1,0,1,0,1,0,1,0,0,1,0,0], 17] [[0,0,0,0,0,0,1,1,0,0,0,0,1,0,0,0,1,1,1,1], 23] [[0,1,0,1,0,1,1,0,1,0,0,1,1,0,0,0,1,0,1,0], 26] [[0,0,0,0,1,0,0,1,0,0,1,0,1,1,0,0,0,0,1,0], 29] [[0,0,0,0,0,0,0,0,0,1,1,1,1,0,1,1,1,0,0,0], 29] [[0,0,0,0,0,0,1,0,1,0,0,0,0,1,1,1,0,1,1,0], 35] [[0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,1,0,0,0], 49] [[0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,0,0,1,0], 51] [[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1], 67] [[0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1], 74]
+[[0,0,1,0,0,1,0,0,0,1,0,1,0,0,0,0,1,0,1,1], 12] [[0,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,0,1,1], 15] [[0,0,0,0,0,0,0,1,0,1,1,0,1,0,0,1,0,0,1,1], 23] [[0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,1,0,0,1], 26] [[0,0,0,1,0,1,1,0,0,0,0,1,1,0,0,0,1,1,1,0], 33] [[0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,1,0,1,0,0], 39] [[0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,0,0,1,0], 45] [[0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,1], 54] [[0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,1,1,1], 58] [[0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0], 95]
+[[0,0,0,1,1,0,1,1,0,1,1,1,1,1,0,1,1,0,1,1], 16] [[0,1,0,1,0,1,0,0,0,0,1,1,1,0,1,0,0,0,1,1], 20] [[0,0,0,0,0,1,0,0,0,0,0,0,1,0,1,1,0,1,0,0], 23] [[0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,1,0,0,1], 26] [[0,0,0,1,0,0,1,1,0,0,0,0,1,0,0,0,0,1,0,0], 39] [[0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0], 46] [[0,0,0,0,0,0,0,0,0,1,0,1,1,1,0,1,0,1,0,1], 48] [[0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,1,0,0,0], 49] [[0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,1,1], 64] [[0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,1,1], 69]
+[[1,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,1,0,1,1], 8] [[0,0,1,0,0,0,1,0,1,0,0,0,1,0,1,1,1,1,1,1], 16] [[0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,1,0,1,1,1], 22] [[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1], 27] [[0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,1,0], 29] [[0,0,0,0,0,1,0,0,0,0,1,0,1,0,0,0,0,0,0,0], 40] [[0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,1,1,0], 48] [[0,0,0,0,0,0,0,1,0,0,0,0,1,1,1,1,1,0,0,1], 51] [[0,0,0,0,0,0,0,0,0,1,0,0,1,0,1,0,0,1,0,0], 58] [[0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,1,0], 101]
+[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1], 20] [[0,0,0,0,0,0,0,1,1,0,0,1,1,1,0,0,0,0,1,0], 25] [[0,1,0,1,1,1,0,0,0,0,1,0,1,0,0,0,1,0,1,0], 26] [[0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,0,0,0,0], 28] [[0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,1,1], 35] [[0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,0,1,1,0], 38] [[0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,0], 48] [[0,0,0,0,0,0,1,0,0,0,0,0,1,1,1,1,1,1,0,0], 55] [[0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,1,1], 57] [[0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,1], 68]
+[[0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,0], 0] [[0,0,0,0,1,1,1,0,0,0,0,0,0,1,1,1,1,0,0,1], 13] [[0,0,0,1,0,1,1,0,0,0,1,1,1,0,0,0,1,0,1,0], 22] [[0,0,0,0,0,0,0,1,0,0,0,0,1,0,1,1,1,1,0,0], 26] [[0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,1], 33] [[0,0,0,0,0,0,1,0,1,0,1,0,0,0,1,0,1,1,0,0], 33] [[0,0,0,0,0,0,0,0,1,0,0,0,1,1,1,1,0,0,1,1], 58] [[0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,1,1,0], 64] [[0,0,0,0,0,0,0,1,0,0,1,0,1,1,0,1,0,0,1,1], 75] [[0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,0], 76]
+[[0,0,1,0,0,0,1,0,1,0,0,0,0,1,1,1,1,1,1,1], 12] [[0,0,0,0,1,0,1,0,1,0,1,0,0,1,1,1,1,0,1,1], 15] [[0,0,0,1,1,0,0,1,0,1,1,1,1,0,0,1,0,0,1,1], 16] [[0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,1,1], 21] [[0,0,0,0,0,0,0,0,1,0,0,0,1,1,0,0,0,0,1,0], 26] [[0,0,0,1,0,0,1,0,0,0,0,1,1,0,0,0,0,1,1,0], 27] [[0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,1], 47] [[0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,0], 55] [[0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0,1,0], 61] [[0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,1,1], 120]
+[[0,1,0,1,1,1,0,0,0,1,1,0,1,1,1,1,0,0,0,0], 11] [[0,0,0,0,1,1,0,0,1,0,1,0,1,0,0,0,1,0,1,0], 14] [[0,0,0,0,0,0,1,0,0,0,1,1,0,1,0,1,1,0,1,1], 21] [[0,0,0,0,0,0,0,1,0,1,1,1,1,0,0,0,0,1,1,1], 21] [[0,0,0,1,0,0,1,0,0,0,0,0,1,1,1,1,0,1,1,0], 28] [[0,0,0,0,0,0,0,0,0,1,0,0,1,1,1,1,1,0,0,1], 28] [[0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,0], 40] [[0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,1,1,0], 65] [[0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,0,0,1,1], 84] [[0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,1,1], 88]
+[[0,0,1,0,0,0,1,0,1,1,0,0,1,0,0,0,0,1,1,0], 18] [[0,0,0,1,1,1,0,0,0,0,1,0,1,0,0,0,1,0,1,0], 21] [[0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,0,0,1,0], 28] [[0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,1,1,1], 36] [[0,0,0,0,0,1,0,0,1,0,0,0,1,1,0,1,0,0,1,1], 37] [[0,0,0,0,0,0,1,1,0,0,0,0,1,0,0,1,0,0,0,1], 39] [[0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,1,0,1], 42] [[0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0], 54] [[0,0,0,0,0,0,0,0,0,1,0,0,0,1,1,1,0,0,1,1], 56] [[0,0,0,0,0,0,1,0,0,0,0,1,1,1,1,1,0,0,1,0], 69]
+[[0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,1,1,0], 10] [[0,0,0,0,0,0,0,0,1,0,0,0,1,1,1,0,0,1,1,1], 28] [[0,1,0,0,0,0,1,0,0,0,0,1,1,0,0,0,1,1,1,0], 29] [[0,0,0,0,0,1,0,0,0,0,0,1,0,1,1,1,0,1,0,1], 31] [[0,0,0,0,1,1,0,0,0,1,1,1,1,0,0,0,1,0,1,0], 31] [[0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,1,0], 36] [[0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,1], 36] [[0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,1,1,0], 42] [[0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,1,0,0,1,0], 58] [[0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,1,1], 99]
--- /dev/null
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,1,1], 140] [[0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,1,0], 65] [[0,0,0,1,0,0,1,0,0,0,0,1,1,0,0,0,1,1,1,1], 43] [[0,0,0,0,0,1,0,0,0,0,1,0,1,0,0,0,1,1,1,0], 31] [[0,0,0,0,0,0,1,0,1,0,0,0,1,0,0,1,0,1,1,0], 27] [[0,0,0,0,0,0,1,0,1,0,1,1,0,0,1,1,0,1,0,1], 22] [[0,0,0,0,1,0,1,1,0,1,1,1,0,1,1,1,1,0,0,1], 20] [[0,0,0,0,0,0,0,1,0,0,1,0,0,1,0,1,0,0,1,1], 19] [[0,0,1,0,0,0,0,0,0,1,0,1,1,1,0,1,0,0,1,1], 17] [[0,0,0,0,0,1,0,0,1,1,1,0,1,1,1,1,0,0,1,1], 16]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,1,0], 81] [[0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1,1], 65] [[0,0,0,0,0,0,0,1,0,0,1,0,0,1,1,1,0,0,0,1], 48] [[0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0], 45] [[0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,1,0,0], 29] [[0,0,0,0,0,0,0,1,0,1,1,1,1,0,0,0,1,1,1,1], 29] [[0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,0,1,0], 29] [[0,0,0,1,0,1,1,0,0,0,1,1,1,0,0,0,1,1,0,0], 29] [[0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1,0,1,1,0], 26] [[0,0,0,1,0,0,1,0,1,1,0,0,1,0,0,1,0,0,1,1], 19]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0], 81] [[0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,1,1], 73] [[0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,1,0,0,0], 56] [[0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,1,1], 40] [[0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,1,1], 38] [[0,0,0,1,0,1,1,1,0,0,1,1,1,0,0,0,1,1,1,0], 34] [[0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,0,1,1,1], 31] [[0,0,0,0,1,0,1,0,0,0,0,0,1,1,1,1,1,0,0,0], 20] [[0,0,0,0,0,0,1,0,1,1,1,0,0,0,1,1,1,0,1,0], 17] [[0,1,0,0,1,1,1,0,1,1,0,1,0,1,0,1,0,1,0,1], 10]
+[[0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1], 74] [[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,1], 67] [[0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,0,0,1,0], 51] [[0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,1,0,0,0], 49] [[0,0,0,0,0,0,1,0,1,0,0,0,0,1,1,1,0,1,1,0], 35] [[0,0,0,0,0,0,0,0,0,1,1,1,1,0,1,1,1,0,0,0], 29] [[0,0,0,0,1,0,0,1,0,0,1,0,1,1,0,0,0,0,1,0], 29] [[0,1,0,1,0,1,1,0,1,0,0,1,1,0,0,0,1,0,1,0], 26] [[0,0,0,0,0,0,1,1,0,0,0,0,1,0,0,0,1,1,1,1], 23] [[0,0,0,0,0,0,1,0,1,0,1,0,1,0,1,0,0,1,0,0], 17]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0], 95] [[0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,1,1,1], 58] [[0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,1], 54] [[0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,0,0,1,0], 45] [[0,0,0,0,0,0,1,0,1,0,1,0,0,0,0,1,0,1,0,0], 39] [[0,0,0,1,0,1,1,0,0,0,0,1,1,0,0,0,1,1,1,0], 33] [[0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,1,0,0,1], 26] [[0,0,0,0,0,0,0,1,0,1,1,0,1,0,0,1,0,0,1,1], 23] [[0,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,0,1,1], 15] [[0,0,1,0,0,1,0,0,0,1,0,1,0,0,0,0,1,0,1,1], 12]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,1,1], 69] [[0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,1,1], 64] [[0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,1,0,0,0], 49] [[0,0,0,0,0,0,0,0,0,1,0,1,1,1,0,1,0,1,0,1], 48] [[0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0], 46] [[0,0,0,1,0,0,1,1,0,0,0,0,1,0,0,0,0,1,0,0], 39] [[0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,1,0,0,1], 26] [[0,0,0,0,0,1,0,0,0,0,0,0,1,0,1,1,0,1,0,0], 23] [[0,1,0,1,0,1,0,0,0,0,1,1,1,0,1,0,0,0,1,1], 20] [[0,0,0,1,1,0,1,1,0,1,1,1,1,1,0,1,1,0,1,1], 16]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,1,0], 101] [[0,0,0,0,0,0,0,0,0,1,0,0,1,0,1,0,0,1,0,0], 58] [[0,0,0,0,0,0,0,1,0,0,0,0,1,1,1,1,1,0,0,1], 51] [[0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,0,1,1,0], 48] [[0,0,0,0,0,1,0,0,0,0,1,0,1,0,0,0,0,0,0,0], 40] [[0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,1,0], 29] [[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1], 27] [[0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,1,0,1,1,1], 22] [[0,0,1,0,0,0,1,0,1,0,0,0,1,0,1,1,1,1,1,1], 16] [[1,0,0,1,1,1,1,1,1,1,1,1,1,1,0,0,1,0,1,1], 8]
+[[0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,1], 68] [[0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,0,0,0,1,1], 57] [[0,0,0,0,0,0,1,0,0,0,0,0,1,1,1,1,1,1,0,0], 55] [[0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,0], 48] [[0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,0,1,1,0], 38] [[0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,1,1], 35] [[0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,0,0,0,0], 28] [[0,1,0,1,1,1,0,0,0,0,1,0,1,0,0,0,1,0,1,0], 26] [[0,0,0,0,0,0,0,1,1,0,0,1,1,1,0,0,0,0,1,0], 25] [[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1], 20]
+[[0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,0], 76] [[0,0,0,0,0,0,0,1,0,0,1,0,1,1,0,1,0,0,1,1], 75] [[0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,1,1,0], 64] [[0,0,0,0,0,0,0,0,1,0,0,0,1,1,1,1,0,0,1,1], 58] [[0,0,0,0,0,0,1,0,1,0,1,0,0,0,1,0,1,1,0,0], 33] [[0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,1], 33] [[0,0,0,0,0,0,0,1,0,0,0,0,1,0,1,1,1,1,0,0], 26] [[0,0,0,1,0,1,1,0,0,0,1,1,1,0,0,0,1,0,1,0], 22] [[0,0,0,0,1,1,1,0,0,0,0,0,0,1,1,1,1,0,0,1], 13] [[0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,1,1,0], 0]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,1,1], 120] [[0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0,1,0], 61] [[0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1,1,0], 55] [[0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,1], 47] [[0,0,0,1,0,0,1,0,0,0,0,1,1,0,0,0,0,1,1,0], 27] [[0,0,0,0,0,0,0,0,1,0,0,0,1,1,0,0,0,0,1,0], 26] [[0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,1,1], 21] [[0,0,0,1,1,0,0,1,0,1,1,1,1,0,0,1,0,0,1,1], 16] [[0,0,0,0,1,0,1,0,1,0,1,0,0,1,1,1,1,0,1,1], 15] [[0,0,1,0,0,0,1,0,1,0,0,0,0,1,1,1,1,1,1,1], 12]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,0,1,1], 88] [[0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,0,0,1,1], 84] [[0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,1,1,1,0], 65] [[0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,0], 40] [[0,0,0,0,0,0,0,0,0,1,0,0,1,1,1,1,1,0,0,1], 28] [[0,0,0,1,0,0,1,0,0,0,0,0,1,1,1,1,0,1,1,0], 28] [[0,0,0,0,0,0,0,1,0,1,1,1,1,0,0,0,0,1,1,1], 21] [[0,0,0,0,0,0,1,0,0,0,1,1,0,1,0,1,1,0,1,1], 21] [[0,0,0,0,1,1,0,0,1,0,1,0,1,0,0,0,1,0,1,0], 14] [[0,1,0,1,1,1,0,0,0,1,1,0,1,1,1,1,0,0,0,0], 11]
+[[0,0,0,0,0,0,1,0,0,0,0,1,1,1,1,1,0,0,1,0], 69] [[0,0,0,0,0,0,0,0,0,1,0,0,0,1,1,1,0,0,1,1], 56] [[0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0], 54] [[0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,1,0,1], 42] [[0,0,0,0,0,0,1,1,0,0,0,0,1,0,0,1,0,0,0,1], 39] [[0,0,0,0,0,1,0,0,1,0,0,0,1,1,0,1,0,0,1,1], 37] [[0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,1,1,1], 36] [[0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,1,0,0,1,0], 28] [[0,0,0,1,1,1,0,0,0,0,1,0,1,0,0,0,1,0,1,0], 21] [[0,0,1,0,0,0,1,0,1,1,0,0,1,0,0,0,0,1,1,0], 18]
+[[0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,1,1], 99] [[0,0,0,0,0,0,0,0,1,0,0,0,0,1,1,1,0,0,1,0], 58] [[0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,0,1,1,0], 42] [[0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,1], 36] [[0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,1,0], 36] [[0,0,0,0,1,1,0,0,0,1,1,1,1,0,0,0,1,0,1,0], 31] [[0,0,0,0,0,1,0,0,0,0,0,1,0,1,1,1,0,1,0,1], 31] [[0,1,0,0,0,0,1,0,0,0,0,1,1,0,0,0,1,1,1,0], 29] [[0,0,0,0,0,0,0,0,1,0,0,0,1,1,1,0,0,1,1,1], 28] [[0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,1,1,1,1,0], 10]
--- /dev/null
+#!/usr/bin/ruby
+#
+# == Synopsis
+#
+# Play one move of a Trap the Cap game
+#
+# == Usage
+# clockwise-p1
+# Game state file read on STDIN
+# Move produced on STDOUT
+#
+# == Author
+# Neil Smith
+
+
+require 'libttc'
+require 'libttc-pplayer'
+require 'rdoc/usage'
+
+
+# Get the current game state
+game_lines = readlines
+game, moves, next_roll = Game.read_game(game_lines)
+game.apply_moves! moves
+
+player = Potential_player.new({:friend_pull => 0.0,
+ :enemy_pull => 0.0,
+ :base_pull => 0.0,
+ :safe_bonus => 10,
+ :capture_bonus => 2})
+
+best_move = player.best_move(game, next_roll)
+
+# return that move
+puts best_move
--- /dev/null
+K 25
+svn:wc:ra_dav:version-url
+V 53
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/src/html-files
+END
+layout.html
+K 25
+svn:wc:ra_dav:version-url
+V 65
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/src/html-files/layout.html
+END
+board-thumb.jpg
+K 25
+svn:wc:ra_dav:version-url
+V 69
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/src/html-files/board-thumb.jpg
+END
+interface.html
+K 25
+svn:wc:ra_dav:version-url
+V 68
+/svn/njae/!svn/ver/70/TrapTheCap/trunk/src/html-files/interface.html
+END
+schematic-board-thumb.png
+K 25
+svn:wc:ra_dav:version-url
+V 79
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/src/html-files/schematic-board-thumb.png
+END
+board.jpg
+K 25
+svn:wc:ra_dav:version-url
+V 63
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/src/html-files/board.jpg
+END
+schematic-board.png
+K 25
+svn:wc:ra_dav:version-url
+V 73
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/src/html-files/schematic-board.png
+END
+index.html
+K 25
+svn:wc:ra_dav:version-url
+V 64
+/svn/njae/!svn/ver/70/TrapTheCap/trunk/src/html-files/index.html
+END
+simple.html
+K 25
+svn:wc:ra_dav:version-url
+V 65
+/svn/njae/!svn/ver/69/TrapTheCap/trunk/src/html-files/simple.html
+END
+trap-the-cap.pdf
+K 25
+svn:wc:ra_dav:version-url
+V 70
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/src/html-files/trap-the-cap.pdf
+END
--- /dev/null
+8
+
+dir
+68
+http://scripts.njae.me.uk/svn/njae/TrapTheCap/trunk/src/html-files
+http://scripts.njae.me.uk/svn/njae
+
+
+
+2008-10-16T14:11:23.436422Z
+41
+
+
+
+svn:special svn:externals svn:needs-lock
+\f
+layout.html
+file
+
+
+
+
+2007-05-14T21:17:46.000000Z
+2f4d0c3ae6d9e99aeb5023c4a1d06463
+2008-10-16T14:11:23.436422Z
+41
+\f
+interface.html
+file
+70
+
+
+
+2009-02-23T14:08:48.000000Z
+cb3ca592cfbf181798dd5374fb31c5df
+2009-02-23T14:09:06.882172Z
+70
+\f
+board-thumb.jpg
+file
+
+
+
+
+2007-05-14T21:17:46.000000Z
+11bf63c82d0d8b62e42e1868a3247cff
+2008-10-16T14:11:23.436422Z
+41
+
+has-props
+\f
+schematic-board-thumb.png
+file
+
+
+
+
+2007-05-14T21:17:46.000000Z
+faa2c4f54dcd474c027faec304b91548
+2008-10-16T14:11:23.436422Z
+41
+
+has-props
+\f
+board.jpg
+file
+
+
+
+
+2007-05-14T21:17:46.000000Z
+b52bed753ac7272a364b4569d235b219
+2008-10-16T14:11:23.436422Z
+41
+
+has-props
+\f
+robots
+dir
+\f
+schematic-board.png
+file
+
+
+
+
+2007-05-14T21:17:46.000000Z
+7369d4c42a02fc535e19bd68d0d2e209
+2008-10-16T14:11:23.436422Z
+41
+
+has-props
+\f
+index.html
+file
+70
+
+
+
+2009-02-23T14:08:12.000000Z
+3be6c076657c7510db235ab857136314
+2009-02-23T14:09:06.882172Z
+70
+\f
+simple.html
+file
+69
+
+
+
+2009-02-23T13:55:00.000000Z
+f9a24e4eadb298e29094a60ebbb20f4c
+2009-02-23T14:02:44.812274Z
+69
+\f
+trap-the-cap.pdf
+file
+
+
+
+
+2007-05-14T21:17:46.000000Z
+9b7e0b7381e7e7e0894f105690345a7c
+2008-10-16T14:11:23.436422Z
+41
+
+has-props
+\f
--- /dev/null
+K 13
+svn:mime-type
+V 24
+application/octet-stream
+END
--- /dev/null
+K 13
+svn:mime-type
+V 24
+application/octet-stream
+END
--- /dev/null
+K 13
+svn:mime-type
+V 24
+application/octet-stream
+END
--- /dev/null
+K 13
+svn:mime-type
+V 24
+application/octet-stream
+END
--- /dev/null
+K 13
+svn:mime-type
+V 24
+application/octet-stream
+END
--- /dev/null
+<html>
+<head>
+<title>Trap the Cap</title>
+</head>
+<body>
+
+<h1>Trap The Cap</h1>
+
+<table border=1 align=right>
+<tr><td><a href="board.jpg"><img src="board-thumb.jpg"></a></td></tr>
+<tr><td>The board</a></td></tr>
+</table>
+
+<h2>Changes</h2>
+<table cellpadding="3">
+
+<tr valign="top">
+<td>23 February 2009</td>
+<td>Added a new player robot and fixed the sample game file to a legal one.</tr>
+
+<tr valign="top">
+<td>22 April 2008</td>
+<td>Updated <a
+href="robots/libttc.rb">library</a> again: fixed bugs to detect a winner, and also eliminate players that have no uncaptured pieces.</td>
+</tr>
+
+<tr valign="top">
+<td>10 September 2007</td>
+<td>Updated <a
+href="robots/libttc.rb">library</a> again: <code>Game#possible_moves</code> now shows the legal moves as described below.</td>
+</tr>
+
+<tr>
+<td>7 September 2007</td>
+<td>Updated <a
+href="robots/libttc.rb">library</a>: now prevents moves via base without captured pieces and prevents more than three pieces on a safe position.<br>
+Changed format for moves that end on a base</td>
+</tr>
+</table>
+
+<p><em>Trap The Cap</em> is a simple board game of captuing (and
+recapturing) pieces. You can <a href="trap-the-cap.pdf">read the
+rules</a> and look at the board to see how the game is played (rules
+and image both from <a
+href="http://www.boardgamegeek.com/game/1730#files">Board Game
+Geek</a>).</p>
+
+<p>The challenge is to build a computer program that will play the
+game well. The structure of the challenge is heavily based on the one
+for <a href="../pousse/index.html">Pousse</a>. What needs to be fixed
+for the game is <a href="layout.html">how the various pieces and
+places on the board are identified</a> and <a
+href="interface.html">how your player will be called</a> (updated 22 April 2008).</p>
+
+<p>There is a <a href="simple.html">simple interface</a> to a test for
+your programs, with two simple robots to play against. </p>
+
+<p>'Always clockwise simple' [<a href="robots/1/runme">source
+code</a>] always moves the lowest-valued piece clockwise around the
+rim of the board. 'Clockwise cloud' [<a href="robots/2/runme">source
+code</a>] always moves the least clockwise piece clockwise around the
+rim. They should be pretty easy to beat. Both robots are witten in
+<a href="http://www.ruby-lang.org/en/">Ruby</a> and use the <code><a
+href="robots/libttc.rb">libttc.rb</a></code> library (updated 10
+September 2007). Feel free to base your own robots on this code. All
+this code is released under the <a href="">GNU General Public Licence
+v3</a>.</p>
+
+</body>
+</html>
--- /dev/null
+<html>
+<head>
+<title>Trap the Cap Interface</title>
+</head>
+<body>
+
+<h1><a href="index.html">Trap the Cap</a> Computer Interface</h1>
+
+<h2>Changes</h2>
+<table cellpadding="3">
+
+<tr valign="top">
+<td>23 February 2009</td>
+<td>Fixed the sample game file to a legal one.</tr>
+
+<tr valign="top">
+<td>7 September 2007</td>
+<td>Updated library: now prevents moves via base without captured pieces and prevents more than three pieces on a safe position.<br>
+Changed format for moves that end on a base</td>
+</tr>
+
+<tr valign="top">
+<td>31 August 2007</td>
+<td>Changed example input file (old one was invalid)<br>
+Added notation for moves via bases<br>
+Changed time limit to 10 seconds</td>
+</tr>
+</table>
+
+<p>The game will be played between two and six players. See below for
+the identities of the players.</p>
+
+<table>
+<tr><th>No. of players</th><th>Players</th</tr>
+<tr align=center><td>2</td><td>A, D</td></tr>
+<tr align=center><td>3</td><td>A, C, E</td></tr>
+<tr align=center><td>4</td><td>A, B, D, E</td></tr>
+<tr align=center><td>5</td><td>A, B, C, D, E</td></tr>
+<tr align=center><td>6</td><td>A, B, C, D, E, F</td></tr>
+</table>
+
+<p>Your program will be run afresh for each move it has to make. Your
+program will be fed the history of the game so far on standard input.
+It will then have 10 seconds to report its move on standard
+output.</p>
+
+<p>The format of the input is as follows. The first line will be a
+single digit, giving the number of players. Subsequent lines will
+give the moves played so far in the game. The final line will be the
+dice roll for your move. Each move will be in the format <br>
+<code><piece moved> <location moved to></code><br>
+
+(that's a single space between the two parts of the line). If a move
+is via a base, the move will be in the format <br>
+<code><piece moved> <base moved via> <location moved
+to></code><br>
+If a move is to a base, the move notation may be in either form.</p>
+
+<p>It may be that one player may have many consecutive moves if they
+roll multiple sixes. There are no additional spaces or blank lines in
+the file.</p>
+
+<p>Here is an example of a valid input file:</p>
+
+<pre>3
+A1 AC2
+C4 B5
+E1 EC5
+E2 E3
+A1 EC5
+C4 B2
+4</pre>
+
+<p>(Note the caputre of piece E1 by piece A1 on position EC5.)
+
+<p>Player program will run on a Linux machine (probably some version
+of Ubuntu Linux). Exact specification is unclear at the moment, but
+it may run on a twin-processor machine.</p>
+
+<p>The player's program must be named <code>runme</code>; it may be a
+binary executable or a driver shell script that starts up the actual
+program. It will be invoked as<br>
+
+<pre> ./runme</pre><br>
+
+with the program's top-level directory as the current working
+directory; libraries and other support data may thus be accessed with
+the relative path name <br>
+
+<pre> support/...</pre></p>
+
+<p>The program is run once for every move and then terminates; the
+current move state will be passed to the program on standard
+input. Persistent inter-move state may be kept in the
+<code>support/</code> directory if desired. When the program has
+chosen a move, it should print the move to standard output and
+exit. If the program has not done so after 10 seconds (real or "wall
+clock" time), the program will be terminated forcibly, and lose the
+game. </p>
+
+<p>There should be no child processes alive after the top-level
+process exits; the program must ensure that all its child processes
+have exited before the top-level process exits itself.</p>
+
+</body>
+</html>
--- /dev/null
+<html>
+<head>
+<title>Trap the Cap Board Layout</title>
+</head>
+<body>
+
+<h1><a href="index.html">Trap the Cap</a> Board Layout and Labelling</h1>
+
+<table border=1 align=right>
+<tr><td><a href="schematic-board.png"><img src="schematic-board-thumb.png"></a></td></tr>
+<tr><td>The board</a></td></tr>
+</table>
+
+<p>Given <a href="trap-the-cap.pdf">the rules</a> and board layout
+(right), we can start to label the pieces and places.</p>
+
+<ul>
+<li>The six home bases are labelled 'A' .. 'F'.</li>
+<li>The six playing pieces for each player each have their own names:
+A1.. A6 for player A, B1..B6 for player B, and so on.</li>
+<li>The locations on the board are given in terms of the nearest home base.</li>
+<li>The player's home base is given the label 'A' for player A, and so
+on.</li>
+<li>Places around the rim are counted clockwise from the home base,
+given labels 'A1', 'A2' ... 'A6'.</li>
+<li>Places on the spokes are labelled, from the outside in, 'AC1',
+'AC2' ... 'AC5'</li>
+<li>The central space is, simultaneously, 'AC6', 'BC6', 'CC6'...</li>
+</ul>
+
+</body>
+</html>
--- /dev/null
+<html>
+<head>
+<title>Simple Trap the Cap form </title>
+</head>
+<body>
+
+<h1>Simple <a href="index.html">Trap the Cap</a> form</h1>
+
+<form action="/cgi-bin/ttc-simple.rb" method="post">
+
+<table cellpadding=3>
+<tr valign="top">
+<td>Robot input:</td>
+<td><textarea rows="20" cols="10" wrap="off" name="moves"></textarea></td>
+</tr>
+
+<tr>
+<td>Robot:</td>
+<td><select name="robot">
+<option>Always clockwise simple</option>
+<option>Clockwise cloud</option>
+<option>GA generation 1006</option>
+</select>
+</tr>
+
+<tr>
+<td><input type="submit" value="move"></td>
+<td><input type="reset"></td>
+</tr>
+</table>
+
+</form>
+
+</body>
+</html>
--- /dev/null
+<html>
+<head>
+<title>Trap the Cap</title>
+</head>
+<body>
+
+<h1>Trap The Cap</h1>
+
+<table border=1 align=right>
+<tr><td><a href="board.jpg"><img src="board-thumb.jpg"></a></td></tr>
+<tr><td>The board</a></td></tr>
+</table>
+
+<h2>Changes</h2>
+<table cellpadding="3">
+
+<tr valign="top">
+<td>23 February 2009</td>
+<td>Added a new player robot and fixed the sample game file to a legal one.</tr>
+
+<tr valign="top">
+<td>22 April 2008</td>
+<td>Updated <a
+href="robots/libttc.rb">library</a> again: fixed bugs to detect a winner, and also eliminate players that have no uncaptured pieces.</td>
+</tr>
+
+<tr valign="top">
+<td>10 September 2007</td>
+<td>Updated <a
+href="robots/libttc.rb">library</a> again: <code>Game#possible_moves</code> now shows the legal moves as described below.</td>
+</tr>
+
+<tr>
+<td>7 September 2007</td>
+<td>Updated <a
+href="robots/libttc.rb">library</a>: now prevents moves via base without captured pieces and prevents more than three pieces on a safe position.<br>
+Changed format for moves that end on a base</td>
+</tr>
+</table>
+
+<p><em>Trap The Cap</em> is a simple board game of captuing (and
+recapturing) pieces. You can <a href="trap-the-cap.pdf">read the
+rules</a> and look at the board to see how the game is played (rules
+and image both from <a
+href="http://www.boardgamegeek.com/game/1730#files">Board Game
+Geek</a>).</p>
+
+<p>The challenge is to build a computer program that will play the
+game well. The structure of the challenge is heavily based on the one
+for <a href="../pousse/index.html">Pousse</a>. What needs to be fixed
+for the game is <a href="layout.html">how the various pieces and
+places on the board are identified</a> and <a
+href="interface.html">how your player will be called</a> (updated 22 April 2008).</p>
+
+<p>There is a <a href="simple.html">simple interface</a> to a test for
+your programs, with two simple robots to play against. </p>
+
+<p>'Always clockwise simple' [<a href="robots/1/runme">source
+code</a>] always moves the lowest-valued piece clockwise around the
+rim of the board. 'Clockwise cloud' [<a href="robots/2/runme">source
+code</a>] always moves the least clockwise piece clockwise around the
+rim. They should be pretty easy to beat. Both robots are witten in
+<a href="http://www.ruby-lang.org/en/">Ruby</a> and use the <code><a
+href="robots/libttc.rb">libttc.rb</a></code> library (updated 10
+September 2007). Feel free to base your own robots on this code. All
+this code is released under the <a href="">GNU General Public Licence
+v3</a>.</p>
+
+</body>
+</html>
--- /dev/null
+<html>
+<head>
+<title>Trap the Cap Interface</title>
+</head>
+<body>
+
+<h1><a href="index.html">Trap the Cap</a> Computer Interface</h1>
+
+<h2>Changes</h2>
+<table cellpadding="3">
+
+<tr valign="top">
+<td>23 February 2009</td>
+<td>Fixed the sample game file to a legal one.</tr>
+
+<tr valign="top">
+<td>7 September 2007</td>
+<td>Updated library: now prevents moves via base without captured pieces and prevents more than three pieces on a safe position.<br>
+Changed format for moves that end on a base</td>
+</tr>
+
+<tr valign="top">
+<td>31 August 2007</td>
+<td>Changed example input file (old one was invalid)<br>
+Added notation for moves via bases<br>
+Changed time limit to 10 seconds</td>
+</tr>
+</table>
+
+<p>The game will be played between two and six players. See below for
+the identities of the players.</p>
+
+<table>
+<tr><th>No. of players</th><th>Players</th</tr>
+<tr align=center><td>2</td><td>A, D</td></tr>
+<tr align=center><td>3</td><td>A, C, E</td></tr>
+<tr align=center><td>4</td><td>A, B, D, E</td></tr>
+<tr align=center><td>5</td><td>A, B, C, D, E</td></tr>
+<tr align=center><td>6</td><td>A, B, C, D, E, F</td></tr>
+</table>
+
+<p>Your program will be run afresh for each move it has to make. Your
+program will be fed the history of the game so far on standard input.
+It will then have 10 seconds to report its move on standard
+output.</p>
+
+<p>The format of the input is as follows. The first line will be a
+single digit, giving the number of players. Subsequent lines will
+give the moves played so far in the game. The final line will be the
+dice roll for your move. Each move will be in the format <br>
+<code><piece moved> <location moved to></code><br>
+
+(that's a single space between the two parts of the line). If a move
+is via a base, the move will be in the format <br>
+<code><piece moved> <base moved via> <location moved
+to></code><br>
+If a move is to a base, the move notation may be in either form.</p>
+
+<p>It may be that one player may have many consecutive moves if they
+roll multiple sixes. There are no additional spaces or blank lines in
+the file.</p>
+
+<p>Here is an example of a valid input file:</p>
+
+<pre>3
+A1 AC2
+C4 B5
+E1 EC5
+E2 E3
+A1 EC5
+C4 B2
+4</pre>
+
+<p>(Note the caputre of piece E1 by piece A1 on position EC5.)
+
+<p>Player program will run on a Linux machine (probably some version
+of Ubuntu Linux). Exact specification is unclear at the moment, but
+it may run on a twin-processor machine.</p>
+
+<p>The player's program must be named <code>runme</code>; it may be a
+binary executable or a driver shell script that starts up the actual
+program. It will be invoked as<br>
+
+<pre> ./runme</pre><br>
+
+with the program's top-level directory as the current working
+directory; libraries and other support data may thus be accessed with
+the relative path name <br>
+
+<pre> support/...</pre></p>
+
+<p>The program is run once for every move and then terminates; the
+current move state will be passed to the program on standard
+input. Persistent inter-move state may be kept in the
+<code>support/</code> directory if desired. When the program has
+chosen a move, it should print the move to standard output and
+exit. If the program has not done so after 10 seconds (real or "wall
+clock" time), the program will be terminated forcibly, and lose the
+game. </p>
+
+<p>There should be no child processes alive after the top-level
+process exits; the program must ensure that all its child processes
+have exited before the top-level process exits itself.</p>
+
+</body>
+</html>
--- /dev/null
+<html>
+<head>
+<title>Trap the Cap Board Layout</title>
+</head>
+<body>
+
+<h1><a href="index.html">Trap the Cap</a> Board Layout and Labelling</h1>
+
+<table border=1 align=right>
+<tr><td><a href="schematic-board.png"><img src="schematic-board-thumb.png"></a></td></tr>
+<tr><td>The board</a></td></tr>
+</table>
+
+<p>Given <a href="trap-the-cap.pdf">the rules</a> and board layout
+(right), we can start to label the pieces and places.</p>
+
+<ul>
+<li>The six home bases are labelled 'A' .. 'F'.</li>
+<li>The six playing pieces for each player each have their own names:
+A1.. A6 for player A, B1..B6 for player B, and so on.</li>
+<li>The locations on the board are given in terms of the nearest home base.</li>
+<li>The player's home base is given the label 'A' for player A, and so
+on.</li>
+<li>Places around the rim are counted clockwise from the home base,
+given labels 'A1', 'A2' ... 'A6'.</li>
+<li>Places on the spokes are labelled, from the outside in, 'AC1',
+'AC2' ... 'AC5'</li>
+<li>The central space is, simultaneously, 'AC6', 'BC6', 'CC6'...</li>
+</ul>
+
+</body>
+</html>
--- /dev/null
+K 25
+svn:wc:ra_dav:version-url
+V 60
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/src/html-files/robots
+END
--- /dev/null
+8
+
+dir
+68
+http://scripts.njae.me.uk/svn/njae/TrapTheCap/trunk/src/html-files/robots
+http://scripts.njae.me.uk/svn/njae
+
+
+
+2008-10-16T14:11:23.436422Z
+41
+
+
+
+svn:special svn:externals svn:needs-lock
+\f
+1
+dir
+\f
+2
+dir
+\f
+3
+dir
+\f
--- /dev/null
+K 25
+svn:wc:ra_dav:version-url
+V 62
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/src/html-files/robots/1
+END
+runme
+K 25
+svn:wc:ra_dav:version-url
+V 68
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/src/html-files/robots/1/runme
+END
--- /dev/null
+8
+
+dir
+68
+http://scripts.njae.me.uk/svn/njae/TrapTheCap/trunk/src/html-files/robots/1
+http://scripts.njae.me.uk/svn/njae
+
+
+
+2008-10-16T14:11:23.436422Z
+41
+
+
+
+svn:special svn:externals svn:needs-lock
+\f
+runme
+file
+
+
+
+
+2008-05-22T10:01:10.000000Z
+508e127b6cb4b5f78a524e17c54cf532
+2008-10-16T14:11:23.436422Z
+41
+
+has-props
+\f
--- /dev/null
+K 14
+svn:executable
+V 1
+*
+END
--- /dev/null
+#!/usr/bin/ruby
+#
+# == Synopsis
+#
+# Play one move of a Trap the Cap game
+#
+# == Usage
+# clockwise-p1
+# Game state file read on STDIN
+# Move produced on STDOUT
+#
+# == Author
+# Neil Smith
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+require 'libttc'
+
+def more_clockwise(this, other)
+ here = this.destination.place
+ there = other.destination.place
+
+ # if both are on a spoke, choose the one with the lowest number (nearer the rim)
+ if here =~ /.c./ and there =~ /.c./
+ # break ties by preferring the most clockwise arc
+ if here[-1] == there[-1]
+ return here[0] <=> there[0]
+ else
+ return -1 * (here[-1] <=> there[-1])
+ end
+ # If one is one a spoke and the other is on the rim, choose the one on the rim
+ elsif here =~ /.c./ or there =~ /.c./
+ return -1 * (here.length <=> there.length)
+ # If one is in the 'f' rim section and the other in the 'a' rim section, choose the 'a'
+ elsif here[0,1] == 'a' and there[0,1] == 'f'
+ return +1
+ elsif here[0,1] == 'f' and there[0,1] == 'a'
+ return -1
+ # Otherwise, choose the one with highest arc code
+ else
+ return here <=> there
+ end
+
+end
+
+# Get the current game state
+game_lines = readlines
+game, moves, next_roll = Game.read_game(game_lines)
+game.apply_moves! moves
+
+# The piece to move is the uncaptured one of mine with the lowest number
+my_pieces = game.pieces.values.select {|p| p.colour == game.current_player and not p.captured}
+piece_to_move = (my_pieces.sort_by {|p| p.name})[0]
+
+# find the most clockwise move
+potential_moves = game.possible_moves(next_roll).select {|m| m.piece == piece_to_move}
+sorted_moves = potential_moves.sort {|x, y| more_clockwise x, y}
+best_move = sorted_moves[-1]
+
+# return that move
+puts best_move
+
+
--- /dev/null
+#!/usr/bin/ruby
+#
+# == Synopsis
+#
+# Play one move of a Trap the Cap game
+#
+# == Usage
+# clockwise-p1
+# Game state file read on STDIN
+# Move produced on STDOUT
+#
+# == Author
+# Neil Smith
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+require 'libttc'
+
+def more_clockwise(this, other)
+ here = this.destination.place
+ there = other.destination.place
+
+ # if both are on a spoke, choose the one with the lowest number (nearer the rim)
+ if here =~ /.c./ and there =~ /.c./
+ # break ties by preferring the most clockwise arc
+ if here[-1] == there[-1]
+ return here[0] <=> there[0]
+ else
+ return -1 * (here[-1] <=> there[-1])
+ end
+ # If one is one a spoke and the other is on the rim, choose the one on the rim
+ elsif here =~ /.c./ or there =~ /.c./
+ return -1 * (here.length <=> there.length)
+ # If one is in the 'f' rim section and the other in the 'a' rim section, choose the 'a'
+ elsif here[0,1] == 'a' and there[0,1] == 'f'
+ return +1
+ elsif here[0,1] == 'f' and there[0,1] == 'a'
+ return -1
+ # Otherwise, choose the one with highest arc code
+ else
+ return here <=> there
+ end
+
+end
+
+# Get the current game state
+game_lines = readlines
+game, moves, next_roll = Game.read_game(game_lines)
+game.apply_moves! moves
+
+# The piece to move is the uncaptured one of mine with the lowest number
+my_pieces = game.pieces.values.select {|p| p.colour == game.current_player and not p.captured}
+piece_to_move = (my_pieces.sort_by {|p| p.name})[0]
+
+# find the most clockwise move
+potential_moves = game.possible_moves(next_roll).select {|m| m.piece == piece_to_move}
+sorted_moves = potential_moves.sort {|x, y| more_clockwise x, y}
+best_move = sorted_moves[-1]
+
+# return that move
+puts best_move
+
+
--- /dev/null
+#!/usr/bin/ruby
+#
+# == Synopsis
+#
+# Play one move of a Trap the Cap game
+#
+# == Usage
+# clockwise-p1
+# Game state file read on STDIN
+# Move produced on STDOUT
+#
+# == Author
+# Neil Smith
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+require 'libttc'
+
+def more_clockwise(this, other)
+ here = this.destination.place
+ there = other.destination.place
+
+ # if both are on a spoke, choose the one with the lowest number (nearer the rim)
+ if here =~ /.c./ and there =~ /.c./
+ # break ties by preferring the most clockwise arc
+ if here[-1] == there[-1]
+ return here[0] <=> there[0]
+ else
+ return -1 * (here[-1] <=> there[-1])
+ end
+ # If one is one a spoke and the other is on the rim, choose the one on the rim
+ elsif here =~ /.c./ or there =~ /.c./
+ return -1 * (here.length <=> there.length)
+ # If one is in the 'f' rim section and the other in the 'a' rim section, choose the 'a'
+ elsif here[0,1] == 'a' and there[0,1] == 'f'
+ return +1
+ elsif here[0,1] == 'f' and there[0,1] == 'a'
+ return -1
+ # Otherwise, choose the one with highest arc code
+ else
+ return here <=> there
+ end
+
+end
+
+# Get the current game state
+game_lines = readlines
+game, moves, next_roll = Game.read_game(game_lines)
+game.apply_moves moves
+
+# The piece to move is the uncaptured one of mine with the lowest number
+my_pieces = game.pieces.values.select {|p| p.colour == game.current_player and not p.captured}
+piece_to_move = (my_pieces.sort_by {|p| p.name})[0]
+
+# find the most clockwise move
+potential_moves = game.possible_moves(next_roll).select {|m| m.piece == piece_to_move}
+sorted_moves = potential_moves.sort {|x, y| more_clockwise x, y}
+best_move = sorted_moves[-1]
+
+# return that move
+puts best_move
+
+
--- /dev/null
+K 25
+svn:wc:ra_dav:version-url
+V 62
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/src/html-files/robots/2
+END
+runme
+K 25
+svn:wc:ra_dav:version-url
+V 68
+/svn/njae/!svn/ver/41/TrapTheCap/trunk/src/html-files/robots/2/runme
+END
--- /dev/null
+8
+
+dir
+68
+http://scripts.njae.me.uk/svn/njae/TrapTheCap/trunk/src/html-files/robots/2
+http://scripts.njae.me.uk/svn/njae
+
+
+
+2008-10-16T14:11:23.436422Z
+41
+
+
+
+svn:special svn:externals svn:needs-lock
+\f
+runme
+file
+
+
+
+
+2008-05-22T10:01:21.000000Z
+15f27beb7a6886db08f2b276546a8cdb
+2008-10-16T14:11:23.436422Z
+41
+
+has-props
+\f
--- /dev/null
+K 14
+svn:executable
+V 1
+*
+END
--- /dev/null
+#!/usr/bin/ruby
+#
+# == Synopsis
+#
+# Play one move of a Trap the Cap game
+#
+# == Usage
+# clockwise-p1
+# Game state file read on STDIN
+# Move produced on STDOUT
+#
+# == Author
+# Neil Smith
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+require 'libttc'
+
+def more_clockwise(this, other)
+ here = this.place
+ there = other.place
+
+ # if both are on a spoke, choose the one with the lowest number (nearer the rim)
+ if here =~ /.c./ and there =~ /.c./
+ # break ties by preferring the most clockwise arc
+ if here[-1] == there[-1]
+ return here[0] <=> there[0]
+ else
+ return -1 * (here[-1] <=> there[-1])
+ end
+ # If one is one a spoke and the other is on the rim, choose the one on the rim
+ elsif here =~ /.c./ or there =~ /.c./
+ return -1 * (here.length <=> there.length)
+ # If one is in the 'f' rim section and the other in the 'a' rim section, choose the 'a'
+ elsif here[0,1] == 'a' and there[0,1] == 'f'
+ return +1
+ elsif here[0,1] == 'f' and there[0,1] == 'a'
+ return -1
+ # Otherwise, choose the one with highest arc code
+ else
+ return here <=> there
+ end
+
+end
+
+# Get the current game state
+game_lines = readlines
+game, moves, next_roll = Game.read_game(game_lines)
+game.apply_moves! moves
+
+
+# The piece to move is the least clockwise of my uncaptured pieces
+# Always move pieces on the base first
+my_pieces = game.pieces.values.select {|p| p.colour == game.current_player and not p.captured}
+piece_to_move = (my_pieces.sort {|x, y| more_clockwise x.position, y.position})[0]
+
+# Find the most clockwise move for this piece
+potential_moves = game.possible_moves(next_roll).select {|m| m.piece == piece_to_move}
+sorted_moves = potential_moves.sort {|x, y| more_clockwise x.destination, y.destination}
+best_move = sorted_moves[-1]
+
+# return that move
+puts best_move
+
+
--- /dev/null
+#!/usr/bin/ruby
+#
+# == Synopsis
+#
+# Play one move of a Trap the Cap game
+#
+# == Usage
+# clockwise-p1
+# Game state file read on STDIN
+# Move produced on STDOUT
+#
+# == Author
+# Neil Smith
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+require 'libttc'
+
+def more_clockwise(this, other)
+ here = this.place
+ there = other.place
+
+ # if both are on a spoke, choose the one with the lowest number (nearer the rim)
+ if here =~ /.c./ and there =~ /.c./
+ # break ties by preferring the most clockwise arc
+ if here[-1] == there[-1]
+ return here[0] <=> there[0]
+ else
+ return -1 * (here[-1] <=> there[-1])
+ end
+ # If one is one a spoke and the other is on the rim, choose the one on the rim
+ elsif here =~ /.c./ or there =~ /.c./
+ return -1 * (here.length <=> there.length)
+ # If one is in the 'f' rim section and the other in the 'a' rim section, choose the 'a'
+ elsif here[0,1] == 'a' and there[0,1] == 'f'
+ return +1
+ elsif here[0,1] == 'f' and there[0,1] == 'a'
+ return -1
+ # Otherwise, choose the one with highest arc code
+ else
+ return here <=> there
+ end
+
+end
+
+# Get the current game state
+game_lines = readlines
+game, moves, next_roll = Game.read_game(game_lines)
+game.apply_moves! moves
+
+
+# The piece to move is the least clockwise of my uncaptured pieces
+# Always move pieces on the base first
+my_pieces = game.pieces.values.select {|p| p.colour == game.current_player and not p.captured}
+piece_to_move = (my_pieces.sort {|x, y| more_clockwise x.position, y.position})[0]
+
+# Find the most clockwise move for this piece
+potential_moves = game.possible_moves(next_roll).select {|m| m.piece == piece_to_move}
+sorted_moves = potential_moves.sort {|x, y| more_clockwise x.destination, y.destination}
+best_move = sorted_moves[-1]
+
+# return that move
+puts best_move
+
+
--- /dev/null
+#!/usr/bin/ruby
+#
+# == Synopsis
+#
+# Play one move of a Trap the Cap game
+#
+# == Usage
+# clockwise-p1
+# Game state file read on STDIN
+# Move produced on STDOUT
+#
+# == Author
+# Neil Smith
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+
+require 'libttc'
+
+def more_clockwise(this, other)
+ here = this.place
+ there = other.place
+
+ # if both are on a spoke, choose the one with the lowest number (nearer the rim)
+ if here =~ /.c./ and there =~ /.c./
+ # break ties by preferring the most clockwise arc
+ if here[-1] == there[-1]
+ return here[0] <=> there[0]
+ else
+ return -1 * (here[-1] <=> there[-1])
+ end
+ # If one is one a spoke and the other is on the rim, choose the one on the rim
+ elsif here =~ /.c./ or there =~ /.c./
+ return -1 * (here.length <=> there.length)
+ # If one is in the 'f' rim section and the other in the 'a' rim section, choose the 'a'
+ elsif here[0,1] == 'a' and there[0,1] == 'f'
+ return +1
+ elsif here[0,1] == 'f' and there[0,1] == 'a'
+ return -1
+ # Otherwise, choose the one with highest arc code
+ else
+ return here <=> there
+ end
+
+end
+
+# Get the current game state
+game_lines = readlines
+game, moves, next_roll = Game.read_game(game_lines)
+game.apply_moves moves
+
+
+# The piece to move is the least clockwise of my uncaptured pieces
+# Always move pieces on the base first
+my_pieces = game.pieces.values.select {|p| p.colour == game.current_player and not p.captured}
+piece_to_move = (my_pieces.sort {|x, y| more_clockwise x.position, y.position})[0]
+
+# Find the most clockwise move for this piece
+potential_moves = game.possible_moves(next_roll).select {|m| m.piece == piece_to_move}
+sorted_moves = potential_moves.sort {|x, y| more_clockwise x.destination, y.destination}
+best_move = sorted_moves[-1]
+
+# return that move
+puts best_move
+
+
--- /dev/null
+K 25
+svn:wc:ra_dav:version-url
+V 62
+/svn/njae/!svn/ver/69/TrapTheCap/trunk/src/html-files/robots/3
+END
+runme.rb
+K 25
+svn:wc:ra_dav:version-url
+V 71
+/svn/njae/!svn/ver/69/TrapTheCap/trunk/src/html-files/robots/3/runme.rb
+END
--- /dev/null
+8
+
+dir
+69
+http://scripts.njae.me.uk/svn/njae/TrapTheCap/trunk/src/html-files/robots/3
+http://scripts.njae.me.uk/svn/njae
+
+
+
+2009-02-23T14:02:44.812274Z
+69
+
+
+
+svn:special svn:externals svn:needs-lock
+\f
+runme.rb
+file
+
+
+
+
+2009-02-23T14:01:47.000000Z
+597c993fb86e5502356a806a91127c5e
+2009-02-23T14:02:44.812274Z
+69
+\f
--- /dev/null
+#!/usr/bin/ruby
+#
+# == Synopsis
+#
+# Play one move of a Trap the Cap game
+#
+# == Usage
+# clockwise-p1
+# Game state file read on STDIN
+# Move produced on STDOUT
+#
+# == Author
+# Neil Smith
+
+
+require 'libttc'
+require 'libttc-pplayer'
+require 'rdoc/usage'
+
+
+# Get the current game state
+game_lines = readlines
+game, moves, next_roll = Game.read_game(game_lines)
+game.apply_moves! moves
+
+player = Potential_player.new({:friend_pull => 0.0,
+ :enemy_pull => 0.0,
+ :base_pull => 0.0,
+ :safe_bonus => 10,
+ :capture_bonus => 2})
+
+best_move = player.best_move(game, next_roll)
+
+# return that move
+puts best_move
--- /dev/null
+#!/usr/bin/ruby
+#
+# == Synopsis
+#
+# Play one move of a Trap the Cap game
+#
+# == Usage
+# clockwise-p1
+# Game state file read on STDIN
+# Move produced on STDOUT
+#
+# == Author
+# Neil Smith
+
+
+require 'libttc'
+require 'libttc-pplayer'
+require 'rdoc/usage'
+
+
+# Get the current game state
+game_lines = readlines
+game, moves, next_roll = Game.read_game(game_lines)
+game.apply_moves! moves
+
+player = Potential_player.new({:friend_pull => 0.0,
+ :enemy_pull => 0.0,
+ :base_pull => 0.0,
+ :safe_bonus => 10,
+ :capture_bonus => 2})
+
+best_move = player.best_move(game, next_roll)
+
+# return that move
+puts best_move
--- /dev/null
+<html>
+<head>
+<title>Simple Trap the Cap form </title>
+</head>
+<body>
+
+<h1>Simple <a href="index.html">Trap the Cap</a> form</h1>
+
+<form action="/cgi-bin/ttc-simple.rb" method="post">
+
+<table cellpadding=3>
+<tr valign="top">
+<td>Robot input:</td>
+<td><textarea rows="20" cols="10" wrap="off" name="moves"></textarea></td>
+</tr>
+
+<tr>
+<td>Robot:</td>
+<td><select name="robot">
+<option>Always clockwise simple</option>
+<option>Clockwise cloud</option>
+<option>GA generation 1006</option>
+</select>
+</tr>
+
+<tr>
+<td><input type="submit" value="move"></td>
+<td><input type="reset"></td>
+</tr>
+</table>
+
+</form>
+
+</body>
+</html>
--- /dev/null
+# == Synopsis
+#
+# Library to support genetic algorithms
+#
+# == Author
+# Neil Smith
+#
+# == Change history
+# Version 1.1:: 23 April 2008
+
+# A single genome in a population
+class Genome
+
+ attr_accessor :genome
+
+ # Create a random genome of the given length
+ def initialize(bitstring_or_length)
+ if bitstring_or_length.class == Fixnum
+ @genome = []
+ (1..bitstring_or_length).each do |i|
+ @genome << rand(2)
+ end
+ else
+ @genome = bitstring_or_length
+ end
+ end
+
+ # Mutate a genome with the given rate per bit
+ def mutate(mutation_probability = 0.05)
+ new_genome = Genome.new(@genome.length)
+ (0...@genome.length).each do |i|
+ if rand < mutation_probability
+ if @genome[i] == 0
+ new_genome.genome[i] = 1
+ else
+ new_genome.genome[i] = 0
+ end
+ else
+ new_genome.genome[i] = @genome[i]
+ end
+ end
+ new_genome
+ end
+
+ # Mutate a genome in-place with the given rate per bit
+ def mutate!(mutation_probability = 0.05)
+ (0...@genome.length).each do |i|
+ if rand < mutation_probability
+ if @genome[i] == 0
+ @genome[i] = 1
+ else
+ @genome[i] = 0
+ end
+ end
+ end
+ @genome
+ end
+
+ # Crossover two genomes at the given point
+ def crossover(other_genome, crossover_point)
+ raise ArgumentError, "Different size genomes" if @genome.length != other_genome.genome.length
+ raise ArgumentError, "Our of bounds crossover point" if crossover_point < 0 or crossover_point > @genome.length
+ child1 = Genome.new(0)
+ child2 = Genome.new(0)
+ child1.genome = @genome[0, crossover_point] + other_genome.genome[crossover_point, @genome.length]
+ child2.genome = other_genome.genome[0, crossover_point] + @genome[crossover_point, @genome.length]
+ [child1, child2]
+ end
+
+end
+
+
+class Array
+ def to_decimal
+ val = 0
+ bits = self.dup
+ while not bits.empty?
+ val = val * 2 + bits[0]
+ bits = bits[1..bits.length]
+ end
+ val
+ end
+
+ def gray_encode
+ gray = self[0..0]
+ (1...self.length).each do |i|
+ if (self[i - 1] == 1) ^ (self[i] == 1)
+ gray << 1
+ else
+ gray << 0
+ end
+ end
+ gray
+ end
+
+ def gray_decode
+ binary = self[0..0]
+ (1...self.length).each do |i|
+ if (binary[i - 1] == 1) ^ (self[i] == 1)
+ binary << 1
+ else
+ binary << 0
+ end
+ end
+ binary
+ end
+
+end
+
+class Fixnum
+ def to_bitstring(min_length = 0)
+ bits = []
+ k = self
+ while k > 0 do
+ if k % 2 == 1
+ bits << 1
+ else
+ bits << 0
+ end
+ k = k >> 1
+ end
+ while bits.length < min_length do
+ bits << 0
+ end
+ bits.reverse
+ end
+end
+
+
+# A population of genomes
+class Population
+ attr_accessor :individuals
+
+ # Create a population of a given size
+ def initialize(population_size, genome_length = 0)
+ @individuals = []
+ 1.upto(population_size) { @individuals << Genome.new(genome_length) }
+ end
+
+ # Perform the crossover step in a population, giving a new population
+ def crossover(crossover_rate)
+ parents = @individuals.dup # genomes that haven't been parents yet
+ next_population = Population.new(0)
+ while parents.length > 1
+ parent1 = parents.delete_at(rand(parents.length)).dup
+ parent2 = parents.delete_at(rand(parents.length)).dup
+ if rand < crossover_rate
+ child1, child2 = parent1.crossover parent2, rand(parent1.genome.length)
+ next_population.individuals << child1 << child2
+ else
+ next_population.individuals << parent1 << parent2
+ end
+ end
+ next_population.individuals.concat parents # pick up any parents that didn't get a chance to mate
+ next_population
+ end
+
+ # Perform the mutation step in a population, giving a new population
+ def mutation(mutation_rate)
+ parents = @individuals.dup # genomes that haven't been parents yet
+ next_population = Population.new(0)
+ while parents.length > 0
+ parent = parents.pop.dup
+ child = parent.mutate mutation_rate
+ next_population.individuals << child
+ end
+ next_population
+ end
+
+ def make_next_generation(tournament_winner_success_rate = 0.8, game_length = 1000, crossover_rate = 0.7, mutation_rate = 0.05)
+ @individuals = tournament_select_population(tournament_winner_success_rate, game_length, false)
+ @individuals = crossover(crossover_rate)
+ @individuals = mutation(mutation_rate)
+ end
+
+end
--- /dev/null
+# == Synopsis
+#
+# Library to support a Trap the Cap player that uses potentials to select the
+# best move
+#
+# == Author
+# Neil Smith
+#
+# == Change history
+# Version 1.1:: 23 April 2008
+
+require 'libttc'
+
+# Play Trap the Cap by using potential fields. For each possible move,
+# calculate the field strength and pick the move with the lowest potential
+class Potential_player
+
+ attr_reader :friend_pull, :enemy_pull, :base_pull,
+ :safe_bonus, :capture_bonus
+
+ def initialize(args, verbose = false)
+ @friend_pull = args[:friend_pull] || 1
+ @enemy_pull = args[:enemy_pull] || 0.5
+ @base_pull = args[:base_pull] || 2
+ @safe_bonus = args[:safe_bonus] || 8
+ @capture_bonus = args[:capture_bonus] || 10
+
+ @verbose = verbose
+ end
+
+ # Find the best move of the possible ones
+ def best_move(game, die_result)
+ me = game.current_player
+ possible_moves = game.possible_moves(die_result, me)
+ scored_moves = possible_moves.collect do |m|
+ begin
+ game.apply_move! m
+ score = score_position(game, me)
+# game.undo_move!
+ rescue GameWonNotice
+ score = 10000
+ ensure
+ game.undo_move!
+ end
+ puts "#{m} scores #{score}" if @verbose
+ [m, score]
+ end
+ best_move = (scored_moves.max {|a, b| a[1] <=> b[1]})[0]
+ end
+
+ # Calculate the potential score of a position for a given player
+ def score_position(game, player)
+ score = 0
+ game.pieces.each_value do |piece|
+ here = piece.position
+ if piece.colour == player
+ game.pieces.each_value do |other_piece|
+ if other_piece.colour == player
+ score += game.board.distance_between[here.place][other_piece.position.place] * @friend_pull
+ else
+ score += game.board.distance_between[here.place][other_piece.position.place] * @enemy_pull
+ end
+ end
+ score += piece.contains.length * @capture_bonus
+ score += game.board.distance_between[here.place][game.board.positions[player].place] *
+ piece.contains.length * @base_pull
+ elsif here == game.board.positions[player]
+ score += @safe_bonus
+ end
+ end
+ score
+ end
+
+end
--- /dev/null
+# == Synopsis
+#
+# Library to support Trap the Cap play
+#
+# == Author
+# Neil Smith
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# == Change history
+# Version 1.1:: 07 Sep 2007
+# * Changed format for showing moves via bases.
+# * Raise error when moving via base without captured pieces
+# * Raise error when moving onto a safe space with 3 or more
+# pieces already there
+# Version 1.2:: 10 Sep 2007
+# * Incorporated changes in move legality above into
+# Game#possible_moves
+# Version 1.3:: 25 Mar 2008
+# * Fixed bug to detect a winner, and also eliminate players
+# that have no uncaptured pieces.
+
+# Errors for a game
+
+# Pieces can only capture pieces that they're on.
+class InvalidCaptureError < StandardError
+end
+
+# Moves can only be [1..6] spaces
+class InvalidMoveError < StandardError
+end
+
+# Game is won when only one player has uncaptured pieces
+class GameWonNotice < StandardError
+end
+
+
+# Each possible position for a piece is an object
+# Each neighbour is another position object
+class Position
+ attr_reader :place # the name of this place
+ attr_accessor :contains # the pieces it contains
+ attr_accessor :neighbours # the positions that neighbour it
+
+ def initialize(place, safety, base)
+ @place = place
+ @safe = safety
+ @base = base
+ @neighbours = Array.new
+ end
+
+ # is this position a safety one (i.e. no captures allowed)?
+ def safe?
+ @safe
+ end
+
+ # Is this position a base?
+ def base?
+ @base
+ end
+
+ def to_s
+ @place
+ end
+
+ def to_str
+ to_s
+ end
+
+end
+
+
+# The game board
+class Board
+
+ attr_reader :positions
+ attr_reader :valid_moves
+ attr_reader :distance_between
+ attr_reader :centre
+
+
+ # A laborious procedure to create all the positions and tie them all together
+ def initialize(spokes, spoke_length, arc_length)
+ # A hash of all positions, indexed by position names
+ @positions = Hash.new
+ @centre = Position.new('ac' + spoke_length.to_s, false, false)
+ @positions['ac' + spoke_length.to_s] = centre
+ a1_corner = nil
+ end_of_previous_arc = nil
+
+ # Do each arc-spoke-base set
+ (?a...(?a + spokes)).each do |arc_code|
+ arc = arc_code.chr
+ base = Position.new(arc, false, true)
+ this_arc = Array.new
+
+ # build the arc
+ (1..arc_length).each do |arc_position|
+ position_name = arc + arc_position.to_s
+ arc_place = Position.new(position_name, arc_position == 4, false)
+ arc_place.neighbours = []
+ @positions[position_name] = arc_place
+ this_arc << arc_place
+ a1_corner = a1_corner || arc_place
+ end
+ (0...arc_length).each do |arc_position|
+ if arc_position > 0
+ this_arc[arc_position].neighbours << this_arc[arc_position - 1]
+ end
+ if arc_position < (arc_length - 1)
+ this_arc[arc_position].neighbours << this_arc[arc_position + 1]
+ end
+ end
+
+ # build the spoke
+ this_spoke = Array.new
+ (1..(spoke_length - 1)).each do |spoke_position|
+ position_name = arc + "c" + spoke_position.to_s
+ spoke_place = Position.new(position_name, spoke_position == 3, false)
+ spoke_place.neighbours = []
+ @positions[position_name] = spoke_place
+ this_spoke << spoke_place
+ end
+ (0...(spoke_length - 1)).each do |spoke_position|
+ if spoke_position > 0
+ this_spoke[spoke_position].neighbours << this_spoke[spoke_position - 1]
+ end
+ if spoke_position < spoke_length - 2
+ this_spoke[spoke_position].neighbours << this_spoke[spoke_position + 1]
+ end
+ end
+
+ # tie the spoke and arc together,
+ this_arc[0].neighbours << this_spoke[0]
+ this_spoke[0].neighbours << this_arc[0]
+
+ # tie the spoke to the centre, and
+ this_spoke[-1].neighbours << @centre
+ @centre.neighbours << this_spoke[-1]
+
+ # tie the base to the arc
+ base = Position.new(arc, false, true)
+ @positions[arc] = base
+ base.neighbours << this_arc[0]
+ this_arc[0].neighbours << base
+
+ # record the ends of the arc for tying to adjacent arcs
+ if end_of_previous_arc
+ end_of_previous_arc.neighbours << this_arc[0]
+ this_arc[0].neighbours << end_of_previous_arc
+ end
+ end_of_previous_arc = this_arc[-1]
+
+ end # arc
+
+ # tie both ends of the rim together
+ a1_corner.neighbours << end_of_previous_arc
+ end_of_previous_arc.neighbours << a1_corner
+
+ cache_valid_moves
+
+ end # def
+
+ def to_s
+ layout
+ end
+
+ def to_str
+ to_s
+ end
+
+
+ # For each position, show its name and what it touches
+ def layout
+ out_string = ""
+ @positions.keys.sort.each do |position|
+ out_string << sprintf("%s touches ", @positions[position])
+ @positions[position].neighbours.each do |neighbour|
+ out_string << sprintf("%s, ", neighbour)
+ end
+ out_string << sprintf("\n")
+ end
+ out_string
+ end
+
+
+ # Precompute the valid moves for this board, and the distances between each
+ # pair of positions
+ def cache_valid_moves
+ # A hash of arrays. The has key is the name of a positions. The array
+ # element [i] stores the positions that are i spaces from here
+ @valid_moves = Hash.new
+ # A hash of hashes. Given two names, return the shortest distance between
+ # the two locations
+ @distance_between = Hash.new
+ @positions.each do |place, position|
+ @valid_moves[place] = Array.new
+ @distance_between[place] = Hash.new
+ @valid_moves[place][0] = [@positions[place]]
+ @distance_between[place][place] = 0
+ # Find the shortest routes by Dijkstra's algorithm
+ agenda = [position]
+ closed_list = [position]
+ i = 1
+ while not agenda.empty?
+ @valid_moves[place][i] = []
+ new_agenda = []
+ agenda.each do |pos|
+ valid_extensions = pos.neighbours.reject {|new_position| closed_list.include?(new_position) }
+ @valid_moves[place][i] += valid_extensions
+ valid_extensions.each {|ext| @distance_between[place][ext.place] ||= i }
+ closed_list += valid_extensions
+ new_agenda += valid_extensions
+ end
+ agenda = new_agenda
+ i += 1
+ end
+ end
+ end
+
+end
+
+
+# Each piece on the board is an object
+class Piece
+ attr_reader :colour
+ attr_accessor :position, :contains, :captured
+
+ def initialize(number, position, colour)
+ @number = number
+ @position = position
+ @colour = colour
+ @captured = false
+ @contains = []
+ end
+
+ def name
+ @colour + @number.to_s
+ end
+
+ def to_s
+ self.name
+ end
+
+ def to_str
+ to_s
+ end
+
+ def move_to(new_position)
+ @position = new_position
+ @contains.each {|c| c.move_to(new_position)}
+ end
+
+ # Caputre another piece
+ def capture(other_piece)
+ if @position = other_piece.position
+ @contains << other_piece
+ @contains += other_piece.contains
+ other_piece.contains = []
+ other_piece.captured = true
+ else
+ raise(InvalidCaptureError,
+ "Piece #{self.name} cannot capture #{other_piece.name}: different locations")
+ end
+ end
+
+end
+
+
+# A move in a game
+class Move
+ attr_reader :piece, :destination
+
+ def initialize(piece, destination, via_base = false)
+ @piece = piece
+ @destination = destination
+ @via_base = via_base
+ end
+
+ def via_base?
+ @via_base
+ end
+
+ # Write a move to a string
+ # Note the inverse, String#to_move, is defined below
+ def to_s
+ if @via_base
+ if @destination.base?
+ @piece.to_s + " " + @destination.to_s
+ else
+ @piece.to_s + " " + piece.colour + " " + @destination.to_s
+ end
+ else
+ @piece.to_s + " " + @destination.to_s
+ end
+ end
+
+ def to_str
+ to_s
+ end
+
+end
+
+
+
+# A class to record each of the states previously found in a game.
+# Note that this is a deep copy of the pieces and what they've captured, so
+# you'll need to convert back
+class GameState
+ attr_accessor :move, :player, :pieces_after_move
+
+ def initialize(move, player, pieces)
+ @move = move
+ @player = player
+ @pieces_after_move = Hash.new
+ pieces.each {|k, p| @pieces_after_move[k] = p.dup}
+ @pieces_after_move.each_value {|p| p.contains = []}
+ # and now to make the captured pieces point to the copies
+ pieces.each do |k, p|
+ p.contains.each do |captured_piece|
+ @pieces_after_move[k].capture(@pieces_after_move[captured_piece.name])
+ end
+ end
+ end
+
+ def ==(other)
+ @move.to_s == other.move.to_s and
+ @player == other.player and
+ @piece_after_move == other.pieces_after_move
+ end
+
+end
+
+
+# A game of Trap the Cap. It keeps a history of all previous states.
+class Game
+
+ attr_reader :history
+ attr_reader :current_player, :players
+ attr_reader :board
+ attr_reader :pieces
+
+ # Create a new game
+ def initialize(players = 6, spokes = 6, spoke_length = 6, arc_length = 6,
+ pieces_each = 6)
+ @board = Board.new(spokes, spoke_length, arc_length)
+ @history = []
+ @pieces = Hash.new
+ @players = case
+ when players == 2 ; ['a', 'd']
+ when players == 3 ; ['a', 'c', 'e']
+ when players == 4 ; ['a', 'b', 'd', 'e']
+ when players == 5 ; ['a', 'b', 'c', 'd', 'e']
+ when players == 6 ; ['a', 'b', 'c', 'd', 'e', 'f']
+ end
+ @current_player = 'a'
+ @players.each do |player|
+ players_base = @board.positions[player]
+ (1..pieces_each).each do |count|
+ piece = Piece.new(count, players_base, player)
+ @pieces[player + count.to_s] = piece
+ end
+ end
+ end
+
+
+ # Apply a single move to a game.
+ def apply_move!(move, player = @current_player)
+ # Check the move is a valid one
+ raise(InvalidMoveError, "Piece #{move.piece} does not exist") unless @pieces.has_key?(move.piece.name)
+ raise(InvalidMoveError, "Player #{player} moving piece #{move.piece}") unless move.piece.colour == player
+ raise(InvalidMoveError, "Attempting to move captured piece #{move.piece}") if move.piece.captured
+ raise(InvalidMoveError, "Attempting to move #{move.piece} onto or via base without captured pieces") if move.via_base? and move.piece.contains.empty?
+ if move.destination.safe?
+ if (@pieces.find_all {|k, p| p.position == move.destination}).length >= 3
+ raise(InvalidMoveError, "Attempting to move #{move.piece} onto safe position #{move.destination} when there are already three or more pieces there")
+ end
+ end
+ if move.via_base?
+ moved_distance = board.distance_between[move.piece.position.place][player] +
+ board.distance_between[player][move.destination.place]
+ else
+ moved_distance = board.distance_between[move.piece.position.place][move.destination.place]
+ end
+ raise(InvalidMoveError, "Attempting to move piece #{move.piece} #{moved_distance} places (from #{move.piece.position} to #{move.destination})") if moved_distance < 1 or moved_distance > 6
+
+ # Apply this move
+ move.piece.move_to(move.destination)
+
+ # Capture anything already there (unless it's a safe place or a base,
+ # or our own colour, or already captured)
+ unless move.destination.safe? or move.destination.base?
+ @pieces.each do |name, target_piece|
+ if target_piece.position == move.destination and
+ target_piece != move.piece and
+ not move.piece.contains.member?(target_piece) and
+ target_piece.colour != player and
+ not target_piece.captured
+ move.piece.capture(target_piece)
+ end
+ end
+ end
+
+ # If the move was via our base, drop all captured pieces
+ if move.via_base?
+ capturers_base = board.positions[move.piece.colour]
+ move.piece.contains.each do |captured_piece|
+ captured_piece.move_to capturers_base
+ captured_piece.captured = false if captured_piece.colour == move.piece.colour
+ end
+ move.piece.contains = []
+ end
+
+ # Record the new stae
+ this_game_state = GameState.new(move, player, @pieces)
+ @history << this_game_state
+
+ # Retain only players that have uncaptured pieces.
+ # If there's only one player with uncaptured pieces, declare a win.
+ potential_players = []
+ @players.each do |p|
+ if (@pieces.values.select {|piece| piece.colour == p}).any? {|piece| not piece.captured}
+ potential_players << p
+ end
+ # potential_players << p if (@pieces.values.select {|p| p.colour == @current_player}).any? {|p| not p.captured}
+ end
+ if potential_players.length <= 1
+ raise(GameWonNotice, "Game won by #{potential_players[0]}")
+ end
+ @players = potential_players.sort
+ end
+
+ # Undo a move
+ def undo_move!
+ if @history.length > 1
+ # general case
+ state_to_restore = @history[-2]
+ @current_player = @history[-1].player
+ @pieces.each do |name, piece|
+ copy_piece = state_to_restore.pieces_after_move[name]
+ piece.position = copy_piece.position
+ piece.captured = copy_piece.captured
+ piece.contains = []
+ copy_piece.contains.each do |p|
+# piece.capture(@pieces[p.name])
+ piece.contains << @pieces[p.name]
+ end
+ end
+ @history.pop
+ elsif @history.length == 1
+ # reset to start
+ @current_player = 'a'
+ @pieces.each do |name, piece|
+ piece.position = @board.positions[piece.colour]
+ piece.captured = false
+ piece.contains = []
+ end
+ @history.pop
+ end
+ end
+
+ # Apply a list of moves in order
+ def apply_moves!(moves)
+ moves.each do |move|
+ if move.via_base?
+ moved_distance = board.distance_between[move.piece.position.place][@current_player] +
+ board.distance_between[@current_player][move.destination.place]
+ else
+ moved_distance = board.distance_between[move.piece.position.place][move.destination.place]
+ end
+ self.apply_move!(move, @current_player)
+ next_player! unless moved_distance == 6
+ end
+ end
+
+
+ # Set the current player to be the next player
+ def next_player!
+ original_player = @current_player
+ begin
+ if @current_player == @players[-1]
+ @current_player = @players[0]
+ else
+ @current_player = @players[@players.index(@current_player) + 1]
+ end
+ end while (@pieces.values.select {|p| p.colour == @current_player}).all? {|p| p.captured} and @current_player != original_player
+ @current_player
+ end
+
+
+ # Return an array of all possible moves from this state, given the die roll
+ # and the active player
+ def possible_moves(die_result, player = @current_player)
+ moves = []
+ @pieces.each do |key, piece|
+ # only move current player's pieces, and only if they're not captured
+ if piece.colour == player and (not piece.captured)
+ (@board.valid_moves[piece.position.place][die_result]).each do |destination|
+ if destination.safe?
+ if (@pieces.find_all {|k, p| p.position == destination}).length < 3
+ moves << Move.new(piece, destination, false)
+ end
+ else
+ moves << Move.new(piece, destination, false) unless destination.base?
+ end
+ end
+ # if we can move to our base (but not already on it), add moves via that...
+ if @board.distance_between[piece.position.place][player] <= die_result and
+ not piece.position.place == player and
+ not piece.contains.empty?
+ distance_after_base = die_result - @board.distance_between[piece.position.place][player]
+ (@board.valid_moves[player][distance_after_base]).each do |destination|
+ if destination.safe?
+ if (@pieces.find_all {|k, p| p.position == destination}).length < 3
+ moves << Move.new(piece, destination, true)
+ end
+ else
+ moves << Move.new(piece, destination, true)
+ end
+ end
+ end
+ end
+ end
+ moves
+ end
+
+
+ def build_state_string
+ outstr = "Current player = #{@current_player}\n"
+ @pieces.keys.sort.each do |piece_name|
+ if @pieces[piece_name].captured
+ outstr << "Piece #{piece_name} captured, at #{@pieces[piece_name].position}\n"
+ else
+ outstr << "Piece #{piece_name} is at #{@pieces[piece_name].position}, holds #{(@pieces[piece_name].contains.collect{|c| c.name}).join(' ')}\n"
+ end
+ end
+ outstr
+ end
+
+ # Show the state of the board
+ def show_state
+ puts build_state_string
+# @pieces.keys.sort.each do |piece_name|
+# if @pieces[piece_name].captured
+# puts "Piece #{piece_name} captured, at #{@pieces[piece_name].position}"
+# else
+# puts "Piece #{piece_name} is at #{@pieces[piece_name].position}, holds #{(@pieces[piece_name].contains.collect{|c| c.name}).join(' ')}"
+# end
+# end
+ end
+
+ def to_s
+ show_state
+ end
+
+ def to_str
+ to_s
+ end
+
+
+ # Given a set of lines from an input file, turn them into a Game object and
+ # a set of Move objects.
+ # Note the multiple return values.
+ # Class method
+ def Game.read_game(gamelines)
+ gamelines.each {|l| l.chomp!}
+ game = Game.new(gamelines[0].to_i, 6, 6, 6, 6)
+ moves = []
+ gamelines[1..-2].each {|m| moves << m.to_move(game)}
+ return game, moves, gamelines[-1].to_i
+ end
+
+
+end
+
+
+# Extension to String class to convert a move-description string into a Move object.
+# This is the inverse of the Move#to_s method
+class String
+ def to_move(game)
+ move_elements = self.downcase.split
+ piece_name = move_elements[0]
+ destination_name = move_elements[-1]
+ if destination_name.length > 2 and
+ destination_name[-2,2] == game.board.centre.place[-2,2]
+ destination_name = game.board.centre.place
+ end
+ raise(InvalidMoveError, "Invalid piece in move read") unless game.pieces.has_key?(piece_name)
+ raise(InvalidMoveError, "Invalid destination in move read") unless game.board.positions.has_key?(destination_name)
+ # Deal with the synonyms for the centre position
+ via_base = (destination_name.length == 1 or move_elements.length > 2)
+ Move.new(game.pieces[piece_name], game.board.positions[destination_name], via_base)
+ end
+end
+
+
+# Read a game description file and convert it into a Game object and set of Move objects.
+# Note that Game.read_game method returns multiple values, so this one does too.
+class IO
+ def IO.read_game(filename)
+ gamelines = IO.readlines(filename)
+ return Game.read_game(gamelines)
+ end
+end
--- /dev/null
+# == Synopsis
+#
+# Play a game of Trap the Cap.
+#
+# == Author
+# Neil Smith
+#
+# == Change history
+# Version 1.1:: 23 April 2008
+
+require 'lib/libttc'
+require 'lib/libpplayer'
+
+# Play a game to completion, given a set of player agents.
+class GameHandler
+
+ attr_reader :game
+
+ # Create a game handler that uses a set of players
+ def initialize(players, limit = 5000, verbose = false, very_verbose = false)
+ @game = Game.new(players.length)
+ @verbose = verbose
+ @very_verbose = very_verbose
+ @limit = limit
+
+ # Give each player a name
+ @named_players = Hash.new
+ (@game.players.zip players).each do |kv|
+ @named_players[kv[0]] = kv[1]
+ end
+ end
+
+ # Play a game of Trap the Cap. If players make illegal moves, disqualify them and restart the game.
+ # Terminate the game if there's a winner, there's only one player left,
+ # or the game has gone on too long.
+ def play
+ while @game.history.length < @limit
+ roll = rand(6) + 1
+ move_to_apply = @named_players[@game.current_player].best_move(@game, roll)
+ puts "Move #{@game.history.length + 1}: Player #{@game.current_player} rolled #{roll}: making move #{move_to_apply}" if @verbose
+ @game.apply_moves! [move_to_apply]
+ puts @game if @very_verbose
+ end
+ puts "Game terminated after #{@game.history.length} moves" if @verbose
+ [:draw, @limit]
+ rescue GameWonNotice => win_notification
+ winner = win_notification.message[-1,1]
+ puts "Game won by #{winner} in #{@game.history.length} moves" if @verbose
+ [@named_players[winner], @game.history.length]
+ rescue InvalidCaptureError, InvalidMoveError
+ puts "Disqualifying player #{@game.current_player}" if @verbose
+ @named_players.delete @game.current_player
+ if @named_players.length > 1
+ retry
+ else
+ puts "Game won by #{@named_players.keys[0]} by default" if @verbose
+ [@named_players[@named_players.keys[0]], 0]
+ end
+ end
+end
+
\ No newline at end of file
--- /dev/null
+3
+A1 AC2
+C4 B5
+E1 EC5
+E2 E3
+A1 EC5
+C4 B2
+4
\ No newline at end of file
--- /dev/null
+# == Synopsis
+#
+# Use a GA to breed a good potential player
+#
+# == Author
+# Neil Smith
+#
+# == Change history
+# Version 1.1:: 23 April 2008
+
+
+require 'libttc'
+require 'libpplayer'
+require 'libgenetics'
+require 'play'
+
+class Population
+ # Use tournament selection to pick an individual for the next generation
+ def tournament_select_one(winner_success_chance = 0.8, max_game_length= 1000, verbose = false)
+ player_count = rand(5) + 2
+ pool_size = @individuals.length
+ players = []
+ 1.upto(player_count) { players << @individuals[rand(pool_size)].to_potential_player }
+ game = GameHandler.new(players, max_game_length, false, false)
+ winner, length = game.play
+ puts "Winner = #{winner} in #{length} moves. Game had #{player_count} players" if verbose
+ # If the game was a draw, or the winner is unlucky, pick a parent at random
+ if winner == :draw or rand > winner_success_chance
+ successful_player = players[rand(player_count)]
+ else
+ successful_player = winner
+ end
+ successful_player
+ end
+
+ # Select a new population the same size as the current population
+ def tournament_select_population(winner_success_chance = 0.8, max_game_length = 1000, verbose = false)
+ new_population = []
+ 1.upto(@individuals.length) do
+ new_population << tournament_select_one(winner_success_chance, max_game_length, verbose).to_genome
+ puts "Created #{new_population.length} indivduals" if verbose
+ end
+ new_population
+ end
+
+end
+
+class Potential_player
+ # Convert a player to a bitstring
+ def to_bitstring
+ (@friend_pull * 4).to_i.to_bitstring(4).gray_encode +
+ (@enemy_pull * 4).to_i.to_bitstring(4).gray_encode +
+ (@base_pull * 4).to_i.to_bitstring(4).gray_encode +
+ @safe_bonus.to_bitstring(4).gray_encode +
+ @capture_bonus.to_bitstring(4).gray_encode
+ end
+
+ # Convert a player to a genome
+ def to_genome
+ Genome.new(self.to_bitstring)
+ end
+end
+
+
+class Genome
+
+ # Create a potential player from a genome
+ def to_potential_player
+ friend_pull = @genome[0, 4].gray_decode.to_decimal.to_f / 4
+ enemy_pull = @genome[4, 4].gray_decode.to_decimal.to_f / 4
+ base_pull = @genome[8, 4].gray_decode.to_decimal.to_f / 4
+ safe_bonus = @genome[12, 4].gray_decode.to_decimal
+ capture_bonus = @genome[16, 4].gray_decode.to_decimal
+ Potential_player.new({:friend_pull => friend_pull,
+ :enemy_pull => enemy_pull, :base_pull => base_pull,
+ :safe_bonus => safe_bonus, :capture_bonus => capture_bonus})
+ end
+end
--- /dev/null
+require '/home/neil/programming/ruby/programming-collective/intelligence/k-means-clustering'\r
+\r
+def read_genome_file(filename)\r
+ genomes = []\r
+ IO.foreach(filename) { |line| genomes << line.chomp.split('').collect {|i| i.to_i} }\r
+ genomes\r
+end\r
+\r
+def find_centroid_sets(rows, k = 10, n = 10)\r
+ centroid_set = []\r
+ 1.upto(n) do\r
+ centroid_set << (k_means_cluster(rows, k, :domain => :discrete) {|x, y| hamming_distance x, y})\r
+ end\r
+ centroid_set\r
+end\r
+\r
+def order_centroids_by_cluster_size(centroids, rows)\r
+ clusters = clusters_of_centroids(centroids, rows) {|x, y| hamming_distance x, y}\r
+ cluster_sizes = clusters.collect {|c| c.length}\r
+ sized_centroids = centroid.zip(cluster_sizes)\r
+ sorted_sized_centroids = (sized_centroids.sort_by {|t| t[1]}).reverse\r
+end\r
+\r
+def best_centroids(centroid_set)\r
+ centroid_set.collect {|tc| tc[0][0]}\r
+end\r
+
\ No newline at end of file
--- /dev/null
+#!/usr/bin/ruby -w
+#
+# == Synopsis
+#
+# Play one move of a Trap the Cap game
+#
+# == Usage
+# ttc [ -b | --board-size SIZE ] [ -i | --input FILE ] [ -r | --robot ROBOT ] [ -h | --help ]
+#
+# == Author
+# Neil Smith
+
+require File.join(File.dirname(__FILE__), '..', 'lib', 'libttc')
+require 'open3'
+require 'timeout'
+require 'optparse'
+require 'rdoc/usage'
+
+
+class InvalidRobotError < StandardError
+end
+
+class NoInputFileError < StandardError
+end
+
+class InvalidMoveInHistoryError < StandardError
+end
+
+class GameWonInHistoryError < StandardError
+end
+
+
+
+board = Board.new(6, 5, 6)
+puts board
+
--- /dev/null
+# vim: ts=2:sw=2:sts=2:et:fdm=marker
+require 'tmpdir'
+require 'socket'
+require 'fileutils'
+require 'rbconfig'
+require 'thread'
+require 'yaml'
+
+class Object
+ def systemu(*a, &b) SystemUniversal.new(*a, &b).systemu end
+end
+
+class SystemUniversal
+#
+# constants
+#
+ SystemUniversal::VERSION = '1.2.0' unless defined? SystemUniversal::VERSION
+ def version() SystemUniversal::VERSION end
+#
+# class methods
+#
+
+ @host = Socket.gethostname
+ @ppid = Process.ppid
+ @pid = Process.pid
+ @turd = ENV['SYSTEMU_TURD']
+
+ c = ::Config::CONFIG
+ ruby = File.join(c['bindir'], c['ruby_install_name']) << c['EXEEXT']
+ @ruby = if system('%s -e 42' % ruby)
+ ruby
+ else
+ system('%s -e 42' % 'ruby') ? 'ruby' : warn('no ruby in PATH/CONFIG')
+ end
+
+ class << self
+ %w( host ppid pid ruby turd ).each{|a| attr_accessor a}
+ end
+
+#
+# instance methods
+#
+
+ def initialize argv, opts = {}, &block
+ getopt = getopts opts
+
+ @argv = argv
+ @block = block
+
+ @stdin = getopt[ ['stdin', 'in', '0', 0] ]
+ @stdout = getopt[ ['stdout', 'out', '1', 1] ]
+ @stderr = getopt[ ['stderr', 'err', '2', 2] ]
+ @env = getopt[ 'env' ]
+ @cwd = getopt[ 'cwd' ]
+
+ @host = getopt[ 'host', self.class.host ]
+ @ppid = getopt[ 'ppid', self.class.ppid ]
+ @pid = getopt[ 'pid', self.class.pid ]
+ @ruby = getopt[ 'ruby', self.class.ruby ]
+ end
+
+ def systemu
+ tmpdir do |tmp|
+ c = child_setup tmp
+ status = nil
+
+ begin
+ thread = nil
+
+ quietly{
+ IO.popen "#{ @ruby } #{ c['program'] }", 'r+' do |pipe|
+ line = pipe.gets
+ case line
+ when %r/^pid: \d+$/
+ cid = Integer line[%r/\d+/]
+ else
+ begin
+ buf = pipe.read
+ buf = "#{ line }#{ buf }"
+ e = Marshal.load buf
+ raise unless Exception === e
+ raise e
+ rescue
+ raise "wtf?\n#{ buf }\n"
+ end
+ end
+ thread = new_thread cid, @block if @block
+ pipe.read rescue nil
+ end
+ }
+ status = $?
+ ensure
+ if thread
+ begin
+ class << status
+ attr 'thread'
+ end
+ status.instance_eval{ @thread = thread }
+ rescue
+ 42
+ end
+ end
+ end
+
+ if @stdout or @stderr
+ open(c['stdout']){|f| relay f => @stdout} if @stdout
+ open(c['stderr']){|f| relay f => @stderr} if @stderr
+ status
+ else
+ [status, IO.read(c['stdout']), IO.read(c['stderr'])]
+ end
+ end
+ end
+
+ def new_thread cid, block
+ q = Queue.new
+ Thread.new(cid) do |cid|
+ current = Thread.current
+ current.abort_on_exception = true
+ q.push current
+ block.call cid
+ end
+ q.pop
+ end
+
+ def child_setup tmp
+ stdin = File.expand_path(File.join(tmp, 'stdin'))
+ stdout = File.expand_path(File.join(tmp, 'stdout'))
+ stderr = File.expand_path(File.join(tmp, 'stderr'))
+ program = File.expand_path(File.join(tmp, 'program'))
+ config = File.expand_path(File.join(tmp, 'config'))
+
+ if @stdin
+ open(stdin, 'w'){|f| relay @stdin => f}
+ else
+ FileUtils.touch stdin
+ end
+ FileUtils.touch stdout
+ FileUtils.touch stderr
+
+ c = {}
+ c['argv'] = @argv
+ c['env'] = @env
+ c['cwd'] = @cwd
+ c['stdin'] = stdin
+ c['stdout'] = stdout
+ c['stderr'] = stderr
+ c['program'] = program
+ open(config, 'w'){|f| YAML.dump c, f}
+
+ open(program, 'w'){|f| f.write child_program(config)}
+
+ c
+ end
+
+ def quietly
+ v = $VERBOSE
+ $VERBOSE = nil
+ yield
+ ensure
+ $VERBOSE = v
+ end
+
+ def child_program config
+ <<-program
+ PIPE = STDOUT.dup
+ begin
+ require 'yaml'
+
+ config = YAML.load(IO.read('#{ config }'))
+
+ argv = config['argv']
+ env = config['env']
+ cwd = config['cwd']
+ stdin = config['stdin']
+ stdout = config['stdout']
+ stderr = config['stderr']
+
+ Dir.chdir cwd if cwd
+ env.each{|k,v| ENV[k.to_s] = v.to_s} if env
+
+ STDIN.reopen stdin
+ STDOUT.reopen stdout
+ STDERR.reopen stderr
+
+ PIPE.puts "pid: \#{ Process.pid }"
+ PIPE.flush ### the process is ready yo!
+ PIPE.close
+
+ exec *argv
+ rescue Exception => e
+ PIPE.write Marshal.dump(e) rescue nil
+ exit 42
+ end
+ program
+ end
+
+ def relay srcdst
+ src, dst, ignored = srcdst.to_a.first
+ if src.respond_to? 'read'
+ while((buf = src.read(8192))); dst << buf; end
+ else
+ src.each{|buf| dst << buf}
+ end
+ end
+
+ def tmpdir d = Dir.tmpdir, max = 42, &b
+ i = -1 and loop{
+ i += 1
+
+ tmp = File.join d, "systemu_#{ @host }_#{ @ppid }_#{ @pid }_#{ rand }_#{ i += 1 }"
+
+ begin
+ Dir.mkdir tmp
+ rescue Errno::EEXIST
+ raise if i >= max
+ next
+ end
+
+ break(
+ if b
+ begin
+ b.call tmp
+ ensure
+ FileUtils.rm_rf tmp unless SystemU.turd
+ end
+ else
+ tmp
+ end
+ )
+ }
+ end
+
+ def getopts opts = {}
+ lambda do |*args|
+ keys, default, ignored = args
+ catch('opt') do
+ [keys].flatten.each do |key|
+ [key, key.to_s, key.to_s.intern].each do |key|
+ throw 'opt', opts[key] if opts.has_key?(key)
+ end
+ end
+ default
+ end
+ end
+ end
+end
+
+SystemU = SystemUniversal unless defined? SystemU
+
+
+
+
+
+
+
+
+
+
+
+
+
+if $0 == __FILE__
+#
+# date
+#
+ date = %q( ruby -e" t = Time.now; STDOUT.puts t; STDERR.puts t " )
+
+ status, stdout, stderr = systemu date
+ p [status, stdout, stderr]
+
+ status = systemu date, 1=>(stdout = '')
+ p [status, stdout]
+
+ status = systemu date, 2=>(stderr = '')
+ p [status, stderr]
+#
+# sleep
+#
+ sleep = %q( ruby -e" p(sleep(1)) " )
+ status, stdout, stderr = systemu sleep
+ p [status, stdout, stderr]
+
+ sleep = %q( ruby -e" p(sleep(42)) " )
+ status, stdout, stderr = systemu(sleep){|cid| Process.kill 9, cid}
+ p [status, stdout, stderr]
+#
+# env
+#
+ env = %q( ruby -e" p ENV['A'] " )
+ status, stdout, stderr = systemu env, :env => {'A' => 42}
+ p [status, stdout, stderr]
+#
+# cwd
+#
+ env = %q( ruby -e" p Dir.pwd " )
+ status, stdout, stderr = systemu env, :cwd => Dir.tmpdir
+ p [status, stdout, stderr]
+end
--- /dev/null
+K 25
+svn:wc:ra_dav:version-url
+V 43
+/svn/njae/!svn/ver/24/TrapTheCap/trunk/test
+END
+libttc_test.rb
+K 25
+svn:wc:ra_dav:version-url
+V 58
+/svn/njae/!svn/ver/24/TrapTheCap/trunk/test/libttc_test.rb
+END
--- /dev/null
+8
+
+dir
+68
+http://scripts.njae.me.uk/svn/njae/TrapTheCap/trunk/test
+http://scripts.njae.me.uk/svn/njae
+
+
+
+2008-03-28T15:47:09.723420Z
+24
+neil
+
+
+svn:special svn:externals svn:needs-lock
+
+
+
+
+
+
+
+
+
+
+
+0ada9808-85ab-4924-adda-5bf89eae3818
+\f
+libttc_test.rb
+file
+
+
+
+
+2008-03-26T13:52:59.000000Z
+0b82863be49d0bcbd00bcedb9db8a1e4
+2008-03-28T15:47:09.723420Z
+24
+neil
+\f
--- /dev/null
+# test/game_test.rb
+require File.join(File.dirname(__FILE__), '..', 'lib', 'libttc')
+require 'test/unit'
+
+class GameTest < Test::Unit::TestCase
+
+ def test_init
+ assert_nothing_raised { Game.new(6,6,6,6,6) }
+ assert_equal [], Game.new(6,6,6,6,6).history
+ end
+
+
+ def test_game_init
+ game = Game.new(6,6,6,6,6)
+
+ pieceA1 = game.pieces['a1']
+ pieceA2 = game.pieces['a2']
+ pieceB2 = game.pieces['b2']
+
+ posA = game.board.positions['a']
+ posB = game.board.positions['b']
+ posA3 = game.board.positions['a3']
+ posA4 = game.board.positions['a4']
+ posA5 = game.board.positions['a5']
+
+ moveA2A = Move.new(pieceA2, posA , true)
+ moveA1A5 = Move.new(pieceA1, posA5)
+ moveA2A4 = Move.new(pieceA2, posA4)
+ moveA2A3 = Move.new(pieceA2, posA3)
+ moveB2A5 = Move.new(pieceB2, posA5)
+ moveB2A3 = Move.new(pieceB2, posA3)
+ moveB2A4 = Move.new(pieceB2, posA4)
+
+ assert_equal [], game.history
+ assert_equal game.pieces['a1'].position, game.board.positions['a']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['b']
+ assert_equal game.pieces['b2'].captured, false
+ assert_equal game.pieces['b2'].contains, []
+ end
+
+
+ def test_single_moves_1
+ game = Game.new(6,6,6,6,6)
+
+ pieceA1 = game.pieces['a1']
+ pieceA2 = game.pieces['a2']
+ pieceB2 = game.pieces['b2']
+
+ posA = game.board.positions['a']
+ posB = game.board.positions['b']
+ posA3 = game.board.positions['a3']
+ posA4 = game.board.positions['a4']
+ posA5 = game.board.positions['a5']
+
+ moveA2A = Move.new(pieceA2, posA , true)
+ moveA1A5 = Move.new(pieceA1, posA5)
+ moveA2A4 = Move.new(pieceA2, posA4)
+ moveA2A3 = Move.new(pieceA2, posA3)
+ moveB2A5 = Move.new(pieceB2, posA5)
+ moveB2A3 = Move.new(pieceB2, posA3)
+ moveB2A4 = Move.new(pieceB2, posA4)
+
+ assert_equal [], game.history
+ assert_equal game.pieces['a1'].position, game.board.positions['a']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['b']
+ assert_equal game.pieces['b2'].captured, false
+ assert_equal game.pieces['b2'].contains, []
+
+ assert_raise(InvalidMoveError) {game.apply_move!(moveA1A5, 'b')}
+
+ assert_equal [], game.history
+ assert_equal game.pieces['a1'].position, game.board.positions['a']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['b']
+ assert_equal game.pieces['b2'].captured, false
+ assert_equal game.pieces['b2'].contains, []
+
+ game.apply_move!(moveA1A5, 'a')
+ assert_equal game.history.length, 1
+ assert_equal game.pieces['a1'].position, game.board.positions['a5']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['b']
+ assert_equal game.pieces['b2'].captured, false
+ assert_equal game.pieces['b2'].contains, []
+ end
+
+ def test_separate_moves
+ game = Game.new(6,6,6,6,6)
+
+ pieceA1 = game.pieces['a1']
+ pieceA2 = game.pieces['a2']
+ pieceB2 = game.pieces['b2']
+
+ posA = game.board.positions['a']
+ posB = game.board.positions['b']
+ posA3 = game.board.positions['a3']
+ posA4 = game.board.positions['a4']
+ posA5 = game.board.positions['a5']
+
+ moveA2A = Move.new(pieceA2, posA , true)
+ moveA1A5 = Move.new(pieceA1, posA5)
+ moveA2A4 = Move.new(pieceA2, posA4)
+ moveA2A3 = Move.new(pieceA2, posA3)
+ moveB2A5 = Move.new(pieceB2, posA5)
+ moveB2A3 = Move.new(pieceB2, posA3)
+ moveB2A4 = Move.new(pieceB2, posA4)
+
+ assert_equal [], game.history
+ assert_equal game.pieces['a1'].position, game.board.positions['a']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['b']
+ assert_equal game.pieces['b2'].captured, false
+ assert_equal game.pieces['b2'].contains, []
+
+ game.apply_move!(moveA1A5, 'a')
+ assert_equal game.history.length, 1
+ assert_equal game.pieces['a1'].position, game.board.positions['a5']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['b']
+ assert_equal game.pieces['b2'].captured, false
+ assert_equal game.pieces['b2'].contains, []
+
+ game.apply_move!(moveB2A3, 'b')
+ assert_equal game.history.length, 2
+ assert_equal game.pieces['a1'].position, game.board.positions['a5']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['a3']
+ assert_equal game.pieces['b2'].captured, false
+ assert_equal game.pieces['b2'].contains, []
+ end
+
+
+
+ def test_captures
+ game = Game.new(6,6,6,6,6)
+
+ pieceA1 = game.pieces['a1']
+ pieceA2 = game.pieces['a2']
+ pieceB2 = game.pieces['b2']
+
+ posA = game.board.positions['a']
+ posB = game.board.positions['b']
+ posA3 = game.board.positions['a3']
+ posA4 = game.board.positions['a4']
+ posA5 = game.board.positions['a5']
+
+ moveA2A = Move.new(pieceA2, posA , true)
+ moveA1A5 = Move.new(pieceA1, posA5)
+ moveA2A4 = Move.new(pieceA2, posA4)
+ moveA2A3 = Move.new(pieceA2, posA3)
+ moveB2A5 = Move.new(pieceB2, posA5)
+ moveB2A3 = Move.new(pieceB2, posA3)
+ moveB2A4 = Move.new(pieceB2, posA4)
+
+ assert_equal [], game.history
+ assert_equal game.pieces['a1'].position, game.board.positions['a']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['b']
+ assert_equal game.pieces['b2'].captured, false
+ assert_equal game.pieces['b2'].contains, []
+
+ game.apply_move!(moveA1A5, 'a')
+ assert_equal game.history.length, 1
+ assert_equal game.pieces['a1'].position, game.board.positions['a5']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['b']
+ assert_equal game.pieces['b2'].captured, false
+ assert_equal game.pieces['b2'].contains, []
+
+ game.apply_move!(moveB2A5, 'b')
+ assert_equal game.history.length, 2
+ assert_equal game.pieces['a1'].position, game.board.positions['a5']
+ assert_equal game.pieces['a1'].captured, true
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['a5']
+ assert_equal game.pieces['b2'].captured, false
+ assert game.pieces['b2'].contains.include?(pieceA1)
+ assert_equal game.pieces['b2'].contains.length, 1
+ end
+
+
+ def test_no_captures_on_safe_spaces
+ game = Game.new(6,6,6,6,6)
+
+ pieceA1 = game.pieces['a1']
+ pieceA2 = game.pieces['a2']
+ pieceB2 = game.pieces['b2']
+
+ posA = game.board.positions['a']
+ posB = game.board.positions['b']
+ posA3 = game.board.positions['a3']
+ posA4 = game.board.positions['a4']
+ posA5 = game.board.positions['a5']
+
+ moveA2A = Move.new(pieceA2, posA , true)
+ moveA1A5 = Move.new(pieceA1, posA5)
+ moveA2A4 = Move.new(pieceA2, posA4)
+ moveA2A3 = Move.new(pieceA2, posA3)
+ moveB2A5 = Move.new(pieceB2, posA5)
+ moveB2A3 = Move.new(pieceB2, posA3)
+ moveB2A4 = Move.new(pieceB2, posA4)
+
+ assert_equal [], game.history
+ assert_equal game.pieces['a1'].position, game.board.positions['a']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['b']
+ assert_equal game.pieces['b2'].captured, false
+ assert_equal game.pieces['b2'].contains, []
+
+ game.apply_move!(moveA2A4, 'a')
+ assert_equal game.history.length, 1
+ assert_equal game.pieces['a1'].position, game.board.positions['a']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a4']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['b']
+ assert_equal game.pieces['b2'].captured, false
+ assert_equal game.pieces['b2'].contains, []
+
+ game.apply_move!(moveB2A4, 'b')
+ assert_equal game.history.length, 2
+ assert_equal game.pieces['a1'].position, game.board.positions['a']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a4']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['a4']
+ assert_equal game.pieces['b2'].captured, false
+ assert_equal game.pieces['b2'].contains, []
+ end
+
+ def test_move_after_captures
+ game = Game.new(6,6,6,6,6)
+
+ pieceA1 = game.pieces['a1']
+ pieceA2 = game.pieces['a2']
+ pieceB2 = game.pieces['b2']
+
+ posA = game.board.positions['a']
+ posB = game.board.positions['b']
+ posA3 = game.board.positions['a3']
+ posA4 = game.board.positions['a4']
+ posA5 = game.board.positions['a5']
+
+ moveA2A = Move.new(pieceA2, posA , true)
+ moveA1A5 = Move.new(pieceA1, posA5)
+ moveA2A4 = Move.new(pieceA2, posA4)
+ moveA2A3 = Move.new(pieceA2, posA3)
+ moveB2A5 = Move.new(pieceB2, posA5)
+ moveB2A3 = Move.new(pieceB2, posA3)
+ moveB2A4 = Move.new(pieceB2, posA4)
+
+ assert_equal [], game.history
+ assert_equal game.pieces['a1'].position, game.board.positions['a']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['b']
+ assert_equal game.pieces['b2'].captured, false
+ assert_equal game.pieces['b2'].contains, []
+
+ game.apply_move!(moveA1A5, 'a')
+ assert_equal game.history.length, 1
+ assert_equal game.pieces['a1'].position, game.board.positions['a5']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['b']
+ assert_equal game.pieces['b2'].captured, false
+ assert_equal game.pieces['b2'].contains, []
+
+ game.apply_move!(moveB2A5, 'b')
+ assert_equal game.history.length, 2
+ assert_equal game.pieces['a1'].position, game.board.positions['a5']
+ assert_equal game.pieces['a1'].captured, true
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['a5']
+ assert_equal game.pieces['b2'].captured, false
+ assert game.pieces['b2'].contains.include?(pieceA1)
+ assert_equal game.pieces['b2'].contains.length, 1
+
+ game.apply_move!(moveA2A4, 'a')
+ assert_equal game.history.length, 3
+ assert_equal game.pieces['a1'].position, game.board.positions['a5']
+ assert_equal game.pieces['a1'].captured, true
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a4']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['a5']
+ assert_equal game.pieces['b2'].captured, false
+ assert game.pieces['b2'].contains.include?(pieceA1)
+ assert_equal game.pieces['b2'].contains.length, 1
+
+ game.apply_move!(moveB2A3, 'b')
+ assert_equal game.history.length, 4
+ assert_equal game.pieces['a1'].position, game.board.positions['a3']
+ assert_equal game.pieces['a1'].captured, true
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a4']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['a3']
+ assert_equal game.pieces['b2'].captured, false
+ assert game.pieces['b2'].contains.include?(pieceA1)
+ assert_equal game.pieces['b2'].contains.length, 1
+ end
+
+
+ def test_game
+ game = Game.new(6,6,6,6,6)
+
+ pieceA1 = game.pieces['a1']
+ pieceA2 = game.pieces['a2']
+ pieceB2 = game.pieces['b2']
+
+ posA = game.board.positions['a']
+ posB = game.board.positions['b']
+ posA3 = game.board.positions['a3']
+ posA4 = game.board.positions['a4']
+ posA5 = game.board.positions['a5']
+
+ moveA2A = Move.new(pieceA2, posA , true)
+ moveA1A3 = Move.new(pieceA1, posA3)
+ moveA1A5 = Move.new(pieceA1, posA5)
+ moveA2A4 = Move.new(pieceA2, posA4)
+ moveA2A3 = Move.new(pieceA2, posA3)
+ moveB2A5 = Move.new(pieceB2, posA5)
+ moveB2A3 = Move.new(pieceB2, posA3)
+ moveB2A4 = Move.new(pieceB2, posA4)
+
+ assert_equal [], game.history
+ assert_equal game.pieces['a1'].position, game.board.positions['a']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['b']
+ assert_equal game.pieces['b2'].captured, false
+ assert_equal game.pieces['b2'].contains, []
+
+ game.apply_move!(moveA1A5, 'a')
+ assert_equal game.history.length, 1
+ assert_equal game.pieces['a1'].position, game.board.positions['a5']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['b']
+ assert_equal game.pieces['b2'].captured, false
+ assert_equal game.pieces['b2'].contains, []
+
+ game.apply_move!(moveB2A3, 'b')
+ assert_equal game.history.length, 2
+ assert_equal game.pieces['a1'].position, game.board.positions['a5']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['a3']
+ assert_equal game.pieces['b2'].captured, false
+ assert_equal game.pieces['b2'].contains, []
+
+ game.apply_move!(moveA2A4, 'a')
+ assert_equal game.history.length, 3
+ assert_equal game.pieces['a1'].position, game.board.positions['a5']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a4']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['a3']
+ assert_equal game.pieces['b2'].captured, false
+ assert_equal game.pieces['b2'].contains, []
+
+ game.apply_move!(moveB2A5, 'b')
+ assert_equal game.history.length, 4
+ assert_equal game.pieces['a1'].position, game.board.positions['a5']
+ assert_equal game.pieces['a1'].captured, true
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a4']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['a5']
+ assert_equal game.pieces['b2'].captured, false
+ assert game.pieces['b2'].contains.include?(pieceA1)
+ assert_equal game.pieces['b2'].contains.length, 1
+
+ assert_raise(InvalidMoveError) {game.apply_move!(moveA1A3, 'a')}
+ assert_equal game.history.length, 4
+ assert_equal game.pieces['a1'].position, game.board.positions['a5']
+ assert_equal game.pieces['a1'].captured, true
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a4']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['a5']
+ assert_equal game.pieces['b2'].captured, false
+ assert game.pieces['b2'].contains.include?(pieceA1)
+ assert_equal game.pieces['b2'].contains.length, 1
+
+ game.apply_move!(moveA2A3, 'a')
+ assert_equal game.history.length, 5
+ assert_equal game.pieces['a1'].position, game.board.positions['a5']
+ assert_equal game.pieces['a1'].captured, true
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a3']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['a5']
+ assert_equal game.pieces['b2'].captured, false
+ assert game.pieces['b2'].contains.include?(pieceA1)
+ assert_equal game.pieces['b2'].contains.length, 1
+
+ game.apply_move!(moveB2A4, 'b')
+ assert_equal game.history.length, 6
+ assert_equal game.pieces['a1'].position, game.board.positions['a4']
+ assert_equal game.pieces['a1'].captured, true
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a3']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['a4']
+ assert_equal game.pieces['b2'].captured, false
+ assert game.pieces['b2'].contains.include?(pieceA1)
+ assert_equal game.pieces['b2'].contains.length, 1
+
+ game.apply_move!(moveA2A4, 'a')
+ assert_equal game.history.length, 7
+ assert_equal game.pieces['a1'].position, game.board.positions['a4']
+ assert_equal game.pieces['a1'].captured, true
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a4']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['a4']
+ assert_equal game.pieces['b2'].captured, false
+ assert game.pieces['b2'].contains.include?(pieceA1)
+ assert_equal game.pieces['b2'].contains.length, 1
+
+ game.apply_move!(moveB2A3, 'b')
+ assert_equal game.history.length, 8
+ assert_equal game.pieces['a1'].position, game.board.positions['a3']
+ assert_equal game.pieces['a1'].captured, true
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a4']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['a3']
+ assert_equal game.pieces['b2'].captured, false
+ assert game.pieces['b2'].contains.include?(pieceA1)
+ assert_equal game.pieces['b2'].contains.length, 1
+
+ game.apply_move!(moveA2A3, 'a')
+ assert_equal game.history.length, 9
+ assert_equal game.pieces['a1'].position, game.board.positions['a3']
+ assert_equal game.pieces['a1'].captured, true
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a3']
+ assert_equal game.pieces['a2'].captured, false
+ assert game.pieces['a2'].contains.include?(pieceA1)
+ assert game.pieces['a2'].contains.include?(pieceB2)
+ assert_equal game.pieces['a2'].contains.length, 2
+ assert_equal game.pieces['b2'].position, game.board.positions['a3']
+ assert_equal game.pieces['b2'].captured, true
+ assert_equal game.pieces['b2'].contains, []
+
+ game.apply_move!(moveA2A, 'a')
+ assert_equal game.history.length, 10
+ assert_equal game.pieces['a1'].position, game.board.positions['a']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['a']
+ assert_equal game.pieces['b2'].captured, true
+ assert_equal game.pieces['b2'].contains, []
+ end
+
+ def test_apply_moves!
+ game = Game.new(3)
+ move_set = ['A1 A2', 'C1 C2', 'E1 E2']
+ assert_nothing_raised { move_set.collect { |m| m.to_move(game) } }
+ move_set_m = move_set.collect { |m| m.to_move(game) }
+ assert_nothing_raised { game.apply_moves! move_set_m }
+ end
+
+ def test_eliminations
+ game = Game.new(3, 6, 6, 6, 2)
+
+ pieceA1 = game.pieces['a1']
+ pieceA2 = game.pieces['a2']
+ pieceC1 = game.pieces['c1']
+ pieceC2 = game.pieces['c2']
+ pieceE1 = game.pieces['e1']
+ pieceE2 = game.pieces['e2']
+
+ posAC5 = game.board.positions['ac5']
+ posBC5 = game.board.positions['bc5']
+ posCC5 = game.board.positions['cc5']
+ posEC5 = game.board.positions['ec5']
+ posAC6 = game.board.positions['ac6']
+
+ move_set1 = ['A1 AC5', 'A2 AC5', 'A1 AC6',
+ 'C1 CC5', 'C2 CC5', 'C1 AC6'] # A1 now captured by C1
+ move_set2 = ['E1 EC5', 'E2 EC5', 'E1 AC6'] # C1+A1 now caputred by E1
+ move_set3 = ['A2 AC6'] # E1+C1+A1 captured by A2
+ move_set4 = ['C2 AC6'] # A2+E1+C1+A1 captured by C2. Player A now eliminated
+ move_set5 = ['E2 BC5']
+ move_set6 = ['C2 BC5'] # C2 (plus stack) captures E2. Player E now eliminated
+
+ assert_equal [], game.history
+ assert_equal game.pieces['a1'].position, game.board.positions['a']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['c1'].position, game.board.positions['c']
+ assert_equal game.pieces['c1'].captured, false
+ assert_equal game.pieces['c1'].contains, []
+ assert_equal game.pieces['c2'].position, game.board.positions['c']
+ assert_equal game.pieces['c2'].captured, false
+ assert_equal game.pieces['c2'].contains, []
+ assert_equal game.pieces['e1'].position, game.board.positions['e']
+ assert_equal game.pieces['e1'].captured, false
+ assert_equal game.pieces['e1'].contains, []
+ assert_equal game.pieces['e2'].position, game.board.positions['e']
+ assert_equal game.pieces['e2'].captured, false
+ assert_equal game.pieces['e2'].contains, []
+ assert_equal game.current_player, 'a'
+
+ game.apply_moves! move_set1.collect {|m| m.to_move(game)}
+ assert_equal game.history.length, 6
+ assert_equal game.pieces['a1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['a1'].captured, true
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['ac5']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['c1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['c1'].captured, false
+ assert game.pieces['c1'].contains.include?(pieceA1)
+ assert_equal game.pieces['c2'].position, game.board.positions['cc5']
+ assert_equal game.pieces['c2'].captured, false
+ assert_equal game.pieces['c2'].contains, []
+ assert_equal game.pieces['e1'].position, game.board.positions['e']
+ assert_equal game.pieces['e1'].captured, false
+ assert_equal game.pieces['e1'].contains, []
+ assert_equal game.pieces['e2'].position, game.board.positions['e']
+ assert_equal game.pieces['e2'].captured, false
+ assert_equal game.pieces['e2'].contains, []
+ assert_equal game.current_player, 'e'
+
+ game.apply_moves! move_set2.collect {|m| m.to_move(game)}
+ assert_equal game.pieces['a1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['a1'].captured, true
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['ac5']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['c1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['c1'].captured, true
+ assert_equal game.pieces['c1'].contains, []
+ assert_equal game.pieces['c2'].position, game.board.positions['cc5']
+ assert_equal game.pieces['c2'].captured, false
+ assert_equal game.pieces['c2'].contains, []
+ assert_equal game.pieces['e1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['e1'].captured, false
+ assert game.pieces['e1'].contains.include?(pieceA1)
+ assert game.pieces['e1'].contains.include?(pieceC1)
+ assert_equal game.pieces['e2'].position, game.board.positions['ec5']
+ assert_equal game.pieces['e2'].captured, false
+ assert_equal game.pieces['e2'].contains, []
+ assert_equal game.current_player, 'a'
+
+ game.apply_moves! move_set3.collect {|m| m.to_move(game)}
+ assert_equal game.pieces['a1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['a1'].captured, true
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['ac6']
+ assert_equal game.pieces['a2'].captured, false
+ assert game.pieces['a2'].contains.include?(pieceA1)
+ assert game.pieces['a2'].contains.include?(pieceC1)
+ assert game.pieces['a2'].contains.include?(pieceE1)
+ assert_equal game.pieces['c1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['c1'].captured, true
+ assert_equal game.pieces['c1'].contains, []
+ assert_equal game.pieces['c2'].position, game.board.positions['cc5']
+ assert_equal game.pieces['c2'].captured, false
+ assert_equal game.pieces['c2'].contains, []
+ assert_equal game.pieces['e1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['e1'].captured, true
+ assert_equal game.pieces['e1'].contains, []
+ assert_equal game.pieces['e2'].position, game.board.positions['ec5']
+ assert_equal game.pieces['e2'].captured, false
+ assert_equal game.pieces['e2'].contains, []
+ assert_equal game.current_player, 'c'
+
+ game.apply_moves! move_set4.collect {|m| m.to_move(game)}
+ assert_equal game.pieces['a1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['a1'].captured, true
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['ac6']
+ assert_equal game.pieces['a2'].captured, true
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['c1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['c1'].captured, true
+ assert_equal game.pieces['c1'].contains, []
+ assert_equal game.pieces['c2'].position, game.board.positions['ac6']
+ assert_equal game.pieces['c2'].captured, false
+ assert game.pieces['c2'].contains.include?(pieceA1)
+ assert game.pieces['c2'].contains.include?(pieceA2)
+ assert game.pieces['c2'].contains.include?(pieceC1)
+ assert game.pieces['c2'].contains.include?(pieceE1)
+ assert_equal game.pieces['e1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['e1'].captured, true
+ assert_equal game.pieces['e1'].contains, []
+ assert_equal game.pieces['e2'].position, game.board.positions['ec5']
+ assert_equal game.pieces['e2'].captured, false
+ assert_equal game.pieces['e2'].contains, []
+ assert_equal game.current_player, 'e'
+
+ game.apply_moves! move_set5.collect {|m| m.to_move(game)}
+ assert_equal game.pieces['a1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['a1'].captured, true
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['ac6']
+ assert_equal game.pieces['a2'].captured, true
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['c1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['c1'].captured, true
+ assert_equal game.pieces['c1'].contains, []
+ assert_equal game.pieces['c2'].position, game.board.positions['ac6']
+ assert_equal game.pieces['c2'].captured, false
+ assert game.pieces['c2'].contains.include?(pieceA1)
+ assert game.pieces['c2'].contains.include?(pieceA2)
+ assert game.pieces['c2'].contains.include?(pieceC1)
+ assert game.pieces['c2'].contains.include?(pieceE1)
+ assert_equal game.pieces['e1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['e1'].captured, true
+ assert_equal game.pieces['e1'].contains, []
+ assert_equal game.pieces['e2'].position, game.board.positions['bc5']
+ assert_equal game.pieces['e2'].captured, false
+ assert_equal game.pieces['e2'].contains, []
+ assert_equal game.current_player, 'c'
+
+ assert_raise (GameWonNotice) { game.apply_moves! move_set6.collect {|m| m.to_move(game)} }
+ end
+
+ def test_undo_move!
+ game = Game.new(3)
+
+ pieceA1 = game.pieces['a1']
+ pieceA2 = game.pieces['a2']
+ pieceC1 = game.pieces['c1']
+ pieceC2 = game.pieces['c2']
+ pieceE1 = game.pieces['e1']
+ pieceE2 = game.pieces['e2']
+
+ assert_equal [], game.history
+ assert_equal game.pieces['a1'], pieceA1
+ assert_equal game.pieces['a2'], pieceA2
+ assert_equal game.pieces['c1'], pieceC1
+ assert_equal game.pieces['c2'], pieceC2
+ assert_equal game.pieces['e1'], pieceE1
+ assert_equal game.pieces['e2'], pieceE2
+ assert_equal game.pieces['a1'].position, game.board.positions['a']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['c1'].position, game.board.positions['c']
+ assert_equal game.pieces['c1'].captured, false
+ assert_equal game.pieces['c1'].contains, []
+ assert_equal game.pieces['c2'].position, game.board.positions['c']
+ assert_equal game.pieces['c2'].captured, false
+ assert_equal game.pieces['c2'].contains, []
+ assert_equal game.pieces['e1'].position, game.board.positions['e']
+ assert_equal game.pieces['e1'].captured, false
+ assert_equal game.pieces['e1'].contains, []
+ assert_equal game.pieces['e2'].position, game.board.positions['e']
+ assert_equal game.pieces['e2'].captured, false
+ assert_equal game.pieces['e2'].contains, []
+ assert_equal game.current_player, 'a'
+
+ game.undo_move!
+ assert_equal [], game.history
+ assert_equal game.pieces['a1'], pieceA1
+ assert_equal game.pieces['a2'], pieceA2
+ assert_equal game.pieces['c1'], pieceC1
+ assert_equal game.pieces['c2'], pieceC2
+ assert_equal game.pieces['e1'], pieceE1
+ assert_equal game.pieces['e2'], pieceE2
+ assert_equal game.pieces['a1'].position, game.board.positions['a']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['c1'].position, game.board.positions['c']
+ assert_equal game.pieces['c1'].captured, false
+ assert_equal game.pieces['c1'].contains, []
+ assert_equal game.pieces['c2'].position, game.board.positions['c']
+ assert_equal game.pieces['c2'].captured, false
+ assert_equal game.pieces['c2'].contains, []
+ assert_equal game.pieces['e1'].position, game.board.positions['e']
+ assert_equal game.pieces['e1'].captured, false
+ assert_equal game.pieces['e1'].contains, []
+ assert_equal game.pieces['e2'].position, game.board.positions['e']
+ assert_equal game.pieces['e2'].captured, false
+ assert_equal game.pieces['e2'].contains, []
+ assert_equal game.current_player, 'a'
+
+ game.apply_moves! ['A1 A3'].collect { |m| m.to_move(game) }
+ assert_equal game.history.length, 1
+ assert_equal game.pieces['a1'], pieceA1
+ assert_equal game.pieces['a2'], pieceA2
+ assert_equal game.pieces['c1'], pieceC1
+ assert_equal game.pieces['c2'], pieceC2
+ assert_equal game.pieces['e1'], pieceE1
+ assert_equal game.pieces['e2'], pieceE2
+ assert_equal game.pieces['a1'].position, game.board.positions['a3']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['c1'].position, game.board.positions['c']
+ assert_equal game.pieces['c1'].captured, false
+ assert_equal game.pieces['c1'].contains, []
+ assert_equal game.pieces['c2'].position, game.board.positions['c']
+ assert_equal game.pieces['c2'].captured, false
+ assert_equal game.pieces['c2'].contains, []
+ assert_equal game.pieces['e1'].position, game.board.positions['e']
+ assert_equal game.pieces['e1'].captured, false
+ assert_equal game.pieces['e1'].contains, []
+ assert_equal game.pieces['e2'].position, game.board.positions['e']
+ assert_equal game.pieces['e2'].captured, false
+ assert_equal game.pieces['e2'].contains, []
+ assert_equal game.current_player, 'c'
+
+ game.undo_move!
+ assert_equal [], game.history
+ assert_equal game.pieces['a1'], pieceA1
+ assert_equal game.pieces['a2'], pieceA2
+ assert_equal game.pieces['c1'], pieceC1
+ assert_equal game.pieces['c2'], pieceC2
+ assert_equal game.pieces['e1'], pieceE1
+ assert_equal game.pieces['e2'], pieceE2
+ assert_equal game.pieces['a1'].position, game.board.positions['a']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['c1'].position, game.board.positions['c']
+ assert_equal game.pieces['c1'].captured, false
+ assert_equal game.pieces['c1'].contains, []
+ assert_equal game.pieces['c2'].position, game.board.positions['c']
+ assert_equal game.pieces['c2'].captured, false
+ assert_equal game.pieces['c2'].contains, []
+ assert_equal game.pieces['e1'].position, game.board.positions['e']
+ assert_equal game.pieces['e1'].captured, false
+ assert_equal game.pieces['e1'].contains, []
+ assert_equal game.pieces['e2'].position, game.board.positions['e']
+ assert_equal game.pieces['e2'].captured, false
+ assert_equal game.pieces['e2'].contains, []
+ assert_equal game.current_player, 'a'
+
+ move_set1 = ['A1 AC5', 'A2 AC5', 'A1 AC6',
+ 'C1 CC5', 'C2 CC5', 'C1 AC6'] # A1 now captured by C1
+ move_set1a = ['C1 AC6']
+ move_set2 = ['E1 EC5', 'E2 EC5', 'E1 AC6'] # C1+A1 now caputred by E1
+ move_set2a = ['E1 AC6']
+
+ game.apply_moves! move_set1.collect {|m| m.to_move(game)}
+ assert_equal game.history.length, 6
+ assert_equal game.pieces['a1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['a1'].captured, true
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['ac5']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['c1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['c1'].captured, false
+ assert game.pieces['c1'].contains.include?(pieceA1)
+ assert_equal game.pieces['c2'].position, game.board.positions['cc5']
+ assert_equal game.pieces['c2'].captured, false
+ assert_equal game.pieces['c2'].contains, []
+ assert_equal game.pieces['e1'].position, game.board.positions['e']
+ assert_equal game.pieces['e1'].captured, false
+ assert_equal game.pieces['e1'].contains, []
+ assert_equal game.pieces['e2'].position, game.board.positions['e']
+ assert_equal game.pieces['e2'].captured, false
+ assert_equal game.pieces['e2'].contains, []
+ assert_equal game.current_player, 'e'
+
+ game.undo_move!
+ assert_equal game.history.length, 5
+ assert_equal game.pieces['a1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['ac5']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['c1'].position, game.board.positions['cc5']
+ assert_equal game.pieces['c1'].captured, false
+ assert_equal game.pieces['c1'].contains, []
+ assert_equal game.pieces['c2'].position, game.board.positions['cc5']
+ assert_equal game.pieces['c2'].captured, false
+ assert_equal game.pieces['c2'].contains, []
+ assert_equal game.pieces['e1'].position, game.board.positions['e']
+ assert_equal game.pieces['e1'].captured, false
+ assert_equal game.pieces['e1'].contains, []
+ assert_equal game.pieces['e2'].position, game.board.positions['e']
+ assert_equal game.pieces['e2'].captured, false
+ assert_equal game.pieces['e2'].contains, []
+ assert_equal game.current_player, 'c'
+
+ game.apply_moves! move_set1a.collect {|m| m.to_move(game)}
+ assert_equal game.history.length, 6
+ assert_equal game.pieces['a1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['a1'].captured, true
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['ac5']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['c1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['c1'].captured, false
+ assert game.pieces['c1'].contains.include?(pieceA1)
+ assert_equal game.pieces['c2'].position, game.board.positions['cc5']
+ assert_equal game.pieces['c2'].captured, false
+ assert_equal game.pieces['c2'].contains, []
+ assert_equal game.pieces['e1'].position, game.board.positions['e']
+ assert_equal game.pieces['e1'].captured, false
+ assert_equal game.pieces['e1'].contains, []
+ assert_equal game.pieces['e2'].position, game.board.positions['e']
+ assert_equal game.pieces['e2'].captured, false
+ assert_equal game.pieces['e2'].contains, []
+ assert_equal game.current_player, 'e'
+
+ game.apply_moves! move_set2.collect {|m| m.to_move(game)}
+ assert_equal game.history.length, 9
+ assert_equal game.pieces['a1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['a1'].captured, true
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['ac5']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['c1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['c1'].captured, true
+ assert_equal game.pieces['c1'].contains, []
+ assert_equal game.pieces['c2'].position, game.board.positions['cc5']
+ assert_equal game.pieces['c2'].captured, false
+ assert_equal game.pieces['c2'].contains, []
+ assert_equal game.pieces['e1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['e1'].captured, false
+ assert game.pieces['e1'].contains.include?(pieceA1)
+ assert game.pieces['e1'].contains.include?(pieceC1)
+ assert_equal game.pieces['e2'].position, game.board.positions['ec5']
+ assert_equal game.pieces['e2'].captured, false
+ assert_equal game.pieces['e2'].contains, []
+ assert_equal game.current_player, 'a'
+
+ game.undo_move!
+ assert_equal game.history.length, 8
+ assert_equal game.pieces['a1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['a1'].captured, true
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['ac5']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['c1'].captured, false
+ assert game.pieces['c1'].contains.include?(pieceA1)
+
+ assert_equal game.pieces['c2'].position, game.board.positions['cc5']
+ assert_equal game.pieces['c2'].captured, false
+ assert_equal game.pieces['c2'].contains, []
+ assert_equal game.pieces['e1'].position, game.board.positions['ec5']
+ assert_equal game.pieces['e1'].captured, false
+ assert_equal game.pieces['e1'].contains, []
+ assert_equal game.pieces['e2'].position, game.board.positions['ec5']
+ assert_equal game.pieces['e2'].captured, false
+ assert_equal game.pieces['e2'].contains, []
+ assert_equal game.current_player, 'e'
+
+ assert_equal game.pieces['c1'].position, game.pieces['a1'].position
+ assert_equal game.pieces['c1'].position, game.board.positions['ac6']
+
+
+ game.apply_moves! move_set2a.collect {|m| m.to_move(game)}
+ assert_equal game.history.length, 9
+ assert_equal game.pieces['a1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['a1'].captured, true
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['ac5']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['c1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['c1'].captured, true
+ assert_equal game.pieces['c1'].contains, []
+ assert_equal game.pieces['c2'].position, game.board.positions['cc5']
+ assert_equal game.pieces['c2'].captured, false
+ assert_equal game.pieces['c2'].contains, []
+ assert_equal game.pieces['e1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['e1'].captured, false
+ assert game.pieces['e1'].contains.include?(pieceA1)
+ assert game.pieces['e1'].contains.include?(pieceC1)
+ assert_equal game.pieces['e2'].position, game.board.positions['ec5']
+ assert_equal game.pieces['e2'].captured, false
+ assert_equal game.pieces['e2'].contains, []
+ assert_equal game.current_player, 'a'
+
+ end
+end
\ No newline at end of file
--- /dev/null
+# test/game_test.rb
+require File.join(File.dirname(__FILE__), '..', 'lib', 'libttc')
+require 'test/unit'
+
+class GameTest < Test::Unit::TestCase
+
+ def test_init
+ assert_nothing_raised { Game.new(6,6,6,6,6) }
+ assert_equal [], Game.new(6,6,6,6,6).history
+ end
+
+
+ def test_game_init
+ game = Game.new(6,6,6,6,6)
+
+ pieceA1 = game.pieces['a1']
+ pieceA2 = game.pieces['a2']
+ pieceB2 = game.pieces['b2']
+
+ posA = game.board.positions['a']
+ posB = game.board.positions['b']
+ posA3 = game.board.positions['a3']
+ posA4 = game.board.positions['a4']
+ posA5 = game.board.positions['a5']
+
+ moveA2A = Move.new(pieceA2, posA , true)
+ moveA1A5 = Move.new(pieceA1, posA5)
+ moveA2A4 = Move.new(pieceA2, posA4)
+ moveA2A3 = Move.new(pieceA2, posA3)
+ moveB2A5 = Move.new(pieceB2, posA5)
+ moveB2A3 = Move.new(pieceB2, posA3)
+ moveB2A4 = Move.new(pieceB2, posA4)
+
+ assert_equal [], game.history
+ assert_equal game.pieces['a1'].position, game.board.positions['a']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['b']
+ assert_equal game.pieces['b2'].captured, false
+ assert_equal game.pieces['b2'].contains, []
+ end
+
+
+ def test_single_moves_1
+ game = Game.new(6,6,6,6,6)
+
+ pieceA1 = game.pieces['a1']
+ pieceA2 = game.pieces['a2']
+ pieceB2 = game.pieces['b2']
+
+ posA = game.board.positions['a']
+ posB = game.board.positions['b']
+ posA3 = game.board.positions['a3']
+ posA4 = game.board.positions['a4']
+ posA5 = game.board.positions['a5']
+
+ moveA2A = Move.new(pieceA2, posA , true)
+ moveA1A5 = Move.new(pieceA1, posA5)
+ moveA2A4 = Move.new(pieceA2, posA4)
+ moveA2A3 = Move.new(pieceA2, posA3)
+ moveB2A5 = Move.new(pieceB2, posA5)
+ moveB2A3 = Move.new(pieceB2, posA3)
+ moveB2A4 = Move.new(pieceB2, posA4)
+
+ assert_equal [], game.history
+ assert_equal game.pieces['a1'].position, game.board.positions['a']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['b']
+ assert_equal game.pieces['b2'].captured, false
+ assert_equal game.pieces['b2'].contains, []
+
+ assert_raise(InvalidMoveError) {game.apply_move!(moveA1A5, 'b')}
+
+ assert_equal [], game.history
+ assert_equal game.pieces['a1'].position, game.board.positions['a']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['b']
+ assert_equal game.pieces['b2'].captured, false
+ assert_equal game.pieces['b2'].contains, []
+
+ game.apply_move!(moveA1A5, 'a')
+ assert_equal game.history.length, 1
+ assert_equal game.pieces['a1'].position, game.board.positions['a5']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['b']
+ assert_equal game.pieces['b2'].captured, false
+ assert_equal game.pieces['b2'].contains, []
+ end
+
+ def test_separate_moves
+ game = Game.new(6,6,6,6,6)
+
+ pieceA1 = game.pieces['a1']
+ pieceA2 = game.pieces['a2']
+ pieceB2 = game.pieces['b2']
+
+ posA = game.board.positions['a']
+ posB = game.board.positions['b']
+ posA3 = game.board.positions['a3']
+ posA4 = game.board.positions['a4']
+ posA5 = game.board.positions['a5']
+
+ moveA2A = Move.new(pieceA2, posA , true)
+ moveA1A5 = Move.new(pieceA1, posA5)
+ moveA2A4 = Move.new(pieceA2, posA4)
+ moveA2A3 = Move.new(pieceA2, posA3)
+ moveB2A5 = Move.new(pieceB2, posA5)
+ moveB2A3 = Move.new(pieceB2, posA3)
+ moveB2A4 = Move.new(pieceB2, posA4)
+
+ assert_equal [], game.history
+ assert_equal game.pieces['a1'].position, game.board.positions['a']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['b']
+ assert_equal game.pieces['b2'].captured, false
+ assert_equal game.pieces['b2'].contains, []
+
+ game.apply_move!(moveA1A5, 'a')
+ assert_equal game.history.length, 1
+ assert_equal game.pieces['a1'].position, game.board.positions['a5']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['b']
+ assert_equal game.pieces['b2'].captured, false
+ assert_equal game.pieces['b2'].contains, []
+
+ game.apply_move!(moveB2A3, 'b')
+ assert_equal game.history.length, 2
+ assert_equal game.pieces['a1'].position, game.board.positions['a5']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['a3']
+ assert_equal game.pieces['b2'].captured, false
+ assert_equal game.pieces['b2'].contains, []
+ end
+
+
+
+ def test_captures
+ game = Game.new(6,6,6,6,6)
+
+ pieceA1 = game.pieces['a1']
+ pieceA2 = game.pieces['a2']
+ pieceB2 = game.pieces['b2']
+
+ posA = game.board.positions['a']
+ posB = game.board.positions['b']
+ posA3 = game.board.positions['a3']
+ posA4 = game.board.positions['a4']
+ posA5 = game.board.positions['a5']
+
+ moveA2A = Move.new(pieceA2, posA , true)
+ moveA1A5 = Move.new(pieceA1, posA5)
+ moveA2A4 = Move.new(pieceA2, posA4)
+ moveA2A3 = Move.new(pieceA2, posA3)
+ moveB2A5 = Move.new(pieceB2, posA5)
+ moveB2A3 = Move.new(pieceB2, posA3)
+ moveB2A4 = Move.new(pieceB2, posA4)
+
+ assert_equal [], game.history
+ assert_equal game.pieces['a1'].position, game.board.positions['a']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['b']
+ assert_equal game.pieces['b2'].captured, false
+ assert_equal game.pieces['b2'].contains, []
+
+ game.apply_move!(moveA1A5, 'a')
+ assert_equal game.history.length, 1
+ assert_equal game.pieces['a1'].position, game.board.positions['a5']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['b']
+ assert_equal game.pieces['b2'].captured, false
+ assert_equal game.pieces['b2'].contains, []
+
+ game.apply_move!(moveB2A5, 'b')
+ assert_equal game.history.length, 2
+ assert_equal game.pieces['a1'].position, game.board.positions['a5']
+ assert_equal game.pieces['a1'].captured, true
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['a5']
+ assert_equal game.pieces['b2'].captured, false
+ assert game.pieces['b2'].contains.include?(pieceA1)
+ assert_equal game.pieces['b2'].contains.length, 1
+ end
+
+
+ def test_no_captures_on_safe_spaces
+ game = Game.new(6,6,6,6,6)
+
+ pieceA1 = game.pieces['a1']
+ pieceA2 = game.pieces['a2']
+ pieceB2 = game.pieces['b2']
+
+ posA = game.board.positions['a']
+ posB = game.board.positions['b']
+ posA3 = game.board.positions['a3']
+ posA4 = game.board.positions['a4']
+ posA5 = game.board.positions['a5']
+
+ moveA2A = Move.new(pieceA2, posA , true)
+ moveA1A5 = Move.new(pieceA1, posA5)
+ moveA2A4 = Move.new(pieceA2, posA4)
+ moveA2A3 = Move.new(pieceA2, posA3)
+ moveB2A5 = Move.new(pieceB2, posA5)
+ moveB2A3 = Move.new(pieceB2, posA3)
+ moveB2A4 = Move.new(pieceB2, posA4)
+
+ assert_equal [], game.history
+ assert_equal game.pieces['a1'].position, game.board.positions['a']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['b']
+ assert_equal game.pieces['b2'].captured, false
+ assert_equal game.pieces['b2'].contains, []
+
+ game.apply_move!(moveA2A4, 'a')
+ assert_equal game.history.length, 1
+ assert_equal game.pieces['a1'].position, game.board.positions['a']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a4']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['b']
+ assert_equal game.pieces['b2'].captured, false
+ assert_equal game.pieces['b2'].contains, []
+
+ game.apply_move!(moveB2A4, 'b')
+ assert_equal game.history.length, 2
+ assert_equal game.pieces['a1'].position, game.board.positions['a']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a4']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['a4']
+ assert_equal game.pieces['b2'].captured, false
+ assert_equal game.pieces['b2'].contains, []
+ end
+
+ def test_move_after_captures
+ game = Game.new(6,6,6,6,6)
+
+ pieceA1 = game.pieces['a1']
+ pieceA2 = game.pieces['a2']
+ pieceB2 = game.pieces['b2']
+
+ posA = game.board.positions['a']
+ posB = game.board.positions['b']
+ posA3 = game.board.positions['a3']
+ posA4 = game.board.positions['a4']
+ posA5 = game.board.positions['a5']
+
+ moveA2A = Move.new(pieceA2, posA , true)
+ moveA1A5 = Move.new(pieceA1, posA5)
+ moveA2A4 = Move.new(pieceA2, posA4)
+ moveA2A3 = Move.new(pieceA2, posA3)
+ moveB2A5 = Move.new(pieceB2, posA5)
+ moveB2A3 = Move.new(pieceB2, posA3)
+ moveB2A4 = Move.new(pieceB2, posA4)
+
+ assert_equal [], game.history
+ assert_equal game.pieces['a1'].position, game.board.positions['a']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['b']
+ assert_equal game.pieces['b2'].captured, false
+ assert_equal game.pieces['b2'].contains, []
+
+ game.apply_move!(moveA1A5, 'a')
+ assert_equal game.history.length, 1
+ assert_equal game.pieces['a1'].position, game.board.positions['a5']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['b']
+ assert_equal game.pieces['b2'].captured, false
+ assert_equal game.pieces['b2'].contains, []
+
+ game.apply_move!(moveB2A5, 'b')
+ assert_equal game.history.length, 2
+ assert_equal game.pieces['a1'].position, game.board.positions['a5']
+ assert_equal game.pieces['a1'].captured, true
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['a5']
+ assert_equal game.pieces['b2'].captured, false
+ assert game.pieces['b2'].contains.include?(pieceA1)
+ assert_equal game.pieces['b2'].contains.length, 1
+
+ game.apply_move!(moveA2A4, 'a')
+ assert_equal game.history.length, 3
+ assert_equal game.pieces['a1'].position, game.board.positions['a5']
+ assert_equal game.pieces['a1'].captured, true
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a4']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['a5']
+ assert_equal game.pieces['b2'].captured, false
+ assert game.pieces['b2'].contains.include?(pieceA1)
+ assert_equal game.pieces['b2'].contains.length, 1
+
+ game.apply_move!(moveB2A3, 'b')
+ assert_equal game.history.length, 4
+ assert_equal game.pieces['a1'].position, game.board.positions['a3']
+ assert_equal game.pieces['a1'].captured, true
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a4']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['a3']
+ assert_equal game.pieces['b2'].captured, false
+ assert game.pieces['b2'].contains.include?(pieceA1)
+ assert_equal game.pieces['b2'].contains.length, 1
+ end
+
+
+ def test_game
+ game = Game.new(6,6,6,6,6)
+
+ pieceA1 = game.pieces['a1']
+ pieceA2 = game.pieces['a2']
+ pieceB2 = game.pieces['b2']
+
+ posA = game.board.positions['a']
+ posB = game.board.positions['b']
+ posA3 = game.board.positions['a3']
+ posA4 = game.board.positions['a4']
+ posA5 = game.board.positions['a5']
+
+ moveA2A = Move.new(pieceA2, posA , true)
+ moveA1A3 = Move.new(pieceA1, posA3)
+ moveA1A5 = Move.new(pieceA1, posA5)
+ moveA2A4 = Move.new(pieceA2, posA4)
+ moveA2A3 = Move.new(pieceA2, posA3)
+ moveB2A5 = Move.new(pieceB2, posA5)
+ moveB2A3 = Move.new(pieceB2, posA3)
+ moveB2A4 = Move.new(pieceB2, posA4)
+
+ assert_equal [], game.history
+ assert_equal game.pieces['a1'].position, game.board.positions['a']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['b']
+ assert_equal game.pieces['b2'].captured, false
+ assert_equal game.pieces['b2'].contains, []
+
+ game.apply_move!(moveA1A5, 'a')
+ assert_equal game.history.length, 1
+ assert_equal game.pieces['a1'].position, game.board.positions['a5']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['b']
+ assert_equal game.pieces['b2'].captured, false
+ assert_equal game.pieces['b2'].contains, []
+
+ game.apply_move!(moveB2A3, 'b')
+ assert_equal game.history.length, 2
+ assert_equal game.pieces['a1'].position, game.board.positions['a5']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['a3']
+ assert_equal game.pieces['b2'].captured, false
+ assert_equal game.pieces['b2'].contains, []
+
+ game.apply_move!(moveA2A4, 'a')
+ assert_equal game.history.length, 3
+ assert_equal game.pieces['a1'].position, game.board.positions['a5']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a4']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['a3']
+ assert_equal game.pieces['b2'].captured, false
+ assert_equal game.pieces['b2'].contains, []
+
+ game.apply_move!(moveB2A5, 'b')
+ assert_equal game.history.length, 4
+ assert_equal game.pieces['a1'].position, game.board.positions['a5']
+ assert_equal game.pieces['a1'].captured, true
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a4']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['a5']
+ assert_equal game.pieces['b2'].captured, false
+ assert game.pieces['b2'].contains.include?(pieceA1)
+ assert_equal game.pieces['b2'].contains.length, 1
+
+ assert_raise(InvalidMoveError) {game.apply_move!(moveA1A3, 'a')}
+ assert_equal game.history.length, 4
+ assert_equal game.pieces['a1'].position, game.board.positions['a5']
+ assert_equal game.pieces['a1'].captured, true
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a4']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['a5']
+ assert_equal game.pieces['b2'].captured, false
+ assert game.pieces['b2'].contains.include?(pieceA1)
+ assert_equal game.pieces['b2'].contains.length, 1
+
+ game.apply_move!(moveA2A3, 'a')
+ assert_equal game.history.length, 5
+ assert_equal game.pieces['a1'].position, game.board.positions['a5']
+ assert_equal game.pieces['a1'].captured, true
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a3']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['a5']
+ assert_equal game.pieces['b2'].captured, false
+ assert game.pieces['b2'].contains.include?(pieceA1)
+ assert_equal game.pieces['b2'].contains.length, 1
+
+ game.apply_move!(moveB2A4, 'b')
+ assert_equal game.history.length, 6
+ assert_equal game.pieces['a1'].position, game.board.positions['a4']
+ assert_equal game.pieces['a1'].captured, true
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a3']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['a4']
+ assert_equal game.pieces['b2'].captured, false
+ assert game.pieces['b2'].contains.include?(pieceA1)
+ assert_equal game.pieces['b2'].contains.length, 1
+
+ game.apply_move!(moveA2A4, 'a')
+ assert_equal game.history.length, 7
+ assert_equal game.pieces['a1'].position, game.board.positions['a4']
+ assert_equal game.pieces['a1'].captured, true
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a4']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['a4']
+ assert_equal game.pieces['b2'].captured, false
+ assert game.pieces['b2'].contains.include?(pieceA1)
+ assert_equal game.pieces['b2'].contains.length, 1
+
+ game.apply_move!(moveB2A3, 'b')
+ assert_equal game.history.length, 8
+ assert_equal game.pieces['a1'].position, game.board.positions['a3']
+ assert_equal game.pieces['a1'].captured, true
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a4']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['a3']
+ assert_equal game.pieces['b2'].captured, false
+ assert game.pieces['b2'].contains.include?(pieceA1)
+ assert_equal game.pieces['b2'].contains.length, 1
+
+ game.apply_move!(moveA2A3, 'a')
+ assert_equal game.history.length, 9
+ assert_equal game.pieces['a1'].position, game.board.positions['a3']
+ assert_equal game.pieces['a1'].captured, true
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a3']
+ assert_equal game.pieces['a2'].captured, false
+ assert game.pieces['a2'].contains.include?(pieceA1)
+ assert game.pieces['a2'].contains.include?(pieceB2)
+ assert_equal game.pieces['a2'].contains.length, 2
+ assert_equal game.pieces['b2'].position, game.board.positions['a3']
+ assert_equal game.pieces['b2'].captured, true
+ assert_equal game.pieces['b2'].contains, []
+
+ game.apply_move!(moveA2A, 'a')
+ assert_equal game.history.length, 10
+ assert_equal game.pieces['a1'].position, game.board.positions['a']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['b2'].position, game.board.positions['a']
+ assert_equal game.pieces['b2'].captured, true
+ assert_equal game.pieces['b2'].contains, []
+ end
+
+ def test_apply_moves!
+ game = Game.new(3)
+ move_set = ['A1 A2', 'C1 C2', 'E1 E2']
+ assert_nothing_raised { move_set.collect { |m| m.to_move(game) } }
+ move_set_m = move_set.collect { |m| m.to_move(game) }
+ assert_nothing_raised { game.apply_moves! move_set_m }
+ end
+
+ def test_eliminations
+ game = Game.new(3, 6, 6, 6, 2)
+
+ pieceA1 = game.pieces['a1']
+ pieceA2 = game.pieces['a2']
+ pieceC1 = game.pieces['c1']
+ pieceC2 = game.pieces['c2']
+ pieceE1 = game.pieces['e1']
+ pieceE2 = game.pieces['e2']
+
+ posAC5 = game.board.positions['ac5']
+ posBC5 = game.board.positions['bc5']
+ posCC5 = game.board.positions['cc5']
+ posEC5 = game.board.positions['ec5']
+ posAC6 = game.board.positions['ac6']
+
+ move_set1 = ['A1 AC5', 'A2 AC5', 'A1 AC6',
+ 'C1 CC5', 'C2 CC5', 'C1 AC6'] # A1 now captured by C1
+ move_set2 = ['E1 EC5', 'E2 EC5', 'E1 AC6'] # C1+A1 now caputred by E1
+ move_set3 = ['A2 AC6'] # E1+C1+A1 captured by A2
+ move_set4 = ['C2 AC6'] # A2+E1+C1+A1 captured by C2. Player A now eliminated
+ move_set5 = ['E2 BC5']
+ move_set6 = ['C2 BC5'] # C2 (plus stack) captures E2. Player E now eliminated
+
+ assert_equal [], game.history
+ assert_equal game.pieces['a1'].position, game.board.positions['a']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['c1'].position, game.board.positions['c']
+ assert_equal game.pieces['c1'].captured, false
+ assert_equal game.pieces['c1'].contains, []
+ assert_equal game.pieces['c2'].position, game.board.positions['c']
+ assert_equal game.pieces['c2'].captured, false
+ assert_equal game.pieces['c2'].contains, []
+ assert_equal game.pieces['e1'].position, game.board.positions['e']
+ assert_equal game.pieces['e1'].captured, false
+ assert_equal game.pieces['e1'].contains, []
+ assert_equal game.pieces['e2'].position, game.board.positions['e']
+ assert_equal game.pieces['e2'].captured, false
+ assert_equal game.pieces['e2'].contains, []
+ assert_equal game.current_player, 'a'
+
+ game.apply_moves! move_set1.collect {|m| m.to_move(game)}
+ assert_equal game.history.length, 6
+ assert_equal game.pieces['a1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['a1'].captured, true
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['ac5']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['c1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['c1'].captured, false
+ assert game.pieces['c1'].contains.include?(pieceA1)
+ assert_equal game.pieces['c2'].position, game.board.positions['cc5']
+ assert_equal game.pieces['c2'].captured, false
+ assert_equal game.pieces['c2'].contains, []
+ assert_equal game.pieces['e1'].position, game.board.positions['e']
+ assert_equal game.pieces['e1'].captured, false
+ assert_equal game.pieces['e1'].contains, []
+ assert_equal game.pieces['e2'].position, game.board.positions['e']
+ assert_equal game.pieces['e2'].captured, false
+ assert_equal game.pieces['e2'].contains, []
+ assert_equal game.current_player, 'e'
+
+ game.apply_moves! move_set2.collect {|m| m.to_move(game)}
+ assert_equal game.pieces['a1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['a1'].captured, true
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['ac5']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['c1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['c1'].captured, true
+ assert_equal game.pieces['c1'].contains, []
+ assert_equal game.pieces['c2'].position, game.board.positions['cc5']
+ assert_equal game.pieces['c2'].captured, false
+ assert_equal game.pieces['c2'].contains, []
+ assert_equal game.pieces['e1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['e1'].captured, false
+ assert game.pieces['e1'].contains.include?(pieceA1)
+ assert game.pieces['e1'].contains.include?(pieceC1)
+ assert_equal game.pieces['e2'].position, game.board.positions['ec5']
+ assert_equal game.pieces['e2'].captured, false
+ assert_equal game.pieces['e2'].contains, []
+ assert_equal game.current_player, 'a'
+
+ game.apply_moves! move_set3.collect {|m| m.to_move(game)}
+ assert_equal game.pieces['a1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['a1'].captured, true
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['ac6']
+ assert_equal game.pieces['a2'].captured, false
+ assert game.pieces['a2'].contains.include?(pieceA1)
+ assert game.pieces['a2'].contains.include?(pieceC1)
+ assert game.pieces['a2'].contains.include?(pieceE1)
+ assert_equal game.pieces['c1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['c1'].captured, true
+ assert_equal game.pieces['c1'].contains, []
+ assert_equal game.pieces['c2'].position, game.board.positions['cc5']
+ assert_equal game.pieces['c2'].captured, false
+ assert_equal game.pieces['c2'].contains, []
+ assert_equal game.pieces['e1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['e1'].captured, true
+ assert_equal game.pieces['e1'].contains, []
+ assert_equal game.pieces['e2'].position, game.board.positions['ec5']
+ assert_equal game.pieces['e2'].captured, false
+ assert_equal game.pieces['e2'].contains, []
+ assert_equal game.current_player, 'c'
+
+ game.apply_moves! move_set4.collect {|m| m.to_move(game)}
+ assert_equal game.pieces['a1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['a1'].captured, true
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['ac6']
+ assert_equal game.pieces['a2'].captured, true
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['c1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['c1'].captured, true
+ assert_equal game.pieces['c1'].contains, []
+ assert_equal game.pieces['c2'].position, game.board.positions['ac6']
+ assert_equal game.pieces['c2'].captured, false
+ assert game.pieces['c2'].contains.include?(pieceA1)
+ assert game.pieces['c2'].contains.include?(pieceA2)
+ assert game.pieces['c2'].contains.include?(pieceC1)
+ assert game.pieces['c2'].contains.include?(pieceE1)
+ assert_equal game.pieces['e1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['e1'].captured, true
+ assert_equal game.pieces['e1'].contains, []
+ assert_equal game.pieces['e2'].position, game.board.positions['ec5']
+ assert_equal game.pieces['e2'].captured, false
+ assert_equal game.pieces['e2'].contains, []
+ assert_equal game.current_player, 'e'
+
+ game.apply_moves! move_set5.collect {|m| m.to_move(game)}
+ assert_equal game.pieces['a1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['a1'].captured, true
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['ac6']
+ assert_equal game.pieces['a2'].captured, true
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['c1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['c1'].captured, true
+ assert_equal game.pieces['c1'].contains, []
+ assert_equal game.pieces['c2'].position, game.board.positions['ac6']
+ assert_equal game.pieces['c2'].captured, false
+ assert game.pieces['c2'].contains.include?(pieceA1)
+ assert game.pieces['c2'].contains.include?(pieceA2)
+ assert game.pieces['c2'].contains.include?(pieceC1)
+ assert game.pieces['c2'].contains.include?(pieceE1)
+ assert_equal game.pieces['e1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['e1'].captured, true
+ assert_equal game.pieces['e1'].contains, []
+ assert_equal game.pieces['e2'].position, game.board.positions['bc5']
+ assert_equal game.pieces['e2'].captured, false
+ assert_equal game.pieces['e2'].contains, []
+ assert_equal game.current_player, 'c'
+
+ assert_raise (GameWonNotice) { game.apply_moves! move_set6.collect {|m| m.to_move(game)} }
+ end
+
+ def test_undo_move!
+ game = Game.new(3)
+
+ pieceA1 = game.pieces['a1']
+ pieceA2 = game.pieces['a2']
+ pieceC1 = game.pieces['c1']
+ pieceC2 = game.pieces['c2']
+ pieceE1 = game.pieces['e1']
+ pieceE2 = game.pieces['e2']
+
+ assert_equal [], game.history
+ assert_equal game.pieces['a1'], pieceA1
+ assert_equal game.pieces['a2'], pieceA2
+ assert_equal game.pieces['c1'], pieceC1
+ assert_equal game.pieces['c2'], pieceC2
+ assert_equal game.pieces['e1'], pieceE1
+ assert_equal game.pieces['e2'], pieceE2
+ assert_equal game.pieces['a1'].position, game.board.positions['a']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['c1'].position, game.board.positions['c']
+ assert_equal game.pieces['c1'].captured, false
+ assert_equal game.pieces['c1'].contains, []
+ assert_equal game.pieces['c2'].position, game.board.positions['c']
+ assert_equal game.pieces['c2'].captured, false
+ assert_equal game.pieces['c2'].contains, []
+ assert_equal game.pieces['e1'].position, game.board.positions['e']
+ assert_equal game.pieces['e1'].captured, false
+ assert_equal game.pieces['e1'].contains, []
+ assert_equal game.pieces['e2'].position, game.board.positions['e']
+ assert_equal game.pieces['e2'].captured, false
+ assert_equal game.pieces['e2'].contains, []
+ assert_equal game.current_player, 'a'
+
+ game.undo_move!
+ assert_equal [], game.history
+ assert_equal game.pieces['a1'], pieceA1
+ assert_equal game.pieces['a2'], pieceA2
+ assert_equal game.pieces['c1'], pieceC1
+ assert_equal game.pieces['c2'], pieceC2
+ assert_equal game.pieces['e1'], pieceE1
+ assert_equal game.pieces['e2'], pieceE2
+ assert_equal game.pieces['a1'].position, game.board.positions['a']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['c1'].position, game.board.positions['c']
+ assert_equal game.pieces['c1'].captured, false
+ assert_equal game.pieces['c1'].contains, []
+ assert_equal game.pieces['c2'].position, game.board.positions['c']
+ assert_equal game.pieces['c2'].captured, false
+ assert_equal game.pieces['c2'].contains, []
+ assert_equal game.pieces['e1'].position, game.board.positions['e']
+ assert_equal game.pieces['e1'].captured, false
+ assert_equal game.pieces['e1'].contains, []
+ assert_equal game.pieces['e2'].position, game.board.positions['e']
+ assert_equal game.pieces['e2'].captured, false
+ assert_equal game.pieces['e2'].contains, []
+ assert_equal game.current_player, 'a'
+
+ game.apply_moves! ['A1 A3'].collect { |m| m.to_move(game) }
+ assert_equal game.history.length, 1
+ assert_equal game.pieces['a1'], pieceA1
+ assert_equal game.pieces['a2'], pieceA2
+ assert_equal game.pieces['c1'], pieceC1
+ assert_equal game.pieces['c2'], pieceC2
+ assert_equal game.pieces['e1'], pieceE1
+ assert_equal game.pieces['e2'], pieceE2
+ assert_equal game.pieces['a1'].position, game.board.positions['a3']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['c1'].position, game.board.positions['c']
+ assert_equal game.pieces['c1'].captured, false
+ assert_equal game.pieces['c1'].contains, []
+ assert_equal game.pieces['c2'].position, game.board.positions['c']
+ assert_equal game.pieces['c2'].captured, false
+ assert_equal game.pieces['c2'].contains, []
+ assert_equal game.pieces['e1'].position, game.board.positions['e']
+ assert_equal game.pieces['e1'].captured, false
+ assert_equal game.pieces['e1'].contains, []
+ assert_equal game.pieces['e2'].position, game.board.positions['e']
+ assert_equal game.pieces['e2'].captured, false
+ assert_equal game.pieces['e2'].contains, []
+ assert_equal game.current_player, 'c'
+
+ game.undo_move!
+ assert_equal [], game.history
+ assert_equal game.pieces['a1'], pieceA1
+ assert_equal game.pieces['a2'], pieceA2
+ assert_equal game.pieces['c1'], pieceC1
+ assert_equal game.pieces['c2'], pieceC2
+ assert_equal game.pieces['e1'], pieceE1
+ assert_equal game.pieces['e2'], pieceE2
+ assert_equal game.pieces['a1'].position, game.board.positions['a']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['a']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['c1'].position, game.board.positions['c']
+ assert_equal game.pieces['c1'].captured, false
+ assert_equal game.pieces['c1'].contains, []
+ assert_equal game.pieces['c2'].position, game.board.positions['c']
+ assert_equal game.pieces['c2'].captured, false
+ assert_equal game.pieces['c2'].contains, []
+ assert_equal game.pieces['e1'].position, game.board.positions['e']
+ assert_equal game.pieces['e1'].captured, false
+ assert_equal game.pieces['e1'].contains, []
+ assert_equal game.pieces['e2'].position, game.board.positions['e']
+ assert_equal game.pieces['e2'].captured, false
+ assert_equal game.pieces['e2'].contains, []
+ assert_equal game.current_player, 'a'
+
+ move_set1 = ['A1 AC5', 'A2 AC5', 'A1 AC6',
+ 'C1 CC5', 'C2 CC5', 'C1 AC6'] # A1 now captured by C1
+ move_set1a = ['C1 AC6']
+ move_set2 = ['E1 EC5', 'E2 EC5', 'E1 AC6'] # C1+A1 now caputred by E1
+ move_set2a = ['E1 AC6']
+
+ game.apply_moves! move_set1.collect {|m| m.to_move(game)}
+ assert_equal game.history.length, 6
+ assert_equal game.pieces['a1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['a1'].captured, true
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['ac5']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['c1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['c1'].captured, false
+ assert game.pieces['c1'].contains.include?(pieceA1)
+ assert_equal game.pieces['c2'].position, game.board.positions['cc5']
+ assert_equal game.pieces['c2'].captured, false
+ assert_equal game.pieces['c2'].contains, []
+ assert_equal game.pieces['e1'].position, game.board.positions['e']
+ assert_equal game.pieces['e1'].captured, false
+ assert_equal game.pieces['e1'].contains, []
+ assert_equal game.pieces['e2'].position, game.board.positions['e']
+ assert_equal game.pieces['e2'].captured, false
+ assert_equal game.pieces['e2'].contains, []
+ assert_equal game.current_player, 'e'
+
+ game.undo_move!
+ assert_equal game.history.length, 5
+ assert_equal game.pieces['a1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['a1'].captured, false
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['ac5']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['c1'].position, game.board.positions['cc5']
+ assert_equal game.pieces['c1'].captured, false
+ assert_equal game.pieces['c1'].contains, []
+ assert_equal game.pieces['c2'].position, game.board.positions['cc5']
+ assert_equal game.pieces['c2'].captured, false
+ assert_equal game.pieces['c2'].contains, []
+ assert_equal game.pieces['e1'].position, game.board.positions['e']
+ assert_equal game.pieces['e1'].captured, false
+ assert_equal game.pieces['e1'].contains, []
+ assert_equal game.pieces['e2'].position, game.board.positions['e']
+ assert_equal game.pieces['e2'].captured, false
+ assert_equal game.pieces['e2'].contains, []
+ assert_equal game.current_player, 'c'
+
+ game.apply_moves! move_set1a.collect {|m| m.to_move(game)}
+ assert_equal game.history.length, 6
+ assert_equal game.pieces['a1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['a1'].captured, true
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['ac5']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['c1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['c1'].captured, false
+ assert game.pieces['c1'].contains.include?(pieceA1)
+ assert_equal game.pieces['c2'].position, game.board.positions['cc5']
+ assert_equal game.pieces['c2'].captured, false
+ assert_equal game.pieces['c2'].contains, []
+ assert_equal game.pieces['e1'].position, game.board.positions['e']
+ assert_equal game.pieces['e1'].captured, false
+ assert_equal game.pieces['e1'].contains, []
+ assert_equal game.pieces['e2'].position, game.board.positions['e']
+ assert_equal game.pieces['e2'].captured, false
+ assert_equal game.pieces['e2'].contains, []
+ assert_equal game.current_player, 'e'
+
+ game.apply_moves! move_set2.collect {|m| m.to_move(game)}
+ assert_equal game.history.length, 9
+ assert_equal game.pieces['a1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['a1'].captured, true
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['ac5']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['c1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['c1'].captured, true
+ assert_equal game.pieces['c1'].contains, []
+ assert_equal game.pieces['c2'].position, game.board.positions['cc5']
+ assert_equal game.pieces['c2'].captured, false
+ assert_equal game.pieces['c2'].contains, []
+ assert_equal game.pieces['e1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['e1'].captured, false
+ assert game.pieces['e1'].contains.include?(pieceA1)
+ assert game.pieces['e1'].contains.include?(pieceC1)
+ assert_equal game.pieces['e2'].position, game.board.positions['ec5']
+ assert_equal game.pieces['e2'].captured, false
+ assert_equal game.pieces['e2'].contains, []
+ assert_equal game.current_player, 'a'
+
+ game.undo_move!
+ assert_equal game.history.length, 8
+ assert_equal game.pieces['a1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['a1'].captured, true
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['ac5']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['c1'].captured, false
+ assert game.pieces['c1'].contains.include?(pieceA1)
+
+ assert_equal game.pieces['c2'].position, game.board.positions['cc5']
+ assert_equal game.pieces['c2'].captured, false
+ assert_equal game.pieces['c2'].contains, []
+ assert_equal game.pieces['e1'].position, game.board.positions['ec5']
+ assert_equal game.pieces['e1'].captured, false
+ assert_equal game.pieces['e1'].contains, []
+ assert_equal game.pieces['e2'].position, game.board.positions['ec5']
+ assert_equal game.pieces['e2'].captured, false
+ assert_equal game.pieces['e2'].contains, []
+ assert_equal game.current_player, 'e'
+
+ assert_equal game.pieces['c1'].position, game.pieces['a1'].position
+ assert_equal game.pieces['c1'].position, game.board.positions['ac6']
+
+
+ game.apply_moves! move_set2a.collect {|m| m.to_move(game)}
+ assert_equal game.history.length, 9
+ assert_equal game.pieces['a1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['a1'].captured, true
+ assert_equal game.pieces['a1'].contains, []
+ assert_equal game.pieces['a2'].position, game.board.positions['ac5']
+ assert_equal game.pieces['a2'].captured, false
+ assert_equal game.pieces['a2'].contains, []
+ assert_equal game.pieces['c1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['c1'].captured, true
+ assert_equal game.pieces['c1'].contains, []
+ assert_equal game.pieces['c2'].position, game.board.positions['cc5']
+ assert_equal game.pieces['c2'].captured, false
+ assert_equal game.pieces['c2'].contains, []
+ assert_equal game.pieces['e1'].position, game.board.positions['ac6']
+ assert_equal game.pieces['e1'].captured, false
+ assert game.pieces['e1'].contains.include?(pieceA1)
+ assert game.pieces['e1'].contains.include?(pieceC1)
+ assert_equal game.pieces['e2'].position, game.board.positions['ec5']
+ assert_equal game.pieces['e2'].captured, false
+ assert_equal game.pieces['e2'].contains, []
+ assert_equal game.current_player, 'a'
+
+ end
+end
\ No newline at end of file