aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTeddy Wing2015-04-11 16:33:26 -0400
committerTeddy Wing2015-04-11 16:33:26 -0400
commitfcc227c2c7e8f409dc286c9f00a4395b7cc8133c (patch)
tree54b5e3ba2dbf03b97d387a1c60a3b630df2c79be
parentd1e085097a85fe6bc0e42331e0841c1e9257fbc4 (diff)
downloadtic-tac-toe-fcc227c2c7e8f409dc286c9f00a4395b7cc8133c.tar.bz2
Board: initialize with a grid of dots
The board starts as a grid of dots represented by a 2-dimensional array.
-rw-r--r--board.rb8
-rw-r--r--spec/board_spec.rb9
2 files changed, 17 insertions, 0 deletions
diff --git a/board.rb b/board.rb
index 19fa63b..9481d45 100644
--- a/board.rb
+++ b/board.rb
@@ -1,4 +1,12 @@
class Board
+ def initialize
+ @board = [
+ ['.', '.', '.'],
+ ['.', '.', '.'],
+ ['.', '.', '.']
+ ]
+ end
+
def render
puts "...\n" * 3
end
diff --git a/spec/board_spec.rb b/spec/board_spec.rb
index d71a47b..1370c10 100644
--- a/spec/board_spec.rb
+++ b/spec/board_spec.rb
@@ -17,4 +17,13 @@ describe Board do
...
EOF
end
+
+ it 'starts with a grid of dots' do
+ @board.instance_variable_get('@board').must_equal [
+ ['.', '.', '.'],
+ ['.', '.', '.'],
+ ['.', '.', '.']
+ ]
+ end
+ end
end