bioshogi 0.0.14 → 0.0.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (282) hide show
  1. checksums.yaml +4 -4
  2. data/.dumbjump +4 -0
  3. data/A/342/206/222B/342/206/222C/346/210/246/346/263/225.txt +2 -2
  4. data/Gemfile.lock +1 -1
  5. data/README.org +3 -3
  6. data/lib/bioshogi/ai/brain.rb +6 -6
  7. data/lib/bioshogi/analysis/analyzer.rb +66 -8
  8. data/lib/bioshogi/analysis/analyzer_mod.rb +2 -9
  9. data/lib/bioshogi/analysis/attack_info.rb +231 -227
  10. data/lib/bioshogi/analysis/{tech_accessor.rb → basic_accessor.rb} +4 -4
  11. data/lib/bioshogi/analysis/board_piller_methods.rb +9 -9
  12. data/lib/bioshogi/analysis/defense_info.rb +132 -132
  13. data/lib/bioshogi/analysis/file_normalizer.rb +1 -1
  14. data/lib/bioshogi/analysis/frequency.rb +368 -311
  15. data/lib/bioshogi/analysis/note_info.rb +6 -6
  16. data/lib/bioshogi/analysis/rocket_analyzer.rb +45 -58
  17. data/lib/bioshogi/analysis/shape_info.rb +73 -19
  18. data/lib/bioshogi/analysis/style_accessor.rb +22 -19
  19. data/lib/bioshogi/analysis/tactic_hit_turn_table.rb +8 -3
  20. data/lib/bioshogi/analysis/tactic_hit_turn_table_generator.rb +15 -14
  21. data/lib/bioshogi/analysis/tactic_info.rb +2 -2
  22. data/lib/bioshogi/analysis/technique_info.rb +3 -4
  23. data/lib/bioshogi/analysis/technique_verify_info.rb +627 -0
  24. data/lib/bioshogi/analysis//345/202/231/350/200/203//345/220/215/344/272/272/343/201/253/345/256/232/350/267/241/343/201/252/343/201/227.kif +4 -2
  25. data/lib/bioshogi/analysis//345/202/231/350/200/203//345/244/247/351/247/222/345/205/250/343/203/226/343/203/203/343/203/201.kif +4 -0
  26. data/lib/bioshogi/analysis//345/202/231/350/200/203//345/257/276/347/251/264/347/206/212.kif +3 -2
  27. data/lib/bioshogi/analysis//345/202/231/350/200/203//346/214/201/344/271/205/346/210/246.kif +2 -2
  28. data/lib/bioshogi/analysis//345/202/231/350/200/203//347/251/264/347/206/212.kif +3 -2
  29. data/lib/bioshogi/analysis//345/202/231/350/200/203//347/251/264/347/206/212/343/201/256/345/247/277/347/204/274/343/201/215.kif +3 -2
  30. data/lib/bioshogi/analysis//345/202/231/350/200/203//350/203/214/346/260/264/343/201/256/351/231/243.kif +7 -3
  31. data/lib/bioshogi/analysis//345/202/231/350/200/203//351/225/267/346/211/213/346/225/260.kif +1 -2
  32. data/lib/bioshogi/analysis//345/202/231/350/200/203//351/247/222/346/237/261.kif +4 -2
  33. data/lib/bioshogi/analysis//345/233/262/343/201/204//343/201/202/343/201/232/343/201/276/343/202/204/345/233/262/343/201/204.kif +1 -1
  34. data/lib/bioshogi/analysis//345/233/262/343/201/204//343/201/213/343/202/223/343/201/264/343/202/207/343/201/206/345/233/262/343/201/204.kif +4 -2
  35. data/lib/bioshogi/analysis//345/233/262/343/201/204//343/202/252/343/203/252/343/202/270/343/203/212/343/203/253/351/233/201/346/234/250.kif +1 -1
  36. data/lib/bioshogi/analysis//345/233/262/343/201/204//343/202/252/343/203/274/343/203/253/343/203/211/351/233/201/346/234/250.kif +1 -1
  37. data/lib/bioshogi/analysis//345/233/262/343/201/204//343/202/253/343/202/277/345/233/262/343/201/204.kif +3 -1
  38. data/lib/bioshogi/analysis//345/233/262/343/201/204//343/203/204/343/203/216/351/212/200/345/233/262/343/201/204.kif +1 -1
  39. data/lib/bioshogi/analysis//345/233/262/343/201/204//343/203/204/343/203/216/351/212/200/351/233/201/346/234/250.kif +1 -1
  40. data/lib/bioshogi/analysis//345/233/262/343/201/204//343/203/234/343/203/212/343/203/263/343/202/266/345/233/262/343/201/204.kif +1 -1
  41. data/lib/bioshogi/analysis//345/233/262/343/201/204//343/203/237/343/203/254/343/203/213/343/202/242/343/203/240/345/233/262/343/201/204.kif +6 -3
  42. data/lib/bioshogi/analysis//345/233/262/343/201/204//343/203/242/343/203/216/343/203/254/343/203/274/343/203/253/345/233/262/343/201/204.kif +1 -1
  43. data/lib/bioshogi/analysis//345/233/262/343/201/204//344/270/255/344/275/217/343/201/276/343/201/204.kif +2 -0
  44. data/lib/bioshogi/analysis//345/233/262/343/201/204//344/270/262/343/202/253/343/203/204/345/233/262/343/201/204.kif +1 -1
  45. data/lib/bioshogi/analysis//345/233/262/343/201/204//345/217/263/347/237/242/345/200/211.kif +1 -1
  46. data/lib/bioshogi/analysis//345/233/262/343/201/204//345/233/233/346/236/232/347/251/264/347/206/212.kif +1 -1
  47. data/lib/bioshogi/analysis//345/233/262/343/201/204//345/233/233/346/236/232/347/276/216/346/277/203.kif +1 -1
  48. data/lib/bioshogi/analysis//345/233/262/343/201/204//345/233/233/346/236/232/351/212/200/345/206/240.kif +2 -2
  49. data/lib/bioshogi/analysis//345/233/262/343/201/204//345/233/233/346/256/265/347/253/257/347/216/211.kif +3 -3
  50. data/lib/bioshogi/analysis//345/233/262/343/201/204//345/233/233/350/247/222/347/237/242/345/200/211.kif +1 -1
  51. data/lib/bioshogi/analysis//345/233/262/343/201/204//345/234/237/345/261/205/347/237/242/345/200/211.kif +1 -1
  52. data/lib/bioshogi/analysis//345/233/262/343/201/204//345/235/212/344/270/273/347/276/216/346/277/203.kif +1 -1
  53. data/lib/bioshogi/analysis//345/233/262/343/201/204//345/244/247/345/261/261/347/276/216/346/277/203.kif +1 -1
  54. data/lib/bioshogi/analysis//345/233/262/343/201/204//345/244/247/351/232/205/345/233/262/343/201/204.kif +1 -1
  55. data/lib/bioshogi/analysis//345/233/262/343/201/204//345/244/251/351/207/216/347/237/242/345/200/211.kif +1 -1
  56. data/lib/bioshogi/analysis//345/233/262/343/201/204//345/257/214/345/243/253/350/246/213/347/237/242/345/200/211.kif +2 -1
  57. data/lib/bioshogi/analysis//345/233/262/343/201/204//345/261/205/351/243/233/350/273/212/347/251/264/347/206/212.kif +1 -1
  58. data/lib/bioshogi/analysis//345/233/262/343/201/204//345/261/205/351/243/233/350/273/212/351/207/221/345/206/240.kif +4 -2
  59. data/lib/bioshogi/analysis//345/233/262/343/201/204//345/261/205/351/243/233/350/273/212/351/207/221/347/204/241/345/217/214.kif +1 -1
  60. data/lib/bioshogi/analysis//345/233/262/343/201/204//345/261/205/351/243/233/350/273/212/351/207/221/347/276/216/346/277/203.kif +1 -1
  61. data/lib/bioshogi/analysis//345/233/262/343/201/204//345/261/205/351/243/233/350/273/212/351/212/200/345/206/240.kif +1 -1
  62. data/lib/bioshogi/analysis//345/233/262/343/201/204//346/202/252/345/275/242/347/237/242/345/200/211.kif +1 -1
  63. data/lib/bioshogi/analysis//345/233/262/343/201/204//346/214/257/343/202/212/351/243/233/350/273/212/343/203/223/343/203/203/343/202/2604.kif +4 -1
  64. data/lib/bioshogi/analysis//345/233/262/343/201/204//346/214/257/343/202/212/351/243/233/350/273/212/343/203/237/343/203/254/343/203/213/343/202/242/343/203/240.kif +5 -2
  65. data/lib/bioshogi/analysis//345/233/262/343/201/204//346/214/257/343/202/212/351/243/233/350/273/212/344/270/262/343/202/253/343/203/204/345/233/262/343/201/204.kif +1 -1
  66. data/lib/bioshogi/analysis//345/233/262/343/201/204//346/214/257/343/202/212/351/243/233/350/273/212/345/233/233/346/236/232/347/276/216/346/277/203.kif +2 -2
  67. data/lib/bioshogi/analysis//345/233/262/343/201/204//346/214/257/343/202/212/351/243/233/350/273/212/347/253/257/347/216/211/351/212/200/345/206/240.kif +1 -1
  68. data/lib/bioshogi/analysis//345/233/262/343/201/204//346/226/207/351/216/256/345/233/262/343/201/204.kif +1 -1
  69. data/lib/bioshogi/analysis//345/233/262/343/201/204//346/234/250/346/235/221/347/276/216/346/277/203.kif +1 -1
  70. data/lib/bioshogi/analysis//345/233/262/343/201/204//346/241/220/345/261/261/346/265/201/344/270/255/345/216/237/345/233/262/343/201/204.kif +1 -1
  71. data/lib/bioshogi/analysis//345/233/262/343/201/204//346/265/201/343/202/214/347/237/242/345/200/211.kif +1 -1
  72. data/lib/bioshogi/analysis//345/233/262/343/201/204//347/204/241/350/262/254/344/273/273/347/237/242/345/200/211.kif +1 -1
  73. data/lib/bioshogi/analysis//345/233/262/343/201/204//347/211/207/343/203/204/343/203/216/351/212/200/345/233/262/343/201/204.kif +1 -1
  74. data/lib/bioshogi/analysis//345/233/262/343/201/204//347/211/207/347/251/264/347/206/212.kif +1 -1
  75. data/lib/bioshogi/analysis//345/233/262/343/201/204//347/237/242/345/200/211/347/251/264/347/206/212.kif +1 -1
  76. data/lib/bioshogi/analysis//345/233/262/343/201/204//347/256/261/345/205/245/343/202/212/345/250/230.kif +2 -2
  77. data/lib/bioshogi/analysis//345/233/262/343/201/204//347/267/217/347/237/242/345/200/211.kif +1 -1
  78. data/lib/bioshogi/analysis//345/233/262/343/201/204//347/276/216/346/277/203/347/206/212/345/233/262/343/201/204.kif +1 -1
  79. data/lib/bioshogi/analysis//345/233/262/343/201/204//350/217/212/346/260/264/347/237/242/345/200/211.kif +1 -1
  80. data/lib/bioshogi/analysis//345/233/262/343/201/204//350/217/261/347/237/242/345/200/211.kif +1 -1
  81. data/lib/bioshogi/analysis//345/233/262/343/201/204//350/243/217/343/202/242/343/203/222/343/203/253/345/233/262/343/201/204.kif +1 -1
  82. data/lib/bioshogi/analysis//345/233/262/343/201/204//350/243/276/345/233/272/343/202/201.kif +1 -1
  83. data/lib/bioshogi/analysis//345/233/262/343/201/204//350/247/222/347/237/242/345/200/211.kif +1 -1
  84. data/lib/bioshogi/analysis//345/233/262/343/201/204//350/261/206/350/205/220/347/237/242/345/200/211.kif +1 -1
  85. data/lib/bioshogi/analysis//345/233/262/343/201/204//351/200/243/347/233/237/347/276/216/346/277/203.kif +1 -1
  86. data/lib/bioshogi/analysis//345/233/262/343/201/204//351/207/221/345/244/232/344/274/235.kif +1 -1
  87. data/lib/bioshogi/analysis//345/233/262/343/201/204//351/207/221/347/204/241/345/217/214.kif +3 -2
  88. data/lib/bioshogi/analysis//345/233/262/343/201/204//351/207/221/347/233/276/345/233/262/343/201/204.kif +1 -1
  89. data/lib/bioshogi/analysis//345/233/262/343/201/204//351/207/221/347/276/216/346/277/203.kif +2 -0
  90. data/lib/bioshogi/analysis//345/233/262/343/201/204//351/212/200/345/206/240/347/251/264/347/206/212.kif +1 -1
  91. data/lib/bioshogi/analysis//345/233/262/343/201/204//351/212/200/347/253/213/343/201/241/347/237/242/345/200/211.kif +2 -2
  92. data/lib/bioshogi/analysis//345/233/262/343/201/204//351/212/200/347/276/216/346/277/203.kif +2 -2
  93. data/lib/bioshogi/analysis//345/233/262/343/201/204//351/233/242/343/202/214/351/207/221/347/204/241/345/217/214.kif +1 -1
  94. data/lib/bioshogi/analysis//345/233/262/343/201/204//351/253/230/347/237/242/345/200/211.kif +1 -1
  95. data/lib/bioshogi/analysis//345/233/262/343/201/204//351/253/230/347/276/216/346/277/203/345/233/262/343/201/204.kif +1 -1
  96. data/lib/bioshogi/analysis//346/210/246/346/263/225/2/346/211/213/347/233/256/342/226/2633/343/203/213/351/243/233/346/210/246/346/263/225.kif +2 -1
  97. data/lib/bioshogi/analysis//346/210/246/346/263/225/2/346/211/213/347/233/256/342/226/2633/344/272/214/351/212/200/343/202/267/343/202/271/343/203/206/343/203/240.kif +1 -1
  98. data/lib/bioshogi/analysis//346/210/246/346/263/225/2/346/211/213/347/233/256/342/226/2636/344/272/214/351/212/200/346/210/246/346/263/225.kif +1 -1
  99. data/lib/bioshogi/analysis//346/210/246/346/263/225/5/346/211/213/347/210/206/345/274/276.kif +5 -1
  100. data/lib/bioshogi/analysis//346/210/246/346/263/225/5/347/255/213/344/275/215/345/217/226/343/202/212.kif +2 -2
  101. data/lib/bioshogi/analysis//346/210/246/346/263/225/6/347/255/213/344/275/215/345/217/226/343/202/212.kif +1 -1
  102. data/lib/bioshogi/analysis//346/210/246/346/263/225/U/343/202/277/343/203/274/343/203/263/351/243/233/350/273/212.kif +5 -2
  103. data/lib/bioshogi/analysis//346/210/246/346/263/225//342/226/2625/344/270/203/351/207/221/346/210/246/346/263/225.kif +5 -3
  104. data/lib/bioshogi/analysis//346/210/246/346/263/225//342/226/2625/344/272/224/351/276/215/344/270/255/351/243/233/350/273/212.kif +1 -1
  105. data/lib/bioshogi/analysis//346/210/246/346/263/225//342/226/2633/344/270/211/346/241/202/346/210/246/346/263/225.kif +2 -2
  106. data/lib/bioshogi/analysis//346/210/246/346/263/225//342/226/2633/344/270/211/350/247/222/345/236/213/347/251/272/344/270/255/346/210/246/346/263/225.kif +3 -2
  107. data/lib/bioshogi/analysis//346/210/246/346/263/225//342/226/2633/344/270/211/351/207/221/345/236/213/346/227/251/347/271/260/343/202/212/351/212/200.kif +1 -1
  108. data/lib/bioshogi/analysis//346/210/246/346/263/225//342/226/2633/344/270/211/351/243/233/346/210/246/346/263/225.kif +3 -2
  109. data/lib/bioshogi/analysis//346/210/246/346/263/225//342/226/2634/344/272/224/350/247/222/346/210/246/346/263/225.kif +1 -1
  110. data/lib/bioshogi/analysis//346/210/246/346/263/225//342/226/2637/344/272/214/351/243/233/344/272/234/346/200/245/346/210/246.kif +1 -1
  111. data/lib/bioshogi/analysis//346/210/246/346/263/225//343/201/206/343/201/243/343/201/213/343/202/212/344/270/211/351/226/223/351/243/233/350/273/212.kif +1 -1
  112. data/lib/bioshogi/analysis//346/210/246/346/263/225//343/201/215/357/275/215/343/201/215/357/275/215/351/207/221.kif +1 -1
  113. data/lib/bioshogi/analysis//346/210/246/346/263/225//343/201/257/343/201/217/345/274/217/345/233/233/351/226/223/351/243/233/350/273/212.kif +4 -2
  114. data/lib/bioshogi/analysis//346/210/246/346/263/225//343/201/270/343/201/252/343/201/241/343/202/207/343/201/223/346/200/245/346/210/246.kif +1 -1
  115. data/lib/bioshogi/analysis//346/210/246/346/263/225//343/202/204/343/201/260/343/203/234/343/203/274/343/202/272/346/265/201.kif +3 -0
  116. data/lib/bioshogi/analysis//346/210/246/346/263/225//343/202/250/343/203/253/343/203/242/346/200/245/346/210/246.kif +6 -2
  117. data/lib/bioshogi/analysis//346/210/246/346/263/225//343/202/253/343/203/213/343/202/253/343/203/213/351/207/221.kif +1 -1
  118. data/lib/bioshogi/analysis//346/210/246/346/263/225//343/202/253/343/203/213/343/202/253/343/203/213/351/212/200.kif +1 -1
  119. data/lib/bioshogi/analysis//346/210/246/346/263/225//343/202/263/343/203/274/343/203/244/343/203/263/346/265/201/344/270/211/351/226/223/351/243/233/350/273/212.kif +6 -3
  120. data/lib/bioshogi/analysis//346/210/246/346/263/225//343/202/264/343/202/255/343/202/262/343/203/263/344/270/255/351/243/233/350/273/212.kif +3 -2
  121. data/lib/bioshogi/analysis//346/210/246/346/263/225//343/202/264/343/203/252/343/202/264/343/203/252/351/207/221.kif +1 -1
  122. data/lib/bioshogi/analysis//346/210/246/346/263/225//343/202/264/343/203/252/343/203/251/343/201/256/345/217/263/346/211/213.kif +1 -1
  123. data/lib/bioshogi/analysis//346/210/246/346/263/225//343/202/264/343/203/252/351/201/225/343/201/204/350/247/222.kif +27 -0
  124. data/lib/bioshogi/analysis//346/210/246/346/263/225//343/202/267/343/203/247/343/203/274/343/203/200/343/203/263/343/202/252/343/203/252/343/202/270/343/203/212/343/203/253.kif +3 -1
  125. data/lib/bioshogi/analysis//346/210/246/346/263/225//343/202/267/343/203/247/343/203/274/343/203/200/343/203/263/343/202/267/343/202/271/343/203/206/343/203/240.kif +3 -1
  126. data/lib/bioshogi/analysis//346/210/246/346/263/225//343/203/204/343/203/216/351/212/200/344/270/255/351/243/233/350/273/212.kif +4 -3
  127. data/lib/bioshogi/analysis//346/210/246/346/263/225//343/203/204/343/203/216/351/212/200/345/236/213/345/217/263/347/216/211.kif +6 -2
  128. data/lib/bioshogi/analysis//346/210/246/346/263/225//343/203/210/343/203/236/343/203/233/343/203/274/343/202/257.kif +1 -1
  129. data/lib/bioshogi/analysis//346/210/246/346/263/225//343/203/215/343/202/263/345/274/217/343/202/277/343/203/206/346/255/251/345/217/226/343/202/212.kif +1 -1
  130. data/lib/bioshogi/analysis//346/210/246/346/263/225//343/203/216/343/203/274/343/203/236/343/203/253/344/270/211/351/226/223/351/243/233/350/273/212.kif +1 -1
  131. data/lib/bioshogi/analysis//346/210/246/346/263/225//343/203/216/343/203/274/343/203/236/343/203/253/345/233/233/351/226/223/351/243/233/350/273/212.kif +1 -1
  132. data/lib/bioshogi/analysis//346/210/246/346/263/225//343/203/222/343/203/251/343/203/241/346/210/246/346/263/225.kif +1 -1
  133. data/lib/bioshogi/analysis//346/210/246/346/263/225//343/203/235/343/203/263/343/203/235/343/203/263/346/241/202.kif +2 -2
  134. data/lib/bioshogi/analysis//346/210/246/346/263/225//343/203/241/343/202/244/343/203/211/343/202/267/343/202/271/343/203/206/343/203/240.kif +1 -1
  135. data/lib/bioshogi/analysis//346/210/246/346/263/225//343/203/242/343/203/216/343/203/254/343/203/274/343/203/253/345/220/221/343/201/213/343/201/204/351/243/233/350/273/212.kif +5 -3
  136. data/lib/bioshogi/analysis//346/210/246/346/263/225//344/270/200/346/211/213/346/220/215/350/247/222/346/217/233/343/202/217/343/202/212.kif +2 -1
  137. data/lib/bioshogi/analysis//346/210/246/346/263/225//344/270/200/347/233/264/347/267/232/347/251/264/347/206/212.kif +6 -3
  138. data/lib/bioshogi/analysis//346/210/246/346/263/225//344/270/200/351/226/223/351/243/233/350/273/212.kif +1 -1
  139. data/lib/bioshogi/analysis//346/210/246/346/263/225//344/270/211/346/256/265/345/217/263/347/216/211.kif +3 -2
  140. data/lib/bioshogi/analysis//346/210/246/346/263/225//344/270/211/351/226/223/351/243/233/350/273/212.kif +1 -1
  141. data/lib/bioshogi/analysis//346/210/246/346/263/225//344/270/213/347/224/272/346/265/201/344/270/211/351/226/223/351/243/233/350/273/212.kif +1 -1
  142. data/lib/bioshogi/analysis//346/210/246/346/263/225//344/270/255/345/216/237/346/265/201/346/200/245/346/210/246/347/237/242/345/200/211.kif +2 -1
  143. data/lib/bioshogi/analysis//346/210/246/346/263/225//344/270/255/345/216/237/346/265/201/347/233/270/346/216/233/343/201/213/343/202/212.kif +2 -1
  144. data/lib/bioshogi/analysis//346/210/246/346/263/225//344/270/255/345/216/237/351/243/233/350/273/212.kif +2 -2
  145. data/lib/bioshogi/analysis//346/210/246/346/263/225//344/270/255/345/272/247/351/243/233/350/273/212.kif +2 -2
  146. data/lib/bioshogi/analysis//346/210/246/346/263/225//344/270/255/351/243/233/350/273/212/343/203/237/343/203/254/343/203/213/343/202/242/343/203/240.kif +1 -1
  147. data/lib/bioshogi/analysis//346/210/246/346/263/225//344/270/255/351/243/233/350/273/212/345/267/246/347/251/264/347/206/212.kif +3 -2
  148. data/lib/bioshogi/analysis//346/210/246/346/263/225//344/270/270/345/261/261/343/203/257/343/202/257/343/203/201/343/203/263.kif +1 -1
  149. data/lib/bioshogi/analysis//346/210/246/346/263/225//344/271/235/351/226/223/351/243/233/350/273/212.kif +1 -1
  150. data/lib/bioshogi/analysis//346/210/246/346/263/225//345/210/235/346/211/213/342/226/2627/345/205/253/351/212/200/346/210/246/346/263/225.kif +1 -1
  151. data/lib/bioshogi/analysis//346/210/246/346/263/225//345/212/240/350/227/244/346/265/201/350/242/226/351/243/233/350/273/212.kif +1 -1
  152. data/lib/bioshogi/analysis//346/210/246/346/263/225//345/213/207/346/260/227/346/265/201.kif +1 -1
  153. data/lib/bioshogi/analysis//346/210/246/346/263/225//345/215/207/347/224/260/345/274/217/347/237/263/347/224/260/346/265/201.kif +1 -1
  154. data/lib/bioshogi/analysis//346/210/246/346/263/225//345/217/263/345/233/233/351/226/223/351/243/233/350/273/212/345/267/246/347/276/216/346/277/203.kif +4 -1
  155. data/lib/bioshogi/analysis//346/210/246/346/263/225//345/217/263/345/233/233/351/226/223/351/243/233/350/273/212/346/200/245/346/210/246.kif +1 -1
  156. data/lib/bioshogi/analysis//346/210/246/346/263/225//345/217/263/347/216/211.kif +1 -1
  157. data/lib/bioshogi/analysis//346/210/246/346/263/225//345/220/214/345/236/213/347/237/242/345/200/211.kif +2 -2
  158. data/lib/bioshogi/analysis//346/210/246/346/263/225//345/233/233/346/211/213/350/247/222.kif +1 -1
  159. data/lib/bioshogi/analysis//346/210/246/346/263/225//345/234/260/344/270/213/351/211/204/351/243/233/350/273/212.kif +3 -2
  160. data/lib/bioshogi/analysis//346/210/246/346/263/225//345/241/232/347/224/260/343/202/271/343/203/232/343/202/267/343/203/243/343/203/253.kif +2 -1
  161. data/lib/bioshogi/analysis//346/210/246/346/263/225//345/244/251/345/275/246/346/265/201/342/226/2626/345/205/255/350/247/222.kif +1 -1
  162. data/lib/bioshogi/analysis//346/210/246/346/263/225//345/244/251/345/275/246/346/265/201/345/220/221/343/201/213/343/201/204/351/243/233/350/273/212.kif +1 -1
  163. data/lib/bioshogi/analysis//346/210/246/346/263/225//345/254/211/351/207/216/346/265/201.kif +4 -1
  164. data/lib/bioshogi/analysis//346/210/246/346/263/225//345/256/244/345/262/241/343/202/267/343/202/271/343/203/206/343/203/240.kif +1 -2
  165. data/lib/bioshogi/analysis//346/210/246/346/263/225//345/257/276/347/237/242/345/200/211/346/200/245/346/210/246/346/243/222/351/212/200.kif +6 -3
  166. data/lib/bioshogi/analysis//346/210/246/346/263/225//345/261/213/346/225/267/346/265/201/344/272/214/346/236/232/351/212/200.kif +2 -3
  167. data/lib/bioshogi/analysis//346/210/246/346/263/225//345/261/213/346/225/267/346/265/201/344/272/214/346/236/232/351/212/200/346/243/222/351/212/200/345/236/213.kif +2 -0
  168. data/lib/bioshogi/analysis//346/210/246/346/263/225//345/261/261/347/224/260/345/256/232/350/267/241.kif +1 -1
  169. data/lib/bioshogi/analysis//346/210/246/346/263/225//345/267/246/347/276/216/346/277/203/346/200/245/346/210/246.kif +3 -2
  170. data/lib/bioshogi/analysis//346/210/246/346/263/225//345/271/273/346/203/263/345/233/233/351/226/223/351/243/233/350/273/212.kif +1 -1
  171. data/lib/bioshogi/analysis//346/210/246/346/263/225//346/210/270/{351/203/250 → 350/276/272}/346/265/2014/342/206/2223/346/210/246/346/263/225.kif +3 -3
  172. data/lib/bioshogi/analysis//346/210/246/346/263/225//346/226/260/345/254/211/351/207/216/346/265/201.kif +2 -0
  173. data/lib/bioshogi/analysis//346/210/246/346/263/225//346/226/260/346/235/221/347/224/260/343/202/267/343/202/271/343/203/206/343/203/240.kif +3 -1
  174. data/lib/bioshogi/analysis//346/210/246/346/263/225//346/226/260/347/261/263/351/225/267/347/216/211.kif +1 -1
  175. data/lib/bioshogi/analysis//346/210/246/346/263/225//346/226/260/351/254/274/346/256/272/343/201/227.kif +1 -1
  176. data/lib/bioshogi/analysis//346/210/246/346/263/225//346/234/250/346/235/221/345/256/232/350/267/241.kif +5 -3
  177. data/lib/bioshogi/analysis//346/210/246/346/263/225//346/235/221/347/224/260/343/202/267/343/202/271/343/203/206/343/203/240.kif +1 -1
  178. data/lib/bioshogi/analysis//346/210/246/346/263/225//346/241/220/345/261/261/346/265/201/343/202/277/343/203/206/346/255/251/346/243/222/351/212/200.kif +2 -1
  179. data/lib/bioshogi/analysis//346/210/246/346/263/225//346/243/222/347/216/211.kif +1 -1
  180. data/lib/bioshogi/analysis//346/210/246/346/263/225//346/243/222/351/207/221.kif +1 -1
  181. data/lib/bioshogi/analysis//346/210/246/346/263/225//346/243/256/344/270/213/343/202/267/343/202/271/343/203/206/343/203/240.kif +2 -2
  182. data/lib/bioshogi/analysis//346/210/246/346/263/225//346/245/240/346/234/254/345/274/217/347/237/263/347/224/260/346/265/201.kif +2 -2
  183. data/lib/bioshogi/analysis//346/210/246/346/263/225//346/250/252/346/255/251/345/217/226/343/202/212.kif +2 -2
  184. data/lib/bioshogi/analysis//346/210/246/346/263/225//346/270/205/351/207/216/346/265/201/345/262/220/351/230/234/346/210/246/346/263/225.kif +1 -1
  185. data/lib/bioshogi/analysis//346/210/246/346/263/225//347/216/211/351/240/255/344/275/215/345/217/226/343/202/212.kif +1 -1
  186. data/lib/bioshogi/analysis//346/210/246/346/263/225//347/216/211/351/240/255/351/212/200.kif +3 -1
  187. data/lib/bioshogi/analysis//346/210/246/346/263/225//347/233/270/346/250/252/346/255/251/345/217/226/343/202/212.kif +2 -6
  188. data/lib/bioshogi/analysis//346/210/246/346/263/225//347/233/270/347/255/213/351/201/225/343/201/204/350/247/222.kif +2 -0
  189. data/lib/bioshogi/analysis//346/210/246/346/263/225//347/234/237/351/203/250/346/265/201.kif +5 -3
  190. data/lib/bioshogi/analysis//346/210/246/346/263/225//347/237/242/345/200/211/342/226/2623/344/270/203/351/212/200/346/210/246/346/263/225.kif +3 -1
  191. data/lib/bioshogi/analysis//346/210/246/346/263/225//347/237/242/345/200/211/344/270/255/351/243/233/350/273/212.kif +1 -1
  192. data/lib/bioshogi/analysis//346/210/246/346/263/225//347/250/262/345/272/255/346/210/246/346/263/225.kif +1 -1
  193. data/lib/bioshogi/analysis//346/210/246/346/263/225//347/251/264/350/247/222/345/220/221/343/201/213/343/201/204/351/243/233/350/273/212.kif +1 -1
  194. data/lib/bioshogi/analysis//346/210/246/346/263/225//347/251/264/350/247/222/346/210/246/346/263/225.kif +4 -3
  195. data/lib/bioshogi/analysis//346/210/246/346/263/225//347/253/213/347/237/263/346/265/201/345/233/233/351/226/223/351/243/233/350/273/212.kif +1 -1
  196. data/lib/bioshogi/analysis//346/210/246/346/263/225//347/253/271/351/203/250/343/202/271/343/203/232/343/202/267/343/203/243/343/203/253.kif +1 -1
  197. data/lib/bioshogi/analysis//346/210/246/346/263/225//347/255/213/351/201/225/343/201/204/350/247/222.kif +3 -2
  198. data/lib/bioshogi/analysis//346/210/246/346/263/225//347/261/263/351/225/267/346/265/201/346/200/245/346/210/246/347/237/242/345/200/211.kif +8 -2
  199. data/lib/bioshogi/analysis//346/210/246/346/263/225//347/263/270/350/260/267/346/265/201/345/217/263/347/216/211.kif +2 -1
  200. data/lib/bioshogi/analysis//346/210/246/346/263/225//347/276/275/347/224/237/345/274/217/350/242/226/351/243/233/350/273/212.kif +3 -1
  201. data/lib/bioshogi/analysis//346/210/246/346/263/225//350/200/200/351/276/215/343/201/262/343/201/255/343/202/212/351/243/233/350/273/212.kif +1 -1
  202. data/lib/bioshogi/analysis//346/210/246/346/263/225//350/200/200/351/276/215/345/233/233/351/226/223/351/243/233/350/273/212.kif +1 -1
  203. data/lib/bioshogi/analysis//346/210/246/346/263/225//350/204/207/343/202/267/343/202/271/343/203/206/343/203/240.kif +1 -1
  204. data/lib/bioshogi/analysis//346/210/246/346/263/225//350/205/260/346/216/233/343/201/221/351/212/200.kif +1 -2
  205. data/lib/bioshogi/analysis//346/210/246/346/263/225//350/213/261/343/201/241/343/202/203/343/202/223/346/265/201/344/270/255/351/243/233/350/273/212.kif +5 -4
  206. data/lib/bioshogi/analysis//346/210/246/346/263/225//350/213/261/346/230/245/346/265/201/343/201/213/343/201/276/343/201/204/343/201/237/343/201/241/346/210/246/346/263/225.kif +5 -3
  207. data/lib/bioshogi/analysis//346/210/246/346/263/225//350/213/261/346/230/245/346/265/201/343/202/253/343/203/241/343/203/254/343/202/252/343/203/263.kif +4 -2
  208. data/lib/bioshogi/analysis//346/210/246/346/263/225//350/217/205/344/272/225/346/265/201/344/270/211/351/226/223/351/243/233/350/273/212.kif +1 -1
  209. data/lib/bioshogi/analysis//346/210/246/346/263/225//350/217/234/343/200/205/346/262/263/346/265/201/342/226/2634/345/233/233/350/247/222.kif +1 -1
  210. data/lib/bioshogi/analysis//346/210/246/346/263/225//350/217/234/343/200/205/346/262/263/346/265/201/345/220/221/343/201/213/343/201/204/351/243/233/350/273/212.kif +2 -1
  211. data/lib/bioshogi/analysis//346/210/246/346/263/225//350/242/226/351/243/233/350/273/212.kif +7 -2
  212. data/lib/bioshogi/analysis//346/210/246/346/263/225//350/243/217/343/202/242/343/203/222/343/203/253/346/210/246/346/263/225.kif +1 -1
  213. data/lib/bioshogi/analysis//346/210/246/346/263/225//350/247/222/346/217/233/343/202/217/343/202/212/345/217/263/347/216/211.kif +5 -2
  214. data/lib/bioshogi/analysis//346/210/246/346/263/225//350/247/222/346/217/233/343/202/217/343/202/212/346/227/251/347/271/260/343/202/212/351/212/200.kif +4 -1
  215. data/lib/bioshogi/analysis//346/210/246/346/263/225//350/247/222/346/217/233/343/202/217/343/202/212/346/243/222/351/212/200.kif +2 -0
  216. data/lib/bioshogi/analysis//346/210/246/346/263/225//350/247/222/346/217/233/343/202/217/343/202/212/350/205/260/346/216/233/343/201/221/351/212/200.kif +1 -1
  217. data/lib/bioshogi/analysis//346/210/246/346/263/225//350/247/222/346/217/233/343/202/217/343/202/212/350/205/260/346/216/233/343/201/221/351/212/200/346/227/247/345/236/213.kif +2 -2
  218. data/lib/bioshogi/analysis//346/210/246/346/263/225//350/247/222/351/240/255/346/255/251/346/210/246/346/263/225.kif +1 -1
  219. data/lib/bioshogi/analysis//346/210/246/346/263/225//350/266/205/346/200/245/346/210/246.kif +1 -1
  220. data/lib/bioshogi/analysis//346/210/246/346/263/225//351/200/206/346/243/222/351/212/200.kif +1 -1
  221. data/lib/bioshogi/analysis//346/210/246/346/263/225//351/201/240/345/261/261/346/265/201.kif +3 -2
  222. data/lib/bioshogi/analysis//346/210/246/346/263/225//351/203/275/346/210/220/346/265/201/342/226/2633/344/270/200/351/207/221.kif +24 -11
  223. data/lib/bioshogi/analysis//346/210/246/346/263/225//351/207/221/346/262/242/346/265/201.kif +1 -1
  224. data/lib/bioshogi/analysis//346/210/246/346/263/225//351/207/221/347/204/241/345/217/214/346/200/245/346/210/246.kif +1 -1
  225. data/lib/bioshogi/analysis//346/210/246/346/263/225//351/207/221/351/212/200/346/251/213.kif +2 -2
  226. data/lib/bioshogi/analysis//346/210/246/346/263/225//351/212/200/351/233/262/351/233/200.kif +1 -1
  227. data/lib/bioshogi/analysis//346/210/246/346/263/225//351/214/206/345/210/200/346/210/246/346/263/225.kif +54 -0
  228. data/lib/bioshogi/analysis//346/210/246/346/263/225//351/230/252/347/224/260/346/265/2012/346/211/213/347/233/256/342/226/2639/345/233/233/346/255/251.kif +1 -1
  229. data/lib/bioshogi/analysis//346/210/246/346/263/225//351/230/252/347/224/260/346/265/201/345/220/221/343/201/213/343/201/204/351/243/233/350/273/212.kif +3 -2
  230. data/lib/bioshogi/analysis//346/210/246/346/263/225//351/230/277/344/271/205/346/264/245/346/265/201/346/200/245/346/210/246/347/237/242/345/200/211.kif +5 -2
  231. data/lib/bioshogi/analysis//346/210/246/346/263/225//351/233/200/345/210/272/343/201/227.kif +2 -2
  232. data/lib/bioshogi/analysis//346/210/246/346/263/225//351/233/201/346/234/250/345/217/263/347/216/211.kif +3 -2
  233. data/lib/bioshogi/analysis//346/210/246/346/263/225//351/242/250/350/273/212.kif +1 -1
  234. data/lib/bioshogi/analysis//346/210/246/346/263/225//351/253/230/347/224/260/346/265/201/345/267/246/347/216/211.kif +1 -1
  235. data/lib/bioshogi/analysis//346/210/246/346/263/225//351/254/274/345/205/255/346/265/201/343/201/251/343/201/243/343/201/213/343/202/223/351/243/233/350/273/212.kif +54 -0
  236. data/lib/bioshogi/analysis//346/210/246/346/263/225//351/254/274/346/256/272/343/201/227/345/220/221/343/201/213/343/201/204/351/243/233/350/273/212.kif +1 -1
  237. data/lib/bioshogi/analysis//346/210/246/346/263/225//351/255/224/347/225/214/345/233/233/351/226/223/351/243/233/350/273/212.kif +1 -1
  238. data/lib/bioshogi/analysis//346/211/213/347/255/213/2/346/256/265/343/203/255/343/202/261/343/203/203/343/203/210.kif +1 -1
  239. data/lib/bioshogi/analysis//346/211/213/347/255/213//343/201/237/343/201/237/343/201/215/343/201/256/346/255/251.kif +27 -9
  240. data/lib/bioshogi/analysis//346/211/213/347/255/213//343/203/221/343/203/263/343/203/204/343/202/222/350/204/261/343/201/220.kif +11 -11
  241. data/lib/bioshogi/analysis//346/211/213/347/255/213//347/253/257/347/216/211/343/201/253/343/201/257/347/253/257/346/255/251.kif +12 -14
  242. data/lib/bioshogi/analysis//346/211/213/347/255/213//351/200/243/346/211/223/343/201/256/346/255/251.kif +2 -1
  243. data/lib/bioshogi/analysis//346/211/213/347/255/213//351/201/240/350/246/213/343/201/256/350/247/222.kif +16 -6
  244. data/lib/bioshogi/analysis.rb +4 -0
  245. data/lib/bioshogi/board/csa_formatter.rb +2 -2
  246. data/lib/bioshogi/board/kakinoki_formatter.rb +5 -5
  247. data/lib/bioshogi/board/reader_methods.rb +8 -4
  248. data/lib/bioshogi/board_parser/kakinoki_board_parser.rb +2 -2
  249. data/lib/bioshogi/container/checkmate_yomiage.rb +1 -1
  250. data/lib/bioshogi/dimension/base.rb +49 -10
  251. data/lib/bioshogi/dimension/column.rb +131 -0
  252. data/lib/bioshogi/dimension/module_methods.rb +19 -20
  253. data/lib/bioshogi/dimension/row.rb +128 -0
  254. data/lib/bioshogi/formatter/sugatayaki_validator.rb +1 -1
  255. data/lib/bioshogi/hand/drop.rb +1 -1
  256. data/lib/bioshogi/hand/move.rb +6 -6
  257. data/lib/bioshogi/input_adapter/ki2_adapter.rb +10 -10
  258. data/lib/bioshogi/input_adapter/shared_validation.rb +1 -1
  259. data/lib/bioshogi/location.rb +22 -2
  260. data/lib/bioshogi/official_formatter.rb +37 -37
  261. data/lib/bioshogi/order_info.rb +5 -3
  262. data/lib/bioshogi/piece/piece_vector.rb +16 -10
  263. data/lib/bioshogi/piece.rb +2 -2
  264. data/lib/bioshogi/place.rb +155 -62
  265. data/lib/bioshogi/player/soldier_methods.rb +2 -2
  266. data/lib/bioshogi/screen_image/core_methods.rb +2 -2
  267. data/lib/bioshogi/screen_image/pentagon.rb +2 -2
  268. data/lib/bioshogi/screen_image/soldier_methods.rb +1 -1
  269. data/lib/bioshogi/screen_image/stand.rb +5 -5
  270. data/lib/bioshogi/soldier/technique_matcher_methods.rb +51 -0
  271. data/lib/bioshogi/soldier.rb +14 -79
  272. data/lib/bioshogi/soldier_walker.rb +1 -1
  273. data/lib/bioshogi/turn_info.rb +2 -2
  274. data/lib/bioshogi/v/preset_vectors.rb +129 -0
  275. data/lib/bioshogi/v.rb +4 -2
  276. data/lib/bioshogi/version.rb +1 -1
  277. data/lib/bioshogi.rb +2 -0
  278. data//347/275/256/343/201/215/346/217/233/343/201/210/346/216/250/345/245/250.txt +1 -1
  279. metadata +14 -7
  280. data/lib/bioshogi/analysis/technique_matcher_info.rb +0 -810
  281. data/lib/bioshogi/dimension/place_x.rb +0 -27
  282. data/lib/bioshogi/dimension/place_y.rb +0 -57
