Sha256: 54e7e73274235c4afa84ec755f50d828ef86cc5585150588998183df8b89d9b9

Contents?: true

Size: 471 Bytes

Versions: 1

Compression:

Stored size: 471 Bytes

Contents

module TaTeTi
  class DumbPlayer < Player
    def move( board )
      moves = board.moves
      moves[rand(moves.size)]
    end

    def finish( final_board )
#      print final_board
      
      if final_board.won? == @mark
#        print "Congratulations, you win.\n\n"
				win = 1
      elsif final_board.won? == " "
#        print "Tie game.\n\n"
				win = 0
      else
#        print "You lost tic-tac-toe?!\n\n"
				win = -1
      end
      win
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ta-te-ti-0.0.2 lib/ta_te_ti/dumb_player.rb