• R/O
  • SSH
  • HTTPS

shoginextmove: コミット


コミットメタ情報

リビジョン80 (tree)
日時2016-02-23 22:05:17
作者bellyoshi

ログメッセージ

変更サマリ

差分

--- Quantum/QuantumShogi/QuantumShogi.Logic/PieceGroup.cs (revision 79)
+++ Quantum/QuantumShogi/QuantumShogi.Logic/PieceGroup.cs (nonexistent)
@@ -1,18 +0,0 @@
1-using System;
2-using System.Collections.Generic;
3-using System.Linq;
4-using System.Text;
5-
6-namespace QuantumShogi.Logic
7-{
8- class PieceGroup
9- {
10-
11- int[] counts;
12- public PieceGroup()
13- {
14- counts = new int[Piece.CountOfType()];
15- }
16-
17- }
18-}
--- Quantum/QuantumShogi/QuantumShogi.Logic/Board.cs (revision 79)
+++ Quantum/QuantumShogi/QuantumShogi.Logic/Board.cs (revision 80)
@@ -24,7 +24,7 @@
2424 /// </summary>
2525 const int MEM_SIZE_OF_Y = SIZE_OF_Y + 2;
2626
27- int GetIndexOfCell(int x, int y)
27+ private int GetIndexOfCell(int x, int y)
2828 {
2929 return MEM_SIZE_OF_X * y + x;
3030 }
--- Quantum/QuantumShogi/QuantumShogi.Logic/DirectionsGenerator.cs (revision 79)
+++ Quantum/QuantumShogi/QuantumShogi.Logic/DirectionsGenerator.cs (revision 80)
@@ -7,16 +7,11 @@
77 {
88 class DirectionsGenerator
99 {
10- /// <summary>
11- /// 先手からみた駒の移動方向なっていないとき
12- /// </summary>
13- MoveDirection[][] normalMoveDirections;
14- /// <summary>
15- /// 先手から見た駒の移動方向成り駒のとき
16- /// </summary>
17- MoveDirection[][] promotedMoveDirections;
10+ MoveDirectionsType[] moveDirections;
11+
1812 public DirectionsGenerator()
1913 {
14+ //一歩動くきき
2015 MoveDirection upper = new MoveDirection(0, -1, false);//前進
2116 MoveDirection upperLeft = new MoveDirection(1,-1,false);//左上
2217 MoveDirection upperRight = new MoveDirection(-1,-1,true);//右上
@@ -25,6 +20,9 @@
2520 MoveDirection downRight = new MoveDirection(-1,1, false);
2621 MoveDirection right = new MoveDirection(-1,0, false);
2722 MoveDirection left = new MoveDirection(1,0, false);
23+
24+ //飛びききにはすぐ一つとなりのききは含めない。
25+ //例えば香車は直進すると定義されるが、直進+一歩前進ができると定義する。
2826 MoveDirection straightUpper = new MoveDirection(0, -1, true);//前へ直進
2927 MoveDirection straightUpperLeft = new MoveDirection(1, -1, false);
3028 MoveDirection straightUpperRight = new MoveDirection(-1, -1, true);
@@ -33,111 +31,91 @@
3331 MoveDirection straightDownRight = new MoveDirection(-1, 1, false);
3432 MoveDirection straightRight = new MoveDirection(-1, 0, false);
3533 MoveDirection straightLeft = new MoveDirection(1, 0, false);
34+
3635 MoveDirection upper2Left = new MoveDirection(1, -2, false);//桂馬飛び
3736 MoveDirection upper2Right = new MoveDirection(-1, -2, true);//桂馬飛び
38- normalMoveDirections = new MoveDirection[Piece.CountOfType()][];
3937
38+ moveDirections = new MoveDirectionsType[Piece.CountOfType()];
39+
4040 //歩の移動方向
41- normalMoveDirections[Piece.Pawn] = new MoveDirection[]
42- {
41+ moveDirections[Piece.Pawn] = new MoveDirectionsType(
4342 upper
44- };
43+ ).AppendPromotedMove(
44+ //との移動方向
45+ upperLeft, upper, upperRight,
46+ left, right,
47+ down
48+ );
4549 //香車の移動方向
46- normalMoveDirections[Piece.Lance] = new MoveDirection[]
47- {
50+ moveDirections[Piece.Lance] = new MoveDirectionsType(
51+ upper,
4852 straightUpper
49- };
53+ ).AppendPromotedMove(
54+ //成香の移動方向
55+ upperLeft, upper, upperRight,
56+ left, right,
57+ down
58+ );
5059 //桂馬の移動方向
51- normalMoveDirections[Piece.Knight] = new MoveDirection[]
52- {
53- upper2Left,upper2Right
54- };
60+ moveDirections[Piece.Knight] = new MoveDirectionsType(
61+ upper2Left, upper2Right
62+ ).AppendPromotedMove(
63+ //圭の移動方向
64+ upperLeft, upper, upperRight,
65+ left, right,
66+ down
67+ );
5568 //銀の移動方向
56- normalMoveDirections[Piece.Silver] = new MoveDirection[]
57- {
58- upperLeft,upper,upperRight,
59- downLeft,downRight
60- };
69+ moveDirections[Piece.Silver] = new MoveDirectionsType(
70+ upperLeft, upper, upperRight,
71+ downLeft, downRight
72+ ).AppendPromotedMove(
73+ //全の移動方向)]
74+ upperLeft, upper, upperRight,
75+ left, right,
76+ down
77+ );
6178 //金の移動方向
62- normalMoveDirections[Piece.Gold] = new MoveDirection[]
63- {
79+ moveDirections[Piece.Gold] = new MoveDirectionsType(
6480 upperLeft,upper,upperRight,
6581 left,right,
6682 down
67- };
83+ );
6884 //角の移動方向
69- normalMoveDirections[Piece.Bishop] = new MoveDirection[]
70- {
85+ moveDirections[Piece.Bishop] = new MoveDirectionsType(
86+ upperLeft,upperRight,
87+ downLeft,downRight,
7188 straightUpperLeft,straightUpperRight,
7289 straightDownLeft,straightDownRight
73- };
90+ ).AppendPromotedMove(
91+ //馬の移動方向
92+ upperLeft, upper,upperRight,
93+ left, right,
94+ upperLeft,down,downRight,
95+ straightUpperLeft, straightUpperRight,
96+ straightDownLeft, straightDownRight
97+ );
7498 //飛車の移動方向
75- normalMoveDirections[Piece.Rook] = new MoveDirection[]
76- {
99+ moveDirections[Piece.Rook] = new MoveDirectionsType(
77100 straightUpper,
78101 straightLeft,straightRight,
79102 straightDown
80- };
103+ ).AppendPromotedMove(
104+ //竜の移動方向
105+ upperLeft, upper, upperRight,
106+ left, right,
107+ upperLeft, down, downRight,
108+ straightUpper,
109+ straightLeft, straightRight,
110+ straightDown
111+ );
81112 //玉の移動方向
82- normalMoveDirections[Piece.King] = new MoveDirection[]
83- {
113+ moveDirections[Piece.King] = new MoveDirectionsType(
84114 upperLeft,upper,upperRight,
85115 left,right,
86116 downLeft,down,downRight
87- };
117+ );
88118
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- };
141119 }
142120 }
143121 }
--- Quantum/QuantumShogi/QuantumShogi.Logic/PieceNumbersOfSide.cs (nonexistent)
+++ Quantum/QuantumShogi/QuantumShogi.Logic/PieceNumbersOfSide.cs (revision 80)
@@ -0,0 +1,15 @@
1+using System;
2+using System.Collections.Generic;
3+using System.Linq;
4+using System.Text;
5+
6+namespace QuantumShogi.Logic
7+{
8+ class PieceNumbersOfSide
9+ {
10+ Piece[] pieces;
11+ Piece[][] piecesOfDirection;
12+ int[] maxOfpieceDirection;
13+ int[] maxOfpieceType;
14+ }
15+}
--- Quantum/QuantumShogi/QuantumShogi.Logic/MoveDirectionsType.cs (nonexistent)
+++ Quantum/QuantumShogi/QuantumShogi.Logic/MoveDirectionsType.cs (revision 80)
@@ -0,0 +1,46 @@
1+using System;
2+using System.Collections.Generic;
3+using System.Linq;
4+using System.Text;
5+
6+namespace QuantumShogi.Logic
7+{
8+ /// <summary>
9+ /// 各駒に対応する動きをまとめたもの
10+ /// </summary>
11+ class MoveDirectionsType
12+ {
13+ /// <summary>
14+ /// 先手からみた駒の移動方向なっていないとき
15+ /// </summary>
16+ MoveDirection[] normalMoveDirections;
17+ /// <summary>
18+ /// 先手から見た駒の移動方向成り駒のとき
19+ /// </summary>
20+ MoveDirection[] promotedMoveDirections = new MoveDirection[] { };//金、玉は0個の配列
21+
22+ public MoveDirection[] GetValues(bool promoted)
23+ {
24+ if (promoted)
25+ {
26+ return promotedMoveDirections;
27+ }
28+ else
29+ {
30+ return normalMoveDirections;
31+ }
32+ }
33+
34+ public MoveDirectionsType(params MoveDirection[] normalMoveDirections)
35+ {
36+ this.normalMoveDirections = normalMoveDirections;
37+
38+ }
39+
40+ public MoveDirectionsType AppendPromotedMove(params MoveDirection[] promotedMoveDirections)
41+ {
42+ this.promotedMoveDirections = promotedMoveDirections;
43+ return this;
44+ }
45+ }
46+}
--- Quantum/QuantumShogi/QuantumShogi.Logic/PieceNumbers.cs (nonexistent)
+++ Quantum/QuantumShogi/QuantumShogi.Logic/PieceNumbers.cs (revision 80)
@@ -0,0 +1,18 @@
1+using System;
2+using System.Collections.Generic;
3+using System.Linq;
4+using System.Text;
5+
6+namespace QuantumShogi.Logic
7+{
8+ class PieceNumbers
9+ {
10+ PieceNumbersOfSide PieceNumbersOfBlackSide;
11+ PieceNumbersOfSide PieceNumbersOfWhiteSide;
12+ public PieceNumbers()
13+ {
14+
15+ }
16+
17+ }
18+}
旧リポジトリブラウザで表示