module OthelloRuby::Game::BordWork
Public Instance Methods
get_reverse_pattern(active, passive, bit_string)
click to toggle source
# File lib/othello_ruby.rb, line 10 def get_reverse_pattern(active, passive, bit_string) patterns = [] EIGHT_DIRECTION.each do |name| patterns << send("get_#{name}_pat", active, passive, bit_string) end patterns.delete(0) patterns.compact end
left_direction(bit_string)
click to toggle source
# File lib/othello_ruby.rb, line 36 def left_direction(bit_string) (bit_string >> 1) & 0x7F7F7F7F7F7F7F7F end
left_under_direction(bit_string)
click to toggle source
# File lib/othello_ruby.rb, line 56 def left_under_direction(bit_string) (bit_string << 7) & 0xFFFFFFFFFFFFFFFF end
left_upward_direction(bit_string)
click to toggle source
# File lib/othello_ruby.rb, line 52 def left_upward_direction(bit_string) bit_string >> 9 end
right_direction(bit_string)
click to toggle source
# File lib/othello_ruby.rb, line 40 def right_direction(bit_string) (bit_string << 1) & 0xFEFEFEFEFEFEFEFE end
right_under_direction(bit_string)
click to toggle source
# File lib/othello_ruby.rb, line 64 def right_under_direction(bit_string) (bit_string << 9) & 0xFFFFFFFFFFFFFFFF end
right_upward_direction(bit_string)
click to toggle source
# File lib/othello_ruby.rb, line 60 def right_upward_direction(bit_string) bit_string >> 7 end
under_direction(bit_string)
click to toggle source
# File lib/othello_ruby.rb, line 48 def under_direction(bit_string) (bit_string << 8) & 0xFFFFFFFFFFFFFFFF end
upward_direction(bit_string)
click to toggle source
# File lib/othello_ruby.rb, line 44 def upward_direction(bit_string) bit_string >> 8 end