Class: MaximizingPlayer

Inherits:
Player
  • Object
show all
Defined in:
lib/player.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Player

#add_marker, #get_alpha

Constructor Details

#initialize(player) ⇒ MaximizingPlayer

Returns a new instance of MaximizingPlayer.



60
61
62
63
# File 'lib/player.rb', line 60

def initialize(player)
  @marker = player.marker
  @opponent = player.opponent
end

Instance Attribute Details

#markerObject

Returns the value of attribute marker.



59
60
61
# File 'lib/player.rb', line 59

def marker
  @marker
end

#opponentObject

Returns the value of attribute opponent.



59
60
61
# File 'lib/player.rb', line 59

def opponent
  @opponent
end

Instance Method Details

#get_beta(beta, score) ⇒ Object



65
66
67
# File 'lib/player.rb', line 65

def get_beta(beta, score)
  score < beta ? score : beta
end

#return_best_score(alpha, beta) ⇒ Object



69
70
71
# File 'lib/player.rb', line 69

def return_best_score(alpha, beta)
  beta
end