public
Fork of scrooloose/chesticles
Description: A chess hax in ruby
Clone URL: git://github.com/halorgium/chesticles.git
refactored Move to use Board#king_for instead of doing the work itself
scrooloose (author)
Thu Mar 06 22:31:45 -0800 2008
commit  8cc78ed11bdb8600fd6af65b1f82c7165bcac342
tree    606ec1aca72cffe55fb8f4425ae49d0c1b91d6aa
parent  bdc8de56544ff8dae8a320a786d139c81b0b9c91
...
12
13
14
15
 
16
17
18
19
20
21
22
 
23
24
25
...
12
13
14
 
15
16
17
18
19
20
21
 
22
23
24
25
0
@@ -12,14 +12,14 @@ class Move
0
   end
0
 
0
   def checks_enemy?
0
- enemy_king = board.pieces.find {|p| p.is_a?(King) && p.player != player}
0
+ enemy_king = board.king_for(player.enemy)
0
     piece.temporarily_move_to(square) do |p|
0
       board.threatened?(enemy_king.square, player)
0
     end
0
   end
0
 
0
   def checks_self?
0
- our_king = board.pieces.find {|p| p.is_a?(King) && p.player == player}
0
+ our_king = board.king_for(player)
0
     piece.temporarily_move_to(square) do |p|
0
       board.threatened?(our_king.square, player.enemy)
0
     end

Comments

    No one has commented yet.