@@ -3,12 +3,18 @@
3
3
  module Bioshogi
4
4
  module Dimension
5
5
  class Base
6
- class_attribute :dimension
7
- self.dimension = 9
6
+ DEFAULT = 9
7
+ CACHE_ENABLE = true # 結局のところ white_then_flip でキャッシュは必要ないが、キャッシュすることで Place.cache_clear の適切な使用がテストできる
8
+
9
+ class_attribute :dimension_size, default: DEFAULT
8
10
 
9
11
  attr_reader :value
10
12
 
11
13
  class << self
14
+ def default_size?
15
+ dimension_size == DEFAULT
16
+ end
17
+
12
18
  def fetch(value)
13
19
  lookup(value) or raise SyntaxDefact, "座標が読み取れません : #{value.inspect}"
14
20
  end
@@ -17,8 +23,12 @@ module Bioshogi
17
23
  table[value]
18
24
  end
19
25
 
20
- def dimension_set(v)
21
- self.dimension = v
26
+ def size_reset(v)
27
+ self.dimension_size = v
28
+ cache_clear
29
+ end
30
+
31
+ def cache_clear
22
32
  @char_infos = nil
23
33
  @table = nil
24
34
  @value_range = nil
@@ -26,7 +36,7 @@ module Bioshogi
26
36
 
