# coding: utf-8 require './board' require './bot' require './human' @board = Board.new def is_over? board, cur if board.any_winner? then system "clear" print board.to_s print "\n#{cur} won!\n" return true elsif board.is_full? then system "clear" print board.to_s print "\nGame is done!\n" return true end end def play_game player, bot while true do system "clear" print @board.to_s player.move if is_over? @board, player.val then break end bot.move @board if is_over? @board, bot.val then break end end end player = Human.new @board, " X " bot = Bot.new @board, " O " play_game player, bot