Sha256: f77aca6d7236a5a57f3f5ebf48ab4782aaec0b8fbe5158cb331ed94cd7be5aeb
Contents?: true
Size: 1.15 KB
Versions: 2
Compression:
Stored size: 1.15 KB
Contents
require_relative 'minimax' module TTT class MoveGenerator attr_accessor :game def get_player_choice(game) @game = game get_move end def get_move if human? input_helper.get_player_choice(game) elsif computer? input_helper.computer_choosing_graphic if difficult? perfect_move elsif easy? random_move end end end def perfect_move minimax = game_module::Minimax.new(game.board, game.number_of_turns_taken, game.player_1_value, game.player_2_value) minimax.run_minimax minimax.choice end def random_move available_choices.sample end def available_choices game.available_choices end def game_module game.game_module end def current_player game.current_player end def input_helper game.input_helper end def human? game.current_player_human? end def computer? game.current_player_computer? end def difficult? game.current_player_difficult_computer? end def easy? game.current_player_easy_computer? end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
games_bfox-0.3.0 | lib/games/tictactoe/move_generator.rb |
games_bfox-0.2.0 | lib/games/tictactoe/move_generator.rb |