Class: TTT::AIEasy
Instance Attribute Summary
Attributes inherited from AI
Attributes inherited from Player
Instance Method Summary collapse
Methods inherited from AI
#available_moves, #no_gui?, #opposite_side, #prompt, #undo_move
Methods included from Minimax
#alpha_beta_swapped?, #base_case_satisfied?, #eval_score, #gen_score_game_tree, #mark_curr_player_side, #minimax, #winning_score
Methods inherited from Player
Constructor Details
This class inherits a constructor from TTT::Player
Instance Method Details
#move(options) ⇒ Object
4 5 6 7 |
# File 'lib/ttt/ai_easy.rb', line 4 def move() super random_move end |
#random_move ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/ttt/ai_easy.rb', line 9 def random_move move = nil available_moves.each do |square| move ||= square if Time.new.usec % 3 == 0 end return(move ? move : available_moves.last) end |