lib/tak/board.rb
# Checks to see if a given x y coordinate pair is counted as a road win
# by being on the appropriate opposite end from the starting direction
# of the road.
#
# @param direction [Symbol]  Starting direction of the road
# @param x         [Integer]
# @param y         [Integer]
#
# @return [Boolean]
Checks to see if a given x y coordinate pair is counted as a road win
by being on the appropriate opposite end from the starting direction
of the road.
Checks to see if a given x y coordinate pair is counted as a road win by being on the appropriate opposite end from the starting direction of the road .
def road_end?(direction, x, y)
      case direction
      when :horizontal
        x == @size - 1
      when :vertical
        y == @size - 1
      else
        x == @size - 1 || y == @size - 1
      end
    end
def road_end? ( direction , x , y ) case direction when :horizontal x == @size - 1 when :vertical y == @size - 1 else x == @size - 1 || y == @size - 1 end end
Checks to see if a given x y coordinate pair is counted as a road win
by being on the appropriate opposite end from the starting direction
of the road.
Checks to see if a given x y coordinate pair is counted as a road win by being on the appropriate opposite end from the starting direction of the road .
None
Boolean
direction
Starting direction of the road
Starting direction of the road
x
<not_specific>
y
<not_specific>
<not_specific>
None