File tree 3 files changed +13
-6
lines changed
3 files changed +13
-6
lines changed Original file line number Diff line number Diff line change 2
2
3
3
module RubyConnect
4
4
class Game
5
- attr_reader :board
5
+ attr_accessor :board , :winning_move
6
6
7
7
def initialize ( player1 , player2 )
8
8
@board = Board . new
@@ -12,13 +12,13 @@ def initialize(player1, player2)
12
12
end
13
13
14
14
def done?
15
- board . full? || @ winning_move
15
+ board . full? || winning_move
16
16
end
17
17
18
18
def make_move ( column , color )
19
19
raise GameOverError if done?
20
20
board . insert_into_column column , color
21
- @ winning_move = false # TODO: winning_move?
21
+ winning_move = false # TODO: winning_move?
22
22
end
23
23
end
24
24
end
Original file line number Diff line number Diff line change 1
1
module RubyConnect
2
2
class Player
3
+ attr_reader :game , :color
4
+
3
5
def initialize ( info = { } )
4
6
@name = info [ :name ]
5
7
@phone_number = info [ :phone_number ]
6
8
@color = info [ :color ]
9
+ @game = info [ :game ]
7
10
end
8
11
9
- def move ( game , column )
10
- game . make_move ( column , @ color)
12
+ def make_move ( column )
13
+ game . make_move ( column , color )
11
14
end
12
15
end
13
16
end
Original file line number Diff line number Diff line change 2
2
3
3
module RubyConnect
4
4
describe Player do
5
-
5
+ let ( :player ) { Player . new color : :red , name : "John" , game : 1 }
6
+
7
+ context '#make_move' do
8
+
9
+ end
6
10
end
7
11
end
You can’t perform that action at this time.
0 commit comments