Giovanni Intini wrote:
> On Sun, 12 Dec 2004 04:12:28 +0900, Hans Fugal <fugalh / xmission.com> wrote:
> 
>>Attached is such a server, and you are welcome to play a running version
>>at fugal.net:1276. If you notice bugs please let me know - it has been
>>through some rudimentary testing but not exhaustive testing.
> 
> 
> I tried testing it by connecting twice to a server running locally and
> it didn't notice a victory by player X on the right column (0,2 - 1,2
> - 2,2). I had to continue playing until it eventually ended in a draw
> 
> 

Oops. Patch.
Sat Dec 11 17:04:53 MST 2004  hans / fugal.net
   * column check bug
   Also rearranged the row and column checks to be more logical.

diff -rN -u rubyquiz-old/tictactoe/server.rb 
rubyquiz-new/tictactoe/server.rb
--- rubyquiz-old/tictactoe/server.rb    2004-12-11 17:08:09.000000000 -0700
+++ rubyquiz-new/tictactoe/server.rb    2004-12-11 17:02:52.000000000 -0700
@@ -22,16 +22,18 @@
        return @o if s.include? "O"*@z
        false
      end
+
+    # check on the rows
+    @board.each {|row| ret = check(row) and return ret}
+
+    # check on the columns
+    @cols.times do |col|
+      s = @board.inject("") {|s,row| s << row[col]}
+      ret = check(s) and return ret
+    end
+
      @rows.times do |x|
-      # check on the row
-      ret = check(@board[x]) and return ret
        @cols.times do |y|
-       # check on the column
-       if x == 0
-         s = @board.collect {|row| row[y]}.join ""
-         ret = check(s) and return ret
-       end
-
         # check diagonally down and to the right
         if @cols - y >= @z and @rows - x >= @z
           s = ''