Mistake in the King's Table (Kingt):

             "NNRQKR", # 48
             "NNRQKR", # 64

should be
              "NNRQKR", # 48
              "NNRKQR", # 64


>From: "Alex Watt" <alex_w00t / hotmail.co.uk>
>Reply-To: ruby-talk / ruby-lang.org
>To: ruby-talk / ruby-lang.org (ruby-talk ML)
>Subject: [RUBY QUIZ #106], too late?
>Date: Sun, 31 Dec 2006 04:31:26 +0900
>
>I've only just had time to finish it. If it's not too late, here's what 
>I've done:
>
>Bishopt = [
>              "BB------", # 0
>              "B--B----", # 1
>              "B----B--", # 2
>              "B------B", # 3
>              "-BB-----", # 4
>              "--BB----", # 5
>              "--B--B--", # 6
>              "--B----B", # 7
>              "-B--B---", # 8
>              "---BB---", # 9
>              "----BB--", # 10
>              "----B--B", # 11
>              "-B----B-", # 12
>              "---B--B-", # 13
>              "-----BB-", # 14
>              "------BB" # 15
>              ]
>Kingt =    [
>              "QNNRKR", # 0
>              "NQNRKR", # 16
>              "NNQRKR", # 32
>              "NNRQKR", # 48
>              "NNRQKR", # 64
>              "NNRKRQ", # 80
>              "QNRNKR", # 96
>              "NQRNKR", # 112
>              "NRQNKR", # 128
>              "NRNQKR", # 144
>              "NRNKQR", # 160
>              "NRNKRQ", # 176
>              "QNRKNR", # 192
>              "NQRKNR", # 208
>              "NRQKNR", # 224
>              "NRKQNR", # 240
>              "NRKNQR", # 256
>              "NRKNRQ", # 272
>              "QNRKRN", # 288
>              "NQRKRN", # 304
>              "NRQKRN", # 320
>              "NRKQRN", # 336
>              "NRKRQN", # 352
>              "NRKRNQ", # 368
>              "QRNNKR", # 384
>              "RQNNKR", # 400
>              "RNQNKR", # 416
>              "RNNQKR", # 432
>              "RNNKQR", # 448
>              "RNNKRQ", # 464
>              "QRNKNR", # 480
>              "RQNKNR", # 496
>              "RNQKNR", # 512
>              "RNKQNR", # 528
>              "RNKNQR", # 544
>              "RNKNRQ", # 560
>              "QRNKRN", # 576
>              "RQNKRN", # 592
>              "RNQKRN", # 608
>              "RNKQRN", # 624
>              "RNKRQN", # 640
>              "RNKRNQ", # 656
>              "QRKNNR", # 672
>              "RQKNNR", # 688
>              "RKQNNR", # 704
>              "RKNQNR", # 720
>              "RKNNQR", # 736
>              "RKNNRQ", # 752
>              "QRKNRN", # 768
>              "RQKNRN", # 784
>              "RKQNRN", # 800
>              "RKNQRN", # 816
>              "RKNRQN", # 832
>              "RKNRNQ", # 848
>              "QRKRNN", # 864
>              "RQKRNN", # 880
>              "RKQRNN", # 896
>              "RKRQNN", # 912
>              "RKRNQN", # 928
>              "RKRNNQ", # 944
>              "QNNRKR", # 960
>              ]
>
>pieces = %w(K Q R R B B N N)
>row = [*("A".."H")]
>
>loop do
>  pieces = pieces.sort_by { rand }
>  break if pieces.to_s =~ /.*R.*K.*R.*/ and pieces.to_s =~ /.*B(..)*B.*/
>end
>
>bCombo = pieces.to_s.gsub(/[KQRN]/,'-')
>bishopComboNo = Bishopt.index(bCombo)
>
>kCombo = pieces.to_s.gsub(/B/,'')
>kingComboNo = (Kingt.index(kCombo) == 0) ? 0 : Kingt.index(kCombo) + 
>(15*Kingt.index(kCombo))
>
>puts "Starting position: #{kingComboNo + bishopComboNo}"
>puts
>puts "Black Pieces"
>puts row.map { |square| square + "8" }.join(" ")
>puts pieces.join("   ")
>4.times { puts }
>puts pieces.join("   ")
>puts row.map { |square| square + "1" }.join(" ")
>puts "White Pieces"
>
>_________________________________________________________________
>MSN Hotmail is evolving check out the new Windows Live Mail 
>http://ideas.live.com
>
>

_________________________________________________________________
Be the first to hear what's new at MSN - sign up to our free newsletters!  
http://www.msn.co.uk/newsletters