27
37
  def table
28
38
  @table ||= char_infos.each.with_index.inject({}) { |a, (e, i)|
29
- object = new(i).freeze
39
+ object = new(i)
30
40
  a.merge({
31
41
  object => object,
32
42
  i => object,
@@ -37,7 +47,7 @@ module Bioshogi
37
47
  }.freeze
38
48
  end
39
49
 
40
- # 幅
50
+ # #
41
51
  def value_range
42
52
  @value_range ||= 0...char_infos.size
43
53
  end
@@ -47,6 +57,15 @@ module Bioshogi
47
57
 
48
58
  def initialize(value)
49
59
  @value = value
60
+
61
+ # freeze するためメモ化するなら @func ||= xxx ではなく @cache[:func] ||= xxx とする
62
+ @cache = {}
63
+
64
+ freeze
65
+ end
66
+
67
+ def cache_clear
68
+ @cache.clear
50
69
  end
51
70
 
52
71
  delegate *[
@@ -57,7 +76,7 @@ module Bioshogi
57
76
  ], to: :char_info
58
77
 
59
78
  def char_info
60
- self.class.char_infos[@value]
79
+ self.class.char_infos[value]
61
80
  end
62
81
 
63
82
  def yomiage
@@ -65,7 +84,27 @@ module Bioshogi
65
84
  end
66
85
 
67
86
  def flip
68
- self.class.fetch(self.class.char_infos.size - 1 - @value)
87
+ @cache[:flip] ||= self.class.fetch(dimension_size.pred - value)
88
+ end
89
+
90
+ def white_then_flip(location)
91
+ if CACHE_ENABLE
92
+ location = Location[location]
93
+ @cache["white_then_flip/#{location.key}"] ||= yield_self do
94
+ if location.key == :white
95
+ flip
96
+ else
97
+ self
98
+ end
99
+ end
100
+ else
101
+ location = Location[location]
102
+ if location.key == :white
103
+ flip
104
+ else
105
+ self
106
+ end
107
+ end
69
108
  end
70
109
 
71
110
  def ==(other)
@@ -73,7 +112,7 @@ module Bioshogi
73
112
  end
74
113
 
75
114
  def <=>(other)
76
- @value <=> other.value
115
+ value <=> other.value
77
116
  end
78
117
 
79
118
  def eql?(other)
@@ -85,7 +124,7 @@ module Bioshogi
85
124
  end
86
125
 
87
126
  def inspect
88
- "#<#{self.class.name}:#{object_id} #{name.inspect} #{@value}>"
127
+ "#<#{self.class.name}:#{object_id} #{name.inspect} #{value}>"
89
128
  end
90
129
  end
91
130
  end
@@ -0,0 +1,131 @@
1
+ # frozen-string-literal: true
2
+
3
+ # 方針
4
+ # - location 考慮は Place の仕事である
5
+ # - location を持ち込んではいけない
6
+ # - 常に▲視点のメソッドとする
7
+
8
+ module Bioshogi
9
+ module Dimension
10
+ class Column < Base
11
+ ONE_COLUMN = 1
12
+
13
+ class << self
14
+ # ["1", "2", "3"] -> ["3", "2", "1"].last(2) -> ["2", "1"]
15
+ def char_infos
16
+ @char_infos ||= CharInfo.values.reverse.last(dimension_size)
17
+ end
18
+
19
+ def left
20
+ fetch(0)
21
+ end
22
+
23
+ def right
24
+ fetch(dimension_size.pred)
25
+ end
26
+ end
27
+
28
+ def name
29
+ char_info.number_zenkaku
30
+ end
31
+
32
+ # キャッシュ効果あり
33
+ def to_sfen
34
+ @cache[:to_sfen] ||= (dimension_size - value).to_s
35
+ end
36
+
37
+ # 人間向けの数字で 68 なら 6
38
+ def to_human_int
39
+ dimension_size - value
40
+ end
41
+
42
+ ################################################################################ どれも▲から見た結果を返す
43
+
44
+ DELEGATE_METHODS = [
45
+ :left_spaces,
46
+ :right_spaces,
47
+
48
+ :column_spaces_min,
49
+ :left_or_right_to_closer_side,
50
+
51
+ :column_is_second_to_eighth?,
52
+ :column_is_second_or_eighth?,
53
+ :column_is_three_to_seven?,
54
+ :column_is_center?,
55
+ :column_is_edge?,
56
+
57
+ :column_is_right_side?,
58
+ :column_is_left_side?,
59
+ :column_is_right_edge?,
60
+ :column_is_left_edge?,
61
+ ]
62
+
63
+ # location から見て左方向の余白
64
+ def left_spaces
65
+ value
66
+ end
67
+
68
+ # location から見て右方向の余白
69
+ def right_spaces
70
+ dimension_size.pred - left_spaces
71
+ end
72
+
73
+ # left_spaces とright_spaces の小さい方
74
+ def column_spaces_min
75
+ [left_spaces, right_spaces].min
76
+ end
77
+
78
+ # 左右の壁に近づく場合の方向
79
+ def left_or_right_to_closer_side
80
+ column_is_right_side? ? :right : :left
81
+ end
82
+
83
+ # 2から8筋か?
84
+ def column_is_second_to_eighth?
85
+ ONE_COLUMN <= value && value <= dimension_size.pred - ONE_COLUMN
86
+ end
87
+
88
+ # 2または8筋か?
89
+ def column_is_second_or_eighth?
90
+ value == ONE_COLUMN || value == dimension_size.pred - ONE_COLUMN
91
+ end
92
+
93
+ # 3から7筋か?
94
+ def column_is_three_to_seven?
95
+ ONE_COLUMN < value && value < dimension_size.pred - ONE_COLUMN
96
+ end
97
+
98
+ # センターにいる? (5の列にいる?)
99
+ def column_is_center?
100
+ value == dimension_size / 2
101
+ end
102
+
103
+ # 端?
104
+ def column_is_edge?
105
+ column_is_left_edge? || column_is_right_edge?
106
+ end
107
+
108
+ # 右側か?
109
+ def column_is_right_side?
110
+ value > dimension_size / 2
111
+ end
112
+
113
+ # 左側か?
114
+ def column_is_left_side?
115
+ value < dimension_size / 2
116
+ end
117
+
118
+ # 右端か?
119
+ def column_is_right_edge?
120
+ value == dimension_size.pred
121
+ end
122
+
123
+ # 左端か?
124
+ def column_is_left_edge?
125
+ value == 0
126
+ end
127
+
128
+ ################################################################################
129
+ end
130
+ end
131
+ end
@@ -3,39 +3,38 @@
3
3
  module Bioshogi
4
4
  module Dimension
5
5
  module ModuleMethods
6
- # 一時的に盤面のサイズを変更する(テスト用)
7
- #
8
- # before do
9
- # @size_save = Dimension.wh_change([3, 5])
10
- # end
11
- # after do
12
- # Dimension.wh_change(@size_save)
13
- # end
14
- #
15
- def wh_change(wsize, &block)
16
- save_value = dimension_wh
17
- h, v = wsize
18
- PlaceX.dimension_set(h)
19
- PlaceY.dimension_set(v)
6
+ def change(wh, &block)
7
+ save_value = current_size
8
+ set_wh(*wh)
20
9
  if block_given?
21
10
  begin
22
11
  yield
23
12
  ensure
24
- h, v = save_value
25
- PlaceX.dimension_set(h)
26
- PlaceY.dimension_set(v)
13
+ set_wh(*save_value)
27
14
  end
28
15
  else
29
16
  save_value
30
17
  end
31
18
  end
32
19
 
20
+ def default_size?
21
+ Column.default_size? && Row.default_size?
22
+ end
23
+
33
24
  def dimension_info
34
- DimensionInfo.fetch(dimension_wh)
25
+ DimensionInfo.fetch(current_size)
35
26
  end
36
27
 
37
- def dimension_wh
38
- [PlaceX.dimension, PlaceY.dimension]
28
+ def current_size
29
+ [Column.dimension_size, Row.dimension_size]
30
+ end
31
+
32
+ private
33
+
34
+ def set_wh(w, h)
35
+ Column.size_reset(w)
36
+ Row.size_reset(h)
37
+ Place.cache_clear # 超重要
39
38
  end
40
39
  end
41
40
  end
@@ -0,0 +1,128 @@
1
+ # frozen-string-literal: true
2
+
3
+ module Bioshogi
4
+ module Dimension
5
+ class Row < Base
6
+ class_attribute :promotable_depth, default: 3 # 相手の陣地の成れる縦幅
7
+
8
+ class << self
9
+ def char_infos
10
+ @char_infos ||= CharInfo.take(dimension_size)
11
+ end
12
+
13
+ def top
14
+ fetch(0)
15
+ end
16
+
17
+ def bottom
18
+ fetch(dimension_size.pred)
19
+ end
20
+
21
+ def promotable_depth_set(value)
22
+ self.promotable_depth = value
23
+ cache_clear
24
+ end
25
+
26
+ # 一時的に成れない状況にする
27
+ def promotable_disabled(&block)
28
+ save_value = promotable_depth
29
+ promotable_depth_set(0)
30
+ if block_given?
31
+ begin
32
+ yield
33
+ ensure
34
+ promotable_depth_set(save_value)
35
+ end
36
+ else
37
+ save_value
38
+ end
39
+ end
40
+ end
41
+
42
+ def name
43
+ char_info.number_kanji
44
+ end
45
+
46
+ def to_sfen
47
+ @cache[:to_sfen] ||= ("a".ord + value).chr
48
+ end
49
+
50
+ # 人間向けの数字で 68 なら 8
51
+ def to_human_int
52
+ value + 1
53
+ end
54
+
55
+ ################################################################################ すべて▲から見た結果を返す
56
+
57
+ DELEGATE_METHODS = [
58
+ :top_spaces,
59
+ :bottom_spaces,
60
+ :opp_side?,
61
+ :not_opp_side?,
62
+ :own_side?,
63
+ :not_own_side?,
64
+ :kurai_sasae?,
65
+ :just_nyuugyoku?,
66
+ :atoippo_nyuugyoku?,
67
+ :tarefu_desuka?,
68
+ ]
69
+
70
+ # 自分の側の一番上を0としてあとどれだけで突き当たるかの値 (例えば7段目であれば6を返す)
71
+ def top_spaces
72
+ value
73
+ end
74
+
75
+ # 自分の側の一番下を0として底辺までの高さを返す (例えば7段目であれば2を返す)
76
+ # ここはキャッシュしない方が早い
77
+ def bottom_spaces
78
+ dimension_size.pred - top_spaces
79
+ end
80
+
81
+ # 相手の陣地にいる?
82
+ def opp_side?
83
+ top_spaces < promotable_depth
84
+ end
85
+
86
+ # 相手の陣地に入ってない?
87
+ def not_opp_side?
88
+ !opp_side?
89
+ end
90
+
91
+ # 自分の陣地にいる?
92
+ def own_side?
93
+ bottom_spaces < promotable_depth
94
+ end
95
+
96
+ # 自分の陣地にいない?
97
+ def not_own_side?
98
+ !own_side?
99
+ end
100
+
101
+ # 位を支える位置(中央の1行下)か?
102
+ # ここらは数字にしてはいけない
103
+ # 「コード上の整数」「将棋の意味での段数」「意味を持つ位置」なのか区別がつかなくなる
104
+ # 位置に意味を持たせた命名にする
105
+ # つまり「6」ではなく「位を支える位置」として命名する
106
+ def kurai_sasae?
107
+ value == (dimension_size / 2 + 1)
108
+ end
109
+
110
+ # 玉が初めて入玉した位置か?
111
+ def just_nyuugyoku?
112
+ top_spaces == promotable_depth.pred
113
+ end
114
+
115
+ # 玉があと一歩で入玉できる位置か?
116
+ def atoippo_nyuugyoku?
117
+ top_spaces == promotable_depth
118
+ end
119
+
120
+ # 垂れ歩状態か? (つまり2, 3, 4段目)
121
+ def tarefu_desuka?
122
+ top_spaces.between?(1, promotable_depth)
123
+ end
124
+
125
+ ################################################################################
126
+ end
127
+ end
128
+ end
@@ -84,7 +84,7 @@ module Bioshogi
84
84
  if flop
85
85
  place = place.flop
86
86
  end
87
- place = place.flip_if_white(lose_side_location)
87
+ place = place.white_then_flip(lose_side_location)
88
88
  if soldier = container.board[place]
89
89
  if soldier.location == lose_side_location
90
90
  soldier
@@ -59,7 +59,7 @@ module Bioshogi
59
59
  end
60
60
 
61
61
  def type
62
- "t_drop"
62
+ :t_drop
63
63
  end
64
64
 
65
65
  def to_akf(options = {})
@@ -35,8 +35,8 @@ module Bioshogi
35
35
  end
36
36
 
37
37
  # 成れる状態だった?
38
- def promotable?
39
- origin_soldier.next_promotable?(soldier.place)
38
+ def state_where_it_can_become_promote?
39
+ origin_soldier.tsugini_nareru_on?(soldier.place)
40
40
  end
41
41
 
42
42
  # 人間には読みやすいがパースは大変
@@ -84,14 +84,14 @@ module Bioshogi
84
84
  end
85
85
 
86
86
  def type
87
- if promotable?
87
+ if state_where_it_can_become_promote?
88
88
  if promote_trigger?
89
- "t_promote_on"
89
+ :t_promote_on
90
90
  else
91
- "t_promote_throw"
91
+ :t_promote_throw
92
92
  end
93
93
  else
94
- "t_move"
94
+ :t_move
95
95
  end
96
96
  end
97
97
 
@@ -86,13 +86,13 @@ module Bioshogi
86
86
  if md = v.match(/[左右]/)
87
87
  if piece.brave?
88
88
  m = {"左" => :first, "右" => :last}.fetch(md.to_s)
89
- m = flip_if_white(m)
90
- list = list.sort_by { |e| e.place.x.value }.send(m, 1)
89
+ m = white_then_flip(m)
90
+ list = list.sort_by { |e| e.place.column.value }.send(m, 1)
91
91
  else
92
92
  m = {"左" => :>, "右" => :<}.fetch(md.to_s)
93
- m = flip_if_white(m)
93
+ m = white_then_flip(m)
94
94
  list = list.find_all do |e|
95
- place.x.value.send(m, e.place.x.value)
95
+ place.column.value.send(m, e.place.column.value)
96
96
  end
97
97
  end
98
98
  end
@@ -103,9 +103,9 @@ module Bioshogi
103
103
  if v = up_down
104
104
  if md = v.match(/[上引]/)
105
105
  m = {"上" => :<, "引" => :>}.fetch(md.to_s)
106
- m = flip_if_white(m)
106
+ m = white_then_flip(m)
107
107
  list = list.find_all do |e|
108
- place.y.value.send(m, e.place.y.value)
108
+ place.row.value.send(m, e.place.row.value)
109
109
  end
110
110
  end
111
111
  end
@@ -115,7 +115,7 @@ module Bioshogi
115
115
  if list.size >= 2
116
116
  if v = up_down
117
117
  if v.include?("寄")
118
- list = list.find_all { |e| e.place.y == place.y }
118
+ list = list.find_all { |e| e.place.row == place.row }
119
119
  end
120
120
  end
121
121
  end
@@ -123,9 +123,9 @@ module Bioshogi
123
123
  # 真下にあるもの
124
124
  if list.size >= 2
125
125
  if one_up?
126
- y = place.y.value + player.location.which_value(1, -1)
126
+ y = place.row.value + player.location.which_value(1, -1)
127
127
  list = list.find_all { |e|
128
- e.place.x == place.x && e.place.y.value == y
128
+ e.place.column == place.column && e.place.row.value == y
129
129
  }
130
130
  end
131
131
  end
@@ -144,7 +144,7 @@ module Bioshogi
144
144
  !promoted && !suffix_exist? && candidate_soldiers.empty?
145
145
  end
146
146
 
147
- def flip_if_white(key)
147
+ def white_then_flip(key)
148
148
  if player.location.key == :white
149
149
  key = self.class.flip_table[key]
150
150
  end
@@ -12,7 +12,7 @@ module Bioshogi
12
12
  end
13
13
 
14
14
  if move_hand.promote_trigger?
15
- unless origin_soldier.next_promotable?(place)
15
+ unless origin_soldier.tsugini_nareru_on?(place)
16
16
  errors_add NotPromotable, "#{origin_soldier.place}から#{place}への移動では成れません"
17
17
  end
18
18
  end
@@ -12,8 +12,8 @@ module Bioshogi
12
12
  class Location
13
13
  include ApplicationMemoryRecord
14
14
  memory_record [
15
- { 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: "せめかた", },
16
- { 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", },
15
+ { 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: "せめかた", },
16
+ { 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", },
17
17
  ]
18
18
 
19
19
  class << self
@@ -118,6 +118,26 @@ module Bioshogi
118
118
  end
119
119
  end
120
120
 
121
+ ################################################################################
122
+
123
+ def top
124
+ Dimension::Row.top.white_then_flip(self)
125
+ end
126
+
127
+ def bottom
128
+ Dimension::Row.bottom.white_then_flip(self)
129
+ end
130
+
131
+ def left
132
+ Dimension::Column.left.white_then_flip(self)
133
+ end
134
+
135
+ def right
136
+ Dimension::Column.right.white_then_flip(self)
137
+ end
138
+
139
+ ################################################################################
140
+
121
141
  private
122
142
 
123
143
  def call_name_method_name(handicap)