Permalink
Browse files

now turns are actually implemented and players must alternate

  • Loading branch information...
1 parent 9c43c9b commit e288aab871acd4636f80b29d0f17f1557669c60f @scrooloose committed Mar 1, 2008
Showing with 9 additions and 0 deletions.
  1. +1 −0 models/piece.rb
  2. +8 −0 spec/piece_spec.rb
View
@@ -30,6 +30,7 @@ def move(move)
raise(IllegalMoveError, "illegal move from #{square} -> #{move.square}") unless legal?(move)
board.piece_captured(board.piece_for(move.square))
@square = move.square
+ board.game.turn_complete
end
def legal?(move)
View
@@ -43,4 +43,12 @@
m = p.move_for(Square.new(4,2))
p.legal?(m).should_not be
end
+
+ it "should become the other players turn after #move is called" do
+ #grab the white kings pawn
+ p = boards(:start).piece_for(Square.new(4,6))
+ p.move(p.move_for(Square.new(4,5)))
+
+ p.board.game.current_player.should equal(Player.black)
+ end
end

0 comments on commit e288aab

Please sign in to comment.