/// <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"); }
/// <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()); } } }
public ChessMove(Square fromSq, Square toSq, Piece promotedTo) { this.fromSq = fromSq; this.toSq = toSq; this.special = SpecialMoveType.Promotion; this.promotedTo = promotedTo; }
/// <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()); }
/// <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, }); }
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; }
public Move(BoardLocation source, BoardLocation destination, ChessPiece capturedPiece, SpecialMoveType specialMoveType) : this(source, destination, (ChessPiece?)capturedPiece, (SpecialMoveType?)specialMoveType) { }
public Move(BoardLocation source, BoardLocation destination, SpecialMoveType specialMoveType) : this(source, destination, null, specialMoveType) { }
public ChessMove(Square fromSq, Square toSq, SpecialMoveType special) { this.fromSq = fromSq; this.toSq = toSq; this.special = special; }
public ChessMove(Square fromSq, Square toSq) { this.fromSq = fromSq; this.toSq = toSq; this.special = SpecialMoveType.Nothing; }