lib/bioshogi/location.rb in bioshogi-0.0.14 vs lib/bioshogi/location.rb in bioshogi-0.0.15
- old
+ new
@@ -10,12 +10,12 @@
#
module Bioshogi
class Location
include ApplicationMemoryRecord
memory_record [
- { key: :black, name: "▲", pentagon_mark: "☗", equality_name: "先手", handicap_name: "下手", equality_yomiage: "先手", handicap_yomiage: "したて", flip_mark: "▼", varrow: " ", csa_sign: "+", angle: 0, other_match_chars: ["☗"], to_sfen: "b", normalize_key: :itself, value_sign: +1, checkmate_yomiage: "せめかた", },
- { key: :white, name: "△", pentagon_mark: "☖", equality_name: "後手", handicap_name: "上手", equality_yomiage: "後手", handicap_yomiage: "うわて", flip_mark: "▽", varrow: "v", csa_sign: "-", angle: 180, other_match_chars: ["☖"], to_sfen: "w", normalize_key: :flip, value_sign: -1, checkmate_yomiage: "gyokugata", },
+ { key: :black, name: "▲", pentagon_mark: "☗", equality_name: "先手", handicap_name: "下手", equality_yomiage: "先手", handicap_yomiage: "したて", flip_mark: "▼", varrow: " ", csa_sign: "+", angle: 0, other_match_chars: ["☗"], to_sfen: "b", normalize_key: :itself, sign_dir: +1, checkmate_yomiage: "せめかた", },
+ { key: :white, name: "△", pentagon_mark: "☖", equality_name: "後手", handicap_name: "上手", equality_yomiage: "後手", handicap_yomiage: "うわて", flip_mark: "▽", varrow: "v", csa_sign: "-", angle: 180, other_match_chars: ["☖"], to_sfen: "w", normalize_key: :flip, sign_dir: -1, checkmate_yomiage: "gyokugata", },
]
class << self
# lookup(-1).key # => :white
# lookup(:white).key # => :white
@@ -115,9 +115,29 @@
def style_transform
if angle.nonzero?
"transform: rotate(#{angle}deg)"
end
end
+
+ ################################################################################
+
+ def top
+ Dimension::Row.top.white_then_flip(self)
+ end
+
+ def bottom
+ Dimension::Row.bottom.white_then_flip(self)
+ end
+
+ def left
+ Dimension::Column.left.white_then_flip(self)
+ end
+
+ def right
+ Dimension::Column.right.white_then_flip(self)
+ end
+
+ ################################################################################
private
def call_name_method_name(handicap)
if handicap