| @@ -0,0 +1,29 @@ | ||
| 1 | +using Microsoft.VisualStudio.TestTools.UnitTesting; | |
| 2 | +using QuantumShogi.Logic; | |
| 3 | +using System; | |
| 4 | +using System.Collections.Generic; | |
| 5 | +using System.Linq; | |
| 6 | +using System.Text; | |
| 7 | + | |
| 8 | +namespace QuantumShogi.Logic.Tests | |
| 9 | +{ | |
| 10 | + [TestClass()] | |
| 11 | + public class PieceNumbersOfSideTests | |
| 12 | + { | |
| 13 | + [TestMethod()] | |
| 14 | + public void PieceNumbersOfSideTest() | |
| 15 | + { | |
| 16 | + var ps = new PieceNumbersOfSide(); | |
| 17 | + Assert.AreEqual(Piece.King + 1, ps.maxOfpieceType.Count()); | |
| 18 | + Assert.AreEqual(9,ps.maxOfpieceType[Piece.Pawn]); | |
| 19 | + Assert.AreEqual(2, ps.maxOfpieceType[Piece.Lance]); | |
| 20 | + Assert.AreEqual(2, ps.maxOfpieceType[Piece.Knight]); | |
| 21 | + Assert.AreEqual(2, ps.maxOfpieceType[Piece.Gold]); | |
| 22 | + Assert.AreEqual(2, ps.maxOfpieceType[Piece.Silver]); | |
| 23 | + Assert.AreEqual(1, ps.maxOfpieceType[Piece.Bishop]); | |
| 24 | + Assert.AreEqual(1, ps.maxOfpieceType[Piece.Rook]); | |
| 25 | + Assert.AreEqual(1, ps.maxOfpieceType[Piece.King]); | |
| 26 | + | |
| 27 | + } | |
| 28 | + } | |
| 29 | +} | |
| \ No newline at end of file |
| @@ -33,27 +33,6 @@ | ||
| 33 | 33 | this.IsLine = isLine; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - MoveDirection upper = new MoveDirection(0, -1, false);//前進 | |
| 37 | - MoveDirection upperLeft = new MoveDirection(1, -1, false);//左上 | |
| 38 | - MoveDirection upperRight = new MoveDirection(-1, -1, true);//右上 | |
| 39 | - MoveDirection down = new MoveDirection(0, 1, false);//下がる | |
| 40 | - MoveDirection downLeft = new MoveDirection(1, 1, false); | |
| 41 | - MoveDirection downRight = new MoveDirection(-1, 1, false); | |
| 42 | - MoveDirection right = new MoveDirection(-1, 0, false); | |
| 43 | - MoveDirection left = new MoveDirection(1, 0, false); | |
| 44 | 36 | |
| 45 | - //飛びききにはすぐ1歩動く方向は含めない。 | |
| 46 | - //例えば香車は直進すると定義されるが、直進+一歩前進と重複して定義する。 | |
| 47 | - MoveDirection straightUpper = new MoveDirection(0, -1, true);//前へ直進 | |
| 48 | - MoveDirection straightUpperLeft = new MoveDirection(1, -1, false); | |
| 49 | - MoveDirection straightUpperRight = new MoveDirection(-1, -1, true); | |
| 50 | - MoveDirection straightDown = new MoveDirection(0, 1, false); | |
| 51 | - MoveDirection straightDownLeft = new MoveDirection(1, 1, false); | |
| 52 | - MoveDirection straightDownRight = new MoveDirection(-1, 1, false); | |
| 53 | - MoveDirection straightRight = new MoveDirection(-1, 0, false); | |
| 54 | - MoveDirection straightLeft = new MoveDirection(1, 0, false); | |
| 55 | - | |
| 56 | - MoveDirection upper2Left = new MoveDirection(1, -2, false);//桂馬飛び | |
| 57 | - MoveDirection upper2Right = new MoveDirection(-1, -2, true);//桂馬飛び | |
| 58 | 37 | } |
| 59 | 38 | } |
| @@ -5,11 +5,16 @@ | ||
| 5 | 5 | |
| 6 | 6 | namespace QuantumShogi.Logic |
| 7 | 7 | { |
| 8 | - class PieceNumbersOfSide | |
| 8 | + public class PieceNumbersOfSide | |
| 9 | 9 | { |
| 10 | 10 | Piece[] pieces; |
| 11 | 11 | Piece[][] piecesOfDirection; |
| 12 | 12 | int[] maxOfpieceDirection; |
| 13 | - int[] maxOfpieceType; | |
| 13 | + public int[] maxOfpieceType { get; } | |
| 14 | + public PieceNumbersOfSide() | |
| 15 | + { | |
| 16 | + //歩,香,桂,銀,金,角,飛,玉の枚数を設定 | |
| 17 | + maxOfpieceType = new int[] { 9,2,2,2,2,1,1,1}; | |
| 18 | + } | |
| 14 | 19 | } |
| 15 | 20 | } |