class Geese::Board
Represents a Game of Geese
board, you can create a new board with a number of squares. A classical Game of Geese
board has 63 squares, exluding the ‘start’ square.
Players can be added using ‘add_player`. This will add the players automatically to the ’start’ squard
Attributes
number_of_squares[R]
players[R]
Public Class Methods
create_with_number_of_squares(number_of_squares = 63)
click to toggle source
Creates a new Board
with the specified ‘number_of_squares`, this does not include the ’start’ square, which is always present.
The default ‘number_of_squares` is 63, for a classica Game of Geese
.
# File lib/geese/board.rb, line 16 def self.create_with_number_of_squares(number_of_squares = 63) self.new(number_of_squares) end
new(number_of_squares)
click to toggle source
# File lib/geese/board.rb, line 37 def initialize(number_of_squares) @number_of_squares = number_of_squares @players = [] end
Public Instance Methods
add_player(attributes)
click to toggle source
Adds a player to the board, the following attributes need to be present:
* name: "Gandalf" # Name of the player * age: 342 # Age of the player in years * color: "grey" # The color of the goose representing this player
Example:
board.add_player(name: 'Samual L. Jackson', age: 52, color: 'purple')
# File lib/geese/board.rb, line 31 def add_player(attributes) @players << attributes end