Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

now BoardRenderer catches illegal move exceptions and doesnt make the…

… move
  • Loading branch information...
commit d86a0b5b6d5507cbf8c99f87617e6f2f7ca7298a 1 parent 4b7174c
Martin Grenfell authored

Showing 1 changed file with 4 additions and 3 deletions. Show diff stats Hide diff stats

  1. 7  views/board_renderer.rb
7  views/board_renderer.rb
@@ -100,9 +100,10 @@ def square_selected
100 100
     if @selected_square.nil?
101 101
       @selected_square = @current_square
102 102
     else
103  
-      p = @board.piece_for(@selected_square)
104  
-      m = Move.new(p, @current_square)
105  
-      m.execute
  103
+      begin
  104
+        @board.piece_for(@selected_square).move_to(@current_square)
  105
+      rescue Piece::IllegalMoveError
  106
+      end
106 107
       @selected_square = nil
107 108
     end
108 109
   end

0 notes on commit d86a0b5

Please sign in to comment.
Something went wrong with that request. Please try again.