public override void Moving_rule() { #region Pawn Location if (this.Side == Eside.HUMAN) { //0 +1 c = new Clocation((int)Location.x, (int)Location.y + 1); if (c.Check_Location() && ChessBoard.Current.cells[c.X][c.Y].CurrentPiece == null) { list.Add(c); } //0 +2 c = new Clocation((int)Location.x, (int)Location.y + 2); if (c.Check_Location() && ChessBoard.Current.cells[c.X][c.Y].CurrentPiece == null && ChessBoard.Current.cells[c.X][c.Y - 1].CurrentPiece == null && is_it_moved == false) { list.Add(c); } //+1 +1 c = new Clocation((int)Location.x + 1, (int)Location.y + 1); if (c.Check_Location() && ChessBoard.Current.cells[c.X][c.Y].CurrentPiece != null) { list.Add(c); } //-1 +1 c = new Clocation((int)Location.x - 1, (int)Location.y + 1); if (c.Check_Location() && ChessBoard.Current.cells[c.X][c.Y].CurrentPiece != null) { list.Add(c); } } else { //0 -1 c = new Clocation((int)Location.x, (int)Location.y - 1); if (c.Check_Location() && ChessBoard.Current.cells[c.X][c.Y].CurrentPiece == null) { list.Add(c); } //0 -2 c = new Clocation((int)Location.x, (int)Location.y - 2); if (c.Check_Location() && ChessBoard.Current.cells[c.X][c.Y].CurrentPiece == null && ChessBoard.Current.cells[c.X][c.Y + 1].CurrentPiece == null && is_it_moved == false) { list.Add(c); } //-1 -1 c = new Clocation((int)Location.x - 1, (int)Location.y - 1); if (c.Check_Location() && ChessBoard.Current.cells[c.X][c.Y].CurrentPiece != null) { list.Add(c); } //+1 -1 c = new Clocation((int)Location.x + 1, (int)Location.y - 1); if (c.Check_Location() && ChessBoard.Current.cells[c.X][c.Y].CurrentPiece != null) { list.Add(c); } } #endregion }
public override void Moving_rule() { #region Knight Location //+1 +2 c = new Clocation((int)Location.x + 1, (int)Location.y + 2); if (c.Check_Location()) { list.Add(c); } //+2 +1 c = new Clocation((int)Location.x + 2, (int)Location.y + 1); if (c.Check_Location()) { list.Add(c); } //+2 -1 c = new Clocation((int)Location.x + 2, (int)Location.y - 1); if (c.Check_Location()) { list.Add(c); } //+1 -2 c = new Clocation((int)Location.x + 1, (int)Location.y - 2); if (c.Check_Location()) { list.Add(c); } //-1 -2 c = new Clocation((int)Location.x - 1, (int)Location.y - 2); if (c.Check_Location()) { list.Add(c); } //-2 -1 c = new Clocation((int)Location.x - 2, (int)Location.y - 1); if (c.Check_Location()) { list.Add(c); } //-2 +1 c = new Clocation((int)Location.x - 2, (int)Location.y + 1); if (c.Check_Location()) { list.Add(c); } //-1 +2 c = new Clocation((int)Location.x - 1, (int)Location.y + 2); if (c.Check_Location()) { list.Add(c); } #endregion }
public override void Moving_rule() { #region Qeen Location for (int i = 1; i < 8; i++) { c = new Clocation((int)Location.x, (int)Location.y + i); if (c.Check_Location()) { if (ChessBoard.Current.cells[c.X][c.Y].CurrentPiece == null) { list.Add(c); } else { list.Add(c); break; } } } for (int i = 1; i < 8; i++) { c = new Clocation((int)Location.x + i, (int)Location.y); if (c.Check_Location()) { if (ChessBoard.Current.cells[c.X][c.Y].CurrentPiece == null) { list.Add(c); } else { list.Add(c); break; } } } for (int i = 1; i < 8; i++) { c = new Clocation((int)Location.x - i, (int)Location.y); if (c.Check_Location()) { if (ChessBoard.Current.cells[c.X][c.Y].CurrentPiece == null) { list.Add(c); } else { list.Add(c); break; } } } for (int i = 1; i < 8; i++) { c = new Clocation((int)Location.x, (int)Location.y - i); if (c.Check_Location()) { if (ChessBoard.Current.cells[c.X][c.Y].CurrentPiece == null) { list.Add(c); } else { list.Add(c); break; } } } for (int i = 1; i < 8; i++) { c = new Clocation((int)Location.x + i, (int)Location.y + i); if (c.Check_Location()) { if (ChessBoard.Current.cells[c.X][c.Y].CurrentPiece == null) { list.Add(c); } else { list.Add(c); break; } } } for (int i = 1; i < 8; i++) { c = new Clocation((int)Location.x - i, (int)Location.y + i); if (c.Check_Location()) { if (ChessBoard.Current.cells[c.X][c.Y].CurrentPiece == null) { list.Add(c); } else { list.Add(c); break; } } } for (int i = 1; i < 8; i++) { c = new Clocation((int)Location.x + i, (int)Location.y - i); if (c.Check_Location()) { if (ChessBoard.Current.cells[c.X][c.Y].CurrentPiece == null) { list.Add(c); } else { list.Add(c); break; } } } for (int i = 1; i < 8; i++) { c = new Clocation((int)Location.x - i, (int)Location.y - i); if (c.Check_Location()) { if (ChessBoard.Current.cells[c.X][c.Y].CurrentPiece == null) { list.Add(c); } else { list.Add(c); break; } } } #endregion }
public override void Moving_rule() { #region King Location //0 +1 c = new Clocation((int)Location.x, (int)Location.y + 1); if (c.Check_Location()) { list.Add(c); } //0 -1 c = new Clocation((int)Location.x, (int)Location.y - 1); if (c.Check_Location()) { list.Add(c); } //+1 0 c = new Clocation((int)Location.x + 1, (int)Location.y); if (c.Check_Location()) { list.Add(c); } //-1 0 c = new Clocation((int)Location.x - 1, (int)Location.y); if (c.Check_Location()) { list.Add(c); } //+1 +1 c = new Clocation((int)Location.x + 1, (int)Location.y + 1); if (c.Check_Location()) { list.Add(c); } //+1 -1 c = new Clocation((int)Location.x + 1, (int)Location.y - 1); if (c.Check_Location()) { list.Add(c); } //-1 +1 c = new Clocation((int)Location.x - 1, (int)Location.y + 1); if (c.Check_Location()) { list.Add(c); } //-1 -1 c = new Clocation((int)Location.x - 1, (int)Location.y - 1); if (c.Check_Location()) { list.Add(c); } //Nhập thành if (is_it_moved == false) { Castling_left(); Castling_right(); if (_canMovecells.Count > 0) { can_do_castling = true; } } #endregion }