My hacked-together solution, based on Bangkok (http://bangkok.rubyforge.org), is at http://www.io.com/~jimm/rubyquiz/quiz35/. I need to improve the board drawing routine and make the input more tolerant. Input for each move must be of the form used for chess game files (e.g., "f4", "Nf6", "Nxc6").
Jim
···
--
Jim Menard, jimm@io.com, http://www.io.com/~jimm
"An operating system is a collection of things that don't fit into a
language. There shouldn't be one."
-- Dan Ingalls
Egad that's short!
Unfortunately, I'm having trouble running it:
$ ruby -rubygems main.rb
./chessgame.rb:9:in `play': undefined method `board=' for #<DisplayListener:0x39e35c> (NoMethodError)
from main.rb:5
James Edward Gray II
···
On Jun 15, 2005, at 8:54 AM, Jim Menard wrote:
My hacked-together solution, based on Bangkok (http://bangkok.rubyforge.org), is at http://www.io.com/~jimm/rubyquiz/quiz35/\. I need to improve the board drawing routine and make the input more tolerant. Input for each move must be of the form used for chess game files (e.g., "f4", "Nf6", "Nxc6").
James Edward Gray II wrote:
My hacked-together solution, based on Bangkok (http:// bangkok.rubyforge.org), is at http://www.io.com/~jimm/rubyquiz/ quiz35/. I need to improve the board drawing routine and make the input more tolerant. Input for each move must be of the form used for chess game files (e.g., "f4", "Nf6", "Nxc6").
Egad that's short!
Unfortunately, I'm having trouble running it:
$ ruby -rubygems main.rb
./chessgame.rb:9:in `play': undefined method `board=' for #<DisplayListener:0x39e35c> (NoMethodError)
from main.rb:5
James Edward Gray II
Oops. Remove the line
@listener.board = @board
from chessgame.rb. I've posted a fixed file and playchess.tar.gz file to http://www.io.com/~jimm/rubyquiz/quiz35/\. That's what I get for making a last-minute change without any tests. (Bangkok has tests, but not this simple playchess interface.)
Jim
···
On Jun 15, 2005, at 8:54 AM, Jim Menard wrote:
--
Jim Menard, jimm@io.com, http://www.io.com/~jimm
"An operating system is a collection of things that don't fit into a
language. There shouldn't be one."
-- Dan Ingalls
You're going to wish I would shut pretty soon, but...
It's not notifying me of checkmates and looking at the code it seems like it should. Am I missing something?
$ ruby -rubygems main.rb
BR BN BB BQ BK BB BN BR
BP BP BP BP BP BP BP BP
WP WP WP WP WP WP WP WP
WR WN WB WQ WK WB WN WR
White: e4
BR BN BB BQ BK BB BN BR
BP BP BP BP BP BP BP BP
WP
WP WP WP WP WP WP WP
WR WN WB WQ WK WB WN WR
Black: e5
BR BN BB BQ BK BB BN BR
BP BP BP BP BP BP BP
BP
WP
WP WP WP WP WP WP WP
WR WN WB WQ WK WB WN WR
White: Bc4
BR BN BB BQ BK BB BN BR
BP BP BP BP BP BP BP
BP
WB WP
WP WP WP WP WP WP WP
WR WN WB WQ WK WN WR
Black: Nc6
BR BB BQ BK BB BN BR
BP BP BP BP BP BP BP
BN
BP
WB WP
WP WP WP WP WP WP WP
WR WN WB WQ WK WN WR
White: Qf3
BR BB BQ BK BB BN BR
BP BP BP BP BP BP BP
BN
BP
WB WP
WQ
WP WP WP WP WP WP WP
WR WN WB WK WN WR
Black: d6
BR BB BQ BK BB BN BR
BP BP BP BP BP BP
BN BP
BP
WB WP
WQ
WP WP WP WP WP WP WP
WR WN WB WK WN WR
White: Qxf7
BR BB BQ BK BB BN BR
BP BP BP WQ BP BP
BN BP
BP
WB WP
WP WP WP WP WP WP WP
WR WN WB WK WN WR
Black:
James Edward Gray II
···
On Jun 15, 2005, at 2:02 PM, Jim Menard wrote:
Oops. Remove the line
James Edward Gray II wrote:
You're going to wish I would shut pretty soon, but...
It's not notifying me of checkmates and looking at the code it seems like it should. Am I missing something?
No, I missed something. Bangkok reads pre-existing chess game files. Those files contain standard chess move strings that have modifiers that explicitly say "check" or "checkmate". Bangkok notifies the listener when it sees those; it does not look at the pieces and determine if there is a check or checkmate.
I think I'd better withdraw my solution. It isn't a solution to the quiz you posed. Oh, well, Only 15-20 minutes of my life wasted.
Jim
···
--
Jim Menard, jimm@io.com, http://www.io.com/~jimm
"An operating system is a collection of things that don't fit into a
language. There shouldn't be one."
-- Dan Ingalls
Jim Menard wrote:
I think I'd better withdraw my solution. It isn't a solution to the quiz you posed. Oh, well, Only 15-20 minutes of my life wasted.
I'm sorry that I wasted *your* time, though.
Jim
···
--
Jim Menard, jimm@io.com, http://www.io.com/~jimm
"An operating system is a collection of things that don't fit into a
language. There shouldn't be one."
-- Dan Ingalls
No, I missed something. Bangkok reads pre-existing chess game files. Those files contain standard chess move strings that have modifiers that explicitly say "check" or "checkmate". Bangkok notifies the listener when it sees those; it does not look at the pieces and determine if there is a check or checkmate.
I must say, I had seen Bangkok on RubyForge before and wondered about it. That is one unique concept you've got for a library there. It's very interesting and I'm glad I've now had an excuse to look a little deeper at it.
I think I'd better withdraw my solution. It isn't a solution to the quiz you posed. Oh, well, Only 15-20 minutes of my life wasted.
I still found it informative and I'm glad you sent it in. It is a good example for part II of this crazy idea of mine...
James Edward Gray II
···
On Jun 15, 2005, at 3:07 PM, Jim Menard wrote: