On Thu, 16 Dec 2004 07:01:31 +0900
James Edward Gray II <james / grayproductions.net> wrote:

| On Dec 14, 2004, at 7:17 PM, Thomas Leitner wrote:
| 
| > I have attached my solution to this Ruby Quiz.
| 
| Just FYI.  Here's my latest game with your AI.  It plays well, as you 
| can see, but an exception is thrown:
| 
| [SNIP]
|
| 3
| draw
| tictactoe.rb:210:in `play_tictactoe': undefined local variable or 
| method `game' for #<UserInterface:0x35021c> (NameError)
|          from tictactoe.rb:250
| 
| James Edward Gray II
|  

Thanks, James!

I should have played in the single game once. Here is the correct
UserInterface#play_tictactoe method:

def play_tictactoe
	game = init_game
	case game.play
	when 0 then puts "first player won"
	when 1 then puts "second player won"
	when 2 then puts "draw"
	end
	game.players.each {|p| p.save}
end

Btw. does anybody know a good book about test driven development?

Thomas

-- 
|\  Thomas Leitner  --  thomas [underscore] leitner [at] gmx [dot] at
|>
|/  "Life is what happens to you while you're busy making other plans"