Class: PlayerColor

Inherits:
TypesafeEnum::Base
  • Object
show all
Defined in:
lib/software_challenge_client/player_color.rb

Class Method Summary collapse

Class Method Details

.opponentColor(color) ⇒ PlayerColor

Returns the opponents Color

Parameters:

  • color (PlayerColor)

    The player’s color, whose opponent needs to be found

Returns:



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/software_challenge_client/player_color.rb', line 14

def self.opponentColor(color)
  if color == PlayerColor::RED
    return PlayerColor::BLUE
  end
  if color == PlayerColor::BLUE
    return PlayerColor::RED
  end
  if color == PlayerColor::NONE
    return PlayerColor::NONE
  end
end