• R/O
  • SSH
  • HTTPS

shoginextmove: コミット


コミットメタ情報

リビジョン74 (tree)
日時2016-02-22 11:14:32
作者bellyoshi

ログメッセージ

変更サマリ

差分

--- Quantum/QuantumShogi/QuantumShogi.Logic/Piece.cs (revision 73)
+++ Quantum/QuantumShogi/QuantumShogi.Logic/Piece.cs (revision 74)
@@ -7,7 +7,7 @@
77 {
88 class Piece
99 {
10- private bool[] _isTypeOf = new bool[MaxOfType()];
10+ private bool[] _isTypeOf = new bool[CountOfType()];
1111 /// <summary>
1212 /// 駒が指定した種類である可能性があるか
1313 /// </summary>
@@ -21,14 +21,14 @@
2121 ///なりごま
2222 public bool IsPromoted { get; set; }
2323
24- const int Pawn = 1;// 歩
25- const int Lance = 2;// 香車
26- const int Knight = 3;// 桂馬
27- const int Silver = 4;// 銀
28- const int Gold = 5;// 金
29- const int Bishop = 6;// 角
30- const int Rook = 7;// 飛
31- const int King = 8;// 王
24+ public const int Pawn = 0;// 歩
25+ public const int Lance = 1;// 香車
26+ public const int Knight = 2;// 桂馬
27+ public const int Silver = 3;// 銀
28+ public const int Gold = 4;// 金
29+ public const int Bishop = 5;// 角
30+ public const int Rook = 6;// 飛
31+ public const int King = 7;// 王
3232
3333 // 現在先手の駒
3434 public bool IsBlack { get; set; }
@@ -45,9 +45,9 @@
4545 /// 駒の種類の最大値
4646 /// </summary>
4747 /// <returns></returns>
48- public static int MaxOfType()
48+ public static int CountOfType()
4949 {
50- return King;
50+ return King + 1;
5151 }
5252 /// <summary>
5353 /// 駒を初期化する。
--- Quantum/QuantumShogi/QuantumShogi.Logic/MoveDirection.cs (nonexistent)
+++ Quantum/QuantumShogi/QuantumShogi.Logic/MoveDirection.cs (revision 74)
@@ -0,0 +1,36 @@
1+using System.Diagnostics;
2+
3+
4+namespace QuantumShogi.Logic
5+{
6+ /// <summary>
7+ /// 動かす方向の単位
8+ /// 縦、横、斜め、直進か、一歩づつか桂馬飛びなどを表現する。
9+ /// </summary>
10+ class MoveDirection
11+ {
12+ /// <summary>
13+ /// 横方向の移動方向
14+ /// 取りうる値 1,-1,0
15+ /// </summary>
16+ public int Col { get; }
17+ /// <summary>
18+ /// 縦方向の移動方向
19+ /// 取りうる値 -2,1,-1,0
20+ /// </summary>
21+ public int Row { get; }
22+ /// <summary>
23+ /// 直線か一歩づつか
24+ /// </summary>
25+ public bool IsLine { get; }
26+
27+ public MoveDirection(int col,int row,bool isLine)
28+ {
29+ Debug.Assert(-1 <= col && col <= 1);
30+ Debug.Assert(-2 <= row && row <= 1);
31+ this.Col = col;
32+ this.Row = row;
33+ this.IsLine = isLine;
34+ }
35+ }
36+}
--- Quantum/QuantumShogi/QuantumShogi.Logic/DirectionsGenerator.cs (nonexistent)
+++ Quantum/QuantumShogi/QuantumShogi.Logic/DirectionsGenerator.cs (revision 74)
@@ -0,0 +1,79 @@
1+using System;
2+using System.Collections.Generic;
3+using System.Linq;
4+using System.Text;
5+
6+namespace QuantumShogi.Logic
7+{
8+ class DirectionsGenerator
9+ {
10+ /// <summary>
11+ /// 先手からみた駒の移動方向
12+ /// </summary>
13+ MoveDirection[][] directions;
14+ public DirectionsGenerator()
15+ {
16+ MoveDirection upper = new MoveDirection(0, -1, false);//前
17+ MoveDirection upperLeft = new MoveDirection(1,-1,false);
18+ MoveDirection upperRight = new MoveDirection(-1,-1,true);
19+ MoveDirection down = new MoveDirection(0,1,false);
20+ MoveDirection downLeft = new MoveDirection(1,1,false);
21+ MoveDirection downRight = new MoveDirection(-1,1, false);
22+ MoveDirection right = new MoveDirection(-1,0, false);
23+ MoveDirection left = new MoveDirection(1,0, false);
24+ MoveDirection straightUpper = new MoveDirection(0, -1, true);//前へ直進
25+ MoveDirection straightUpperLeft = new MoveDirection(1, -1, false);
26+ MoveDirection straightUpperRight = new MoveDirection(-1, -1, true);
27+ MoveDirection straightDown = new MoveDirection(0, 1, false);
28+ MoveDirection straightDownLeft = new MoveDirection(1, 1, false);
29+ MoveDirection straightDownRight = new MoveDirection(-1, 1, false);
30+ MoveDirection straightRight = new MoveDirection(-1, 0, false);
31+ MoveDirection straightLeft = new MoveDirection(1, 0, false);
32+ MoveDirection upper2Left = new MoveDirection(1, -2, false);
33+ MoveDirection upper2Right = new MoveDirection(-1, -2, true);
34+ directions = new MoveDirection[Piece.CountOfType()][];
35+
36+ //歩の移動方向
37+ directions[Piece.Pawn] = new MoveDirection[]
38+ {
39+ upper
40+ };
41+ //香車の移動方向
42+ directions[Piece.Lance] = new MoveDirection[]
43+ {
44+ straightUpper
45+ };
46+ //桂馬の移動方向
47+ directions[Piece.Knight] = new MoveDirection[]
48+ {
49+ upper2Left,upper2Right
50+ };
51+ //銀の移動方向
52+ directions[Piece.Silver] = new MoveDirection[]
53+ {
54+ upperLeft,upper,upperRight,
55+ downLeft,downRight
56+ };
57+ //金の移動方向
58+ directions[Piece.Gold] = new MoveDirection[]
59+ {
60+ upperLeft,upper,upperRight,
61+ left,right,
62+ down
63+ };
64+ //角の移動方向
65+ directions[Piece.Bishop] = new MoveDirection[]
66+ {
67+ straightUpperLeft,straightUpperRight,
68+ straightDownLeft,straightDownRight
69+ };
70+ //飛車の移動方向
71+ directions[Piece.Rook] = new MoveDirection[]
72+ {
73+ straightUpper,
74+ straightLeft,straightRight,
75+ straightDown
76+ };
77+ }
78+ }
79+}
--- Quantum/QuantumShogi/QuantumShogi.Logic/PieceGroup.cs (revision 73)
+++ Quantum/QuantumShogi/QuantumShogi.Logic/PieceGroup.cs (revision 74)
@@ -11,7 +11,7 @@
1111 int[] counts;
1212 public PieceGroup()
1313 {
14- counts = new int[Piece.MaxOfType()];
14+ counts = new int[Piece.CountOfType()];
1515 }
1616
1717 }
旧リポジトリブラウザで表示