• R/O
  • SSH
  • HTTPS

shoginextmove: コミット


コミットメタ情報

リビジョン77 (tree)
日時2016-02-23 10:35:00
作者bellyoshi

ログメッセージ

変更サマリ

差分

--- Quantum/QuantumShogi/QuantumShogi.Logic/DirectionsGenerator.cs (revision 76)
+++ Quantum/QuantumShogi/QuantumShogi.Logic/DirectionsGenerator.cs (revision 77)
@@ -8,9 +8,13 @@
88 class DirectionsGenerator
99 {
1010 /// <summary>
11- /// 先手からみた駒の移動方向
11+ /// 先手からみた駒の移動方向なっていないとき
1212 /// </summary>
13- MoveDirection[][] directions;
13+ MoveDirection[][] normalMoveDirections;
14+ /// <summary>
15+ /// 先手から見た駒の移動方向成り駒のとき
16+ /// </summary>
17+ MoveDirection[][] promotedMoveDirections;
1418 public DirectionsGenerator()
1519 {
1620 MoveDirection upper = new MoveDirection(0, -1, false);//前
@@ -31,31 +35,31 @@
3135 MoveDirection straightLeft = new MoveDirection(1, 0, false);
3236 MoveDirection upper2Left = new MoveDirection(1, -2, false);
3337 MoveDirection upper2Right = new MoveDirection(-1, -2, true);
34- directions = new MoveDirection[Piece.CountOfType()][];
38+ normalMoveDirections = new MoveDirection[Piece.CountOfType()][];
3539
3640 //歩の移動方向
37- directions[Piece.Pawn] = new MoveDirection[]
41+ normalMoveDirections[Piece.Pawn] = new MoveDirection[]
3842 {
3943 upper
4044 };
4145 //香車の移動方向
42- directions[Piece.Lance] = new MoveDirection[]
46+ normalMoveDirections[Piece.Lance] = new MoveDirection[]
4347 {
4448 straightUpper
4549 };
4650 //桂馬の移動方向
47- directions[Piece.Knight] = new MoveDirection[]
51+ normalMoveDirections[Piece.Knight] = new MoveDirection[]
4852 {
4953 upper2Left,upper2Right
5054 };
5155 //銀の移動方向
52- directions[Piece.Silver] = new MoveDirection[]
56+ normalMoveDirections[Piece.Silver] = new MoveDirection[]
5357 {
5458 upperLeft,upper,upperRight,
5559 downLeft,downRight
5660 };
5761 //金の移動方向
58- directions[Piece.Gold] = new MoveDirection[]
62+ normalMoveDirections[Piece.Gold] = new MoveDirection[]
5963 {
6064 upperLeft,upper,upperRight,
6165 left,right,
@@ -62,18 +66,78 @@
6266 down
6367 };
6468 //角の移動方向
65- directions[Piece.Bishop] = new MoveDirection[]
69+ normalMoveDirections[Piece.Bishop] = new MoveDirection[]
6670 {
6771 straightUpperLeft,straightUpperRight,
6872 straightDownLeft,straightDownRight
6973 };
7074 //飛車の移動方向
71- directions[Piece.Rook] = new MoveDirection[]
75+ normalMoveDirections[Piece.Rook] = new MoveDirection[]
7276 {
7377 straightUpper,
7478 straightLeft,straightRight,
7579 straightDown
7680 };
81+ //玉の移動方向
82+ normalMoveDirections[Piece.King] = new MoveDirection[]
83+ {
84+ upperLeft,upper,upperRight,
85+ left,right,
86+ downLeft,down,downRight
87+ };
88+
89+ promotedMoveDirections = new MoveDirection[Piece.CountOfType()][];
90+
91+ //との移動方向
92+ promotedMoveDirections[Piece.Pawn] = new MoveDirection[]
93+ {
94+ upperLeft,upper,upperRight,
95+ left,right,
96+ down
97+ };
98+ //成香の移動方向
99+ promotedMoveDirections[Piece.Lance] = new MoveDirection[]
100+ {
101+ upperLeft,upper,upperRight,
102+ left,right,
103+ down
104+ };
105+ //圭の移動方向
106+ promotedMoveDirections[Piece.Knight] = new MoveDirection[]
107+ {
108+ upperLeft,upper,upperRight,
109+ left,right,
110+ down
111+ };
112+ //全の移動方向
113+ promotedMoveDirections[Piece.Silver] = new MoveDirection[]
114+ {
115+ upperLeft,upper,upperRight,
116+ left,right,
117+ down
118+ };
119+ promotedMoveDirections[Piece.Gold] = new MoveDirection[]
120+ {
121+ //金はなれない
122+ };
123+ //馬の移動方向
124+ promotedMoveDirections[Piece.Bishop] = new MoveDirection[]
125+ {
126+ upper,
127+ left,right,
128+ down,
129+ straightUpperLeft,straightUpperRight,
130+ straightDownLeft,straightDownRight
131+ };
132+ //竜の移動方向
133+ promotedMoveDirections[Piece.Rook] = new MoveDirection[]
134+ {
135+ upperLeft,upperRight,
136+ downLeft,downRight,
137+ straightUpper,
138+ straightLeft,straightRight,
139+ straightDown
140+ };
77141 }
78142 }
79143 }
旧リポジトリブラウザで表示