aboutsummaryrefslogtreecommitdiffstats
path: root/player.rb
diff options
context:
space:
mode:
authorTeddy Wing2015-04-14 18:18:33 -0400
committerTeddy Wing2015-04-14 18:19:22 -0400
commita9698b70d47e5c4914d27b38baccd9feec8479a8 (patch)
tree27fba0805123ef2e4f4cdca329b1b5d519b13783 /player.rb
parente6910571b4bb9f65a241df9ff28ff4cfbb832aa5 (diff)
downloadtic-tac-toe-a9698b70d47e5c4914d27b38baccd9feec8479a8.tar.bz2
Player: Add a `#move` method to move a piece to a cell on the board
Also add `Board#update_cell` to facilitate player movement.
Diffstat (limited to 'player.rb')
-rw-r--r--player.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/player.rb b/player.rb
index d19ee36..8146220 100644
--- a/player.rb
+++ b/player.rb
@@ -8,4 +8,10 @@ class Player
@insignia = insignia
@board = board
end
+
+ def move(coordinates)
+ raise ArgumentError if coordinates.nil?
+
+ @board.update_cell(coordinates[0], coordinates[1], @insignia)
+ end
end