| @@ -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 Move | |
| 9 | + { | |
| 10 | + public int from { get; set; } | |
| 11 | + public int to { get; set; } | |
| 12 | + public Piece piece { get; set; } | |
| 13 | + public int | |
| 14 | + } | |
| 15 | +} |
| @@ -17,9 +17,9 @@ | ||
| 17 | 17 | { |
| 18 | 18 | return _isTypeOf[pieceType]; |
| 19 | 19 | } |
| 20 | - | |
| 20 | + | |
| 21 | 21 | ///なりごま |
| 22 | - public bool IsPromoted { get; set; } = false; | |
| 22 | + public bool IsPromoted { get; set; } | |
| 23 | 23 | |
| 24 | 24 | const int Pawn = 1;// 歩 |
| 25 | 25 | const int Lance = 2;// 香車 |
| @@ -41,7 +41,11 @@ | ||
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - public static int MaxOfType() | |
| 44 | + /// <summary> | |
| 45 | + /// 駒の種類の最大値 | |
| 46 | + /// </summary> | |
| 47 | + /// <returns></returns> | |
| 48 | + public static int MaxOfType() | |
| 45 | 49 | { |
| 46 | 50 | return King; |
| 47 | 51 | } |
| @@ -48,27 +52,62 @@ | ||
| 48 | 52 | /// <summary> |
| 49 | 53 | /// 駒を初期化する。 |
| 50 | 54 | /// </summary> |
| 51 | - /// <param name="color">Black or White</param> | |
| 52 | - public Piece(int color) | |
| 55 | + public Piece(bool isBlack,bool isWhite,bool isTypeOf) | |
| 53 | 56 | { |
| 54 | - _isTypeOf[Promoted] = false; | |
| 55 | 57 | for (int i = Pawn; i < King; i++) |
| 56 | 58 | { |
| 57 | - _isTypeOf[i] = true; | |
| 59 | + _isTypeOf[i] = isTypeOf; | |
| 58 | 60 | } |
| 59 | - _isTypeOf[Black] = false; | |
| 60 | - _isTypeOf[White] = false; | |
| 61 | - _isTypeOf[color] = true; | |
| 62 | - IsEmtpy = false; | |
| 61 | + IsPromoted = false; | |
| 62 | + IsBlack = isBlack; | |
| 63 | + IsWhite = isWhite; | |
| 63 | 64 | } |
| 64 | 65 | |
| 66 | + /// <summary> | |
| 67 | + /// 先手の初期量子駒 | |
| 68 | + /// </summary> | |
| 69 | + /// <returns></returns> | |
| 70 | + public Piece GetInitBlack() | |
| 71 | + { | |
| 72 | + return new Piece(true,false,true); | |
| 73 | + } | |
| 74 | + /// <summary> | |
| 75 | + /// 後手の初期量子駒 | |
| 76 | + /// </summary> | |
| 77 | + /// <returns></returns> | |
| 78 | + public Piece GetInitWhite() | |
| 79 | + { | |
| 80 | + return new Piece(false, true, true); | |
| 81 | + } | |
| 82 | + | |
| 83 | + static private Piece CreateEmpty() | |
| 84 | + { | |
| 85 | + return new Piece(false, false, false); | |
| 86 | + } | |
| 87 | + static private Piece empty = CreateEmpty(); | |
| 88 | + | |
| 65 | 89 | public Piece GetEmpty() |
| 66 | 90 | { |
| 67 | - return Piece() | |
| 91 | + return empty; | |
| 68 | 92 | } |
| 69 | 93 | |
| 94 | + static private Piece CreateWall() | |
| 95 | + { | |
| 96 | + return new Piece(true, true, false); | |
| 70 | 97 | |
| 71 | - public bool IsEmtpy { get; set; } | |
| 98 | + } | |
| 99 | + static private Piece wall = CreateWall(); | |
| 100 | + public Piece GetWall() | |
| 101 | + { | |
| 102 | + return wall; | |
| 103 | + } | |
| 104 | + | |
| 105 | + | |
| 106 | + public bool IsEmtpy { | |
| 107 | + get { | |
| 108 | + return !IsWhite && !IsBlack; | |
| 109 | + } | |
| 110 | + } | |
| 72 | 111 | |
| 73 | 112 | } |
| 74 | 113 | } |