Class: Game

Inherits:
Object
  • Object
show all
Defined in:
lib/herostats/game.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeGame

Returns a new instance of Game.



6
7
8
9
# File 'lib/herostats/game.rb', line 6

def initialize
  @players = {}
  @teams = {1 => Team.new, 2 => Team.new}
end

Instance Attribute Details

#playersObject

An Hash of Player in the current game



3
4
5
# File 'lib/herostats/game.rb', line 3

def players
  @players
end

#teamsObject

An Hash of Team in the current game



5
6
7
# File 'lib/herostats/game.rb', line 5

def teams
  @teams
end

Instance Method Details

#add_player(player) ⇒ Object

Adds a player to the

Parameters:



13
14
15
# File 'lib/herostats/game.rb', line 13

def add_player(player)
  @players[@players.count + 1] = player
end

#blue_teamObject

Alias for team 1



18
19
20
# File 'lib/herostats/game.rb', line 18

def blue_team
  teams[1]
end

#red_teamObject

Alias for team 2



22
23
24
# File 'lib/herostats/game.rb', line 22

def red_team
  teams[2]
end