Пример #1
0
        /// <summary>
        /// 特殊な指し手をCSA形式に変換します。
        /// </summary>
        public static string ToCsa(this SpecialMoveType smoveType)
        {
            switch (smoveType)
            {
            case SpecialMoveType.Interrupt:
                return("%CHUDAN");

            case SpecialMoveType.Resign:
                return("%TORYO");

            case SpecialMoveType.Sennichite:
                return("%SENNICHITE");

            case SpecialMoveType.OuteSennichite:
                return("%OUTE_SENNICHITE");

            case SpecialMoveType.IllegalMove:
                return("%ILLEGAL_MOVE");

            case SpecialMoveType.TimeUp:
                return("%TIME_UP");

            case SpecialMoveType.Jishogi:
                return("%JISHOGI");

            case SpecialMoveType.CheckMate:
                return("%TSUMI");

            case SpecialMoveType.Error:
                return("%ERROR");
            }

            throw new ArgumentException("smoveType");
        }
Пример #2
0
        /// <summary>
        /// ハッシュコードを取得します。
        /// </summary>
        public override int GetHashCode()
        {
            // ValueType.GetHashCodeは遅いらしい。。。
            if (IsSpecialMove)
            {
                return(SpecialMoveType.GetHashCode());
            }
            else
            {
                var baseHashCode =
                    BWType.GetHashCode() ^
                    SameAsOld.GetHashCode() ^
                    RelFileType.GetHashCode() ^
                    RankMoveType.GetHashCode() ^
                    ActionType.GetHashCode() ^
                    (Piece != null ? Piece.GetHashCode() : 0) ^
                    (SrcSquare != null ? SrcSquare.GetHashCode() : 0);

                if (SameAsOld)
                {
                    return(baseHashCode);
                }
                else
                {
                    return(
                        baseHashCode ^
                        File.GetHashCode() ^
                        Rank.GetHashCode());
                }
            }
        }
Пример #3
0
 public ChessMove(Square fromSq, Square toSq, Piece promotedTo)
 {
     this.fromSq = fromSq;
     this.toSq = toSq;
     this.special = SpecialMoveType.Promotion;
     this.promotedTo = promotedTo;
 }
Пример #4
0
 /// <summary>
 /// ハッシュ値を計算します。
 /// </summary>
 public override int GetHashCode()
 {
     return(
         BWType.GetHashCode() ^
         (DstSquare != null ? DstSquare.GetHashCode() : 0) ^
         (SrcSquare != null ? SrcSquare.GetHashCode() : 0) ^
         (MovePiece != null ? MovePiece.GetHashCode() : 0) ^
         DropPieceType.GetHashCode() ^
         IsPromote.GetHashCode() ^
         SpecialMoveType.GetHashCode());
 }
Пример #5
0
        /// <summary>
        /// 特殊な指し手を生成します。
        /// </summary>
        public static Move CreateSpecialMove(BWType turn, SpecialMoveType smoveType)
        {
            if (smoveType == SpecialMoveType.None)
            {
                throw new ArgumentException("smoveType");
            }

            return(new Move
            {
                BWType = turn,
                SpecialMoveType = smoveType,
            });
        }
Пример #6
0
        public void SyncWithClient(Vector3 speed, SpecialMoveType specialMove, bool isVisible, bool isFacingLeft, bool isActivelyPushing)
        {
            this.speedX = speed.X;
            this.speedY = speed.Y;

            this.currentSpecialMove = specialMove;

            //if (renderer != null) {
            //    renderer.AnimHidden = !isVisible;
            //}

            this.IsFacingLeft      = isFacingLeft;
            this.isActivelyPushing = isActivelyPushing;
        }
Пример #7
0
 public Move(BoardLocation source, BoardLocation destination, ChessPiece capturedPiece, SpecialMoveType specialMoveType)
     : this(source, destination, (ChessPiece?)capturedPiece, (SpecialMoveType?)specialMoveType)
 {
 }
Пример #8
0
 public Move(BoardLocation source, BoardLocation destination, SpecialMoveType specialMoveType)
     : this(source, destination, null, specialMoveType)
 {
 }
Пример #9
0
 public ChessMove(Square fromSq, Square toSq, SpecialMoveType special)
 {
     this.fromSq = fromSq;
     this.toSq = toSq;
     this.special = special;
 }
Пример #10
0
 public ChessMove(Square fromSq, Square toSq)
 {
     this.fromSq = fromSq;
     this.toSq = toSq;
     this.special = SpecialMoveType.Nothing;
 }