Skip to content

Commit

Permalink
Game changes
Browse files Browse the repository at this point in the history
  • Loading branch information
lisahamm committed Mar 11, 2015
1 parent f008275 commit c0c11f5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/tic_tac_toe/game.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ class Game
attr_accessor :board, :current_player_mark
attr_reader :player1, :player2

def initialize(board=nil, player1_mark, player2_mark, current_player_mark)
@board = board ||= Board.new
def initialize(player1_mark, player2_mark, current_player_mark, cells=nil)
@board = Board.new(cells)
@player1 = player1_mark
@player2 = player2_mark
@current_player_mark = current_player_mark
Expand Down
6 changes: 3 additions & 3 deletions spec/game_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@ module TicTacToe
nil, 'X', nil,
nil, nil, nil]
board = Board.new(cells: cells)
Game.new(board, 'X', 'O', 'X')
Game.new('X', 'O', 'X', board)
end

let(:won_game) do
cells = ['X', 'X', 'O',
'O', 'X', 'X',
'X', 'O', 'X']
board = Board.new(cells: cells)
Game.new(board, 'X', 'O', 'X')
Game.new('X', 'O', 'X', board)
end

let(:tie_game) do
cells = ['X', 'X', 'O',
'O', 'O', 'X',
'X', 'O', 'X']
board = Board.new(cells: cells)
Game.new(board, 'X', 'O', 'X')
Game.new('X', 'O', 'X', board)
end

describe "#take_turn" do
Expand Down
Binary file removed tic_tac_toe-0.0.1.gem
Binary file not shown.

0 comments on commit c0c11f5

Please sign in to comment.