lib/chess/pieces.rb
#this needs to be heavily filtered, since pawns can move diagonally only if 
this needs to be heavily filtered, since pawns can move diagonally only if
this needs to be heavily filtered since pawns can move diagonally only if
def potential_moves
      row = @position.first
      col = @position.last
      pos = []
      if @color == :white
        if row == 1
	  pos << [row+2, col]
	end
	if row < 7
	  pos << [row + 1, col]
	end
	if col > 0 && row < 7
	  pos << [row + 1, col - 1]
	end
	if col < 7 && row < 7
	  pos << [row + 1, col + 1]
	end
      else
	if row == 6
	  pos << [row - 2, col]
	end
	if row > 0
	  pos << [row -1, col] 
	  if col > 0
	    pos << [row - 1, col - 1]
	  elsif col < 7
	    pos << [row -1, col + 1]
	  end
	end
      end
      return pos
    end
def potential_moves row = @position . first col = @position . last pos = [ ] if @color == :white if row == 1 pos << [ row + 2 , col ] end if row < 7 pos << [ row + 1 , col ] end if col > 0 && row < 7 pos << [ row + 1 , col - 1 ] end if col < 7 && row < 7 pos << [ row + 1 , col + 1 ] end else if row == 6 pos << [ row - 2 , col ] end if row > 0 pos << [ row - 1 , col ] if col > 0 pos << [ row - 1 , col - 1 ] elsif col < 7 pos << [ row - 1 , col + 1 ] end end end return pos end
this needs to be heavily filtered, since pawns can move diagonally only if
this needs to be heavily filtered since pawns can move diagonally only if