| @@ -0,0 +1,36 @@ | ||
| 1 | +using System.Reflection; | |
| 2 | +using System.Runtime.CompilerServices; | |
| 3 | +using System.Runtime.InteropServices; | |
| 4 | + | |
| 5 | +// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 | |
| 6 | +// アセンブリに関連付けられている情報を変更するには、 | |
| 7 | +// これらの属性値を変更してください。 | |
| 8 | +[assembly: AssemblyTitle("QuantumShogi.Logic.Test")] | |
| 9 | +[assembly: AssemblyDescription("")] | |
| 10 | +[assembly: AssemblyConfiguration("")] | |
| 11 | +[assembly: AssemblyCompany("")] | |
| 12 | +[assembly: AssemblyProduct("QuantumShogi.Logic.Test")] | |
| 13 | +[assembly: AssemblyCopyright("Copyright © 2016")] | |
| 14 | +[assembly: AssemblyTrademark("")] | |
| 15 | +[assembly: AssemblyCulture("")] | |
| 16 | + | |
| 17 | +// ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから | |
| 18 | +// 参照できなくなります。このアセンブリ内で COM から型にアクセスする必要がある場合は、 | |
| 19 | +// その型の ComVisible 属性を true に設定してください。 | |
| 20 | +[assembly: ComVisible(false)] | |
| 21 | + | |
| 22 | +// このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります | |
| 23 | +[assembly: Guid("7eec945b-2c90-444d-afd6-85d14002bdc5")] | |
| 24 | + | |
| 25 | +// アセンブリのバージョン情報は次の 4 つの値で構成されています: | |
| 26 | +// | |
| 27 | +// メジャー バージョン | |
| 28 | +// マイナー バージョン | |
| 29 | +// ビルド番号 | |
| 30 | +// Revision | |
| 31 | +// | |
| 32 | +// すべての値を指定するか、以下のように '*' を使用してビルド番号とリビジョン番号を | |
| 33 | +// 既定値にすることができます: | |
| 34 | +//[アセンブリ: AssemblyVersion("1.0.*")] | |
| 35 | +[assembly: AssemblyVersion("1.0.0.0")] | |
| 36 | +[assembly: AssemblyFileVersion("1.0.0.0")] |
| @@ -0,0 +1,14 @@ | ||
| 1 | +using System; | |
| 2 | +using Microsoft.VisualStudio.TestTools.UnitTesting; | |
| 3 | + | |
| 4 | +namespace QuantumShogi.Logic.Test | |
| 5 | +{ | |
| 6 | + [TestClass] | |
| 7 | + public class UnitTest1 | |
| 8 | + { | |
| 9 | + [TestMethod] | |
| 10 | + public void TestMethod1() | |
| 11 | + { | |
| 12 | + } | |
| 13 | + } | |
| 14 | +} |
| @@ -1,42 +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 Koma | |
| 9 | - { | |
| 10 | - public int value { get; set; } | |
| 11 | - | |
| 12 | - const int Promoted = 0; //なりごま | |
| 13 | - const int Pawn = 1;// 歩 | |
| 14 | - const int Lance = 2;// 香車 | |
| 15 | - const int Knight = 3;// 桂馬 | |
| 16 | - const int Silver = 4;// 銀 | |
| 17 | - const int Gold = 5;// 金 | |
| 18 | - const int Bishop = 6;// 角 | |
| 19 | - const int Rook = 7;// 飛 | |
| 20 | - const int King = 8;// 王 | |
| 21 | - const int Black = 9;// 現在先手の駒 | |
| 22 | - const int White = 10;// 現在後手の駒 | |
| 23 | - const int InitialBlack = 11;//初期局面先手の駒 | |
| 24 | - const int InitialWhite = 12;//初期局面後手の駒 | |
| 25 | - //const long Wall = Black | White;//壁 | |
| 26 | - | |
| 27 | - /// <summary> | |
| 28 | - /// 駒を初期化する。 | |
| 29 | - /// </summary> | |
| 30 | - /// <param name="color">Black or White</param> | |
| 31 | - public Koma(int color) | |
| 32 | - { | |
| 33 | - value = 0; | |
| 34 | - for (int i = Pawn; i < King; i++) | |
| 35 | - { | |
| 36 | - value |= 1 << i; | |
| 37 | - } | |
| 38 | - value |= 1 << color; | |
| 39 | - value |= 1 << (color + 2); | |
| 40 | - } | |
| 41 | - } | |
| 42 | -} |
| @@ -0,0 +1,54 @@ | ||
| 1 | +using System; | |
| 2 | +using System.Collections.Generic; | |
| 3 | +using System.Linq; | |
| 4 | +using System.Text; | |
| 5 | + | |
| 6 | +namespace QuantumShogi.Logic | |
| 7 | +{ | |
| 8 | + class Piece | |
| 9 | + { | |
| 10 | + private bool[] _isTypeOf = new bool[MaxOfType()]; | |
| 11 | + /// <summary> | |
| 12 | + /// 駒が指定した種類である可能性があるか | |
| 13 | + /// </summary> | |
| 14 | + /// <param name="pieceType"></param> | |
| 15 | + /// <returns></returns> | |
| 16 | + public bool IsTypeOf(int pieceType) | |
| 17 | + { | |
| 18 | + return _isTypeOf[pieceType]; | |
| 19 | + } | |
| 20 | + | |
| 21 | + const int Promoted = 0; //なりごま | |
| 22 | + const int Pawn = 1;// 歩 | |
| 23 | + const int Lance = 2;// 香車 | |
| 24 | + const int Knight = 3;// 桂馬 | |
| 25 | + const int Silver = 4;// 銀 | |
| 26 | + const int Gold = 5;// 金 | |
| 27 | + const int Bishop = 6;// 角 | |
| 28 | + const int Rook = 7;// 飛 | |
| 29 | + const int King = 8;// 王 | |
| 30 | + const int Black = 9;// 現在先手の駒 | |
| 31 | + const int White = 10;// 現在後手の駒 | |
| 32 | + //const long Wall = Black | White;//壁 | |
| 33 | + | |
| 34 | + public static int MaxOfType() | |
| 35 | + { | |
| 36 | + return King; | |
| 37 | + } | |
| 38 | + /// <summary> | |
| 39 | + /// 駒を初期化する。 | |
| 40 | + /// </summary> | |
| 41 | + /// <param name="color">Black or White</param> | |
| 42 | + public Piece(int color) | |
| 43 | + { | |
| 44 | + _isTypeOf[Promoted] = false; | |
| 45 | + for (int i = Pawn; i < King; i++) | |
| 46 | + { | |
| 47 | + _isTypeOf[i] = true; | |
| 48 | + } | |
| 49 | + _isTypeOf[Black] = false; | |
| 50 | + _isTypeOf[White] = false; | |
| 51 | + _isTypeOf[color] = true; | |
| 52 | + } | |
| 53 | + } | |
| 54 | +} |
| @@ -9,18 +9,19 @@ | ||
| 9 | 9 | { |
| 10 | 10 | const int SIZE_OF_X = 9; |
| 11 | 11 | const int SIZE_OF_Y = 9; |
| 12 | - private Koma[] _cells; | |
| 13 | - public Koma GetCells(int x,int y) | |
| 12 | + private Piece[] _cells; | |
| 13 | + public Piece GetCells(int x,int y) | |
| 14 | 14 | { |
| 15 | 15 | return _cells[SIZE_OF_X * y + x]; |
| 16 | 16 | } |
| 17 | - private void SetCell(int x,int y,Koma koma) | |
| 17 | + private void SetCell(int x,int y,Piece koma) | |
| 18 | 18 | { |
| 19 | 19 | |
| 20 | 20 | } |
| 21 | 21 | public Board() |
| 22 | 22 | { |
| 23 | - _cells = new Koma[SIZE_OF_X * SIZE_OF_Y]; | |
| 23 | + _cells = new Piece[SIZE_OF_X * SIZE_OF_Y]; | |
| 24 | + | |
| 24 | 25 | } |
| 25 | 26 | |
| 26 | 27 | } |
| @@ -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 PieceGroup | |
| 9 | + { | |
| 10 | + | |
| 11 | + int[] counts; | |
| 12 | + public PieceGroup() | |
| 13 | + { | |
| 14 | + counts = new int[Piece.MaxOfType()]; | |
| 15 | + } | |
| 16 | + | |
| 17 | + } | |
| 18 | +} |
| @@ -1,12 +0,0 @@ | ||
| 1 | -using System; | |
| 2 | -using System.Collections.Generic; | |
| 3 | -using System.Linq; | |
| 4 | -using System.Text; | |
| 5 | - | |
| 6 | -namespace QuantumShogi.UI | |
| 7 | -{ | |
| 8 | - class KomaGroup | |
| 9 | - { | |
| 10 | - int[] counts; | |
| 11 | - } | |
| 12 | -} |