public Player(string st, DeskColors color, Board board, Form form, GameSet gameSet) { this.board = board; this.color = color; name = st; label = new Label(); label.Text = st; label.Width = 210; label.Height = 60; if (color == DeskColors.White) { label.Location = new Point(570, 510); label.ForeColor = Color.Red; } else { label.Location = new Point(570, 150); label.ForeColor = Color.Black; } label.Font = new Font("Arial", 20f, FontStyle.Regular); form.Controls.Add(label); set = new SetOfFigures(this.color, board, form, gameSet); isallowed = this.color == DeskColors.White ? true : false; }
void CreateCell(DeskColors color, Point point, Form form) { cell = new PictureBox(); cell.Location = point; cell.Width = cell.Height = size; cell.BackColor = color == DeskColors.White ? Color.Bisque : Color.Sienna; cell.BorderStyle = BorderStyle.FixedSingle; cell.Click += Cell_Click; form.Controls.Add(cell); }
public Cell(Point point, DeskColors color, int x, int y, Form form, Board board) { condition = Condition.EmptyCalm; this.color = color; coordinates = new Coordinates(point.X, point.Y); PositionOnTheField = new Coordinates(x, y); figure = null; this.board = board; CreateCell(color, point, form); }
public void Dispose() { color = DeskColors.Enabled; board = null; PossibleSteps.Clear(); current = new Coordinates(-1, -1); currentcell.condition = Condition.EmptyCalm; currentcell.cell.Image = null; currentcell.figure = null; currentcell = null; }
public Player this[DeskColors color] { get { if (color == DeskColors.White) { return(player1); } else { return(player2); } } }
public Chesses(DeskColors color, Board board, Coordinates coordinates, GameSet gameSet) { this.gameSet = gameSet; CurrentColor = DeskColors.White; PossibleSteps = new HashSet <Cell>(); this.color = color; this.board = board; currentcell = board[coordinates]; board[coordinates].figure = this; current = coordinates; currentcell.condition = Condition.FilledCalm; PossibleSteps.Clear(); currentcell.cell.SizeMode = PictureBoxSizeMode.StretchImage; }
public SetOfFigures(DeskColors color, Board board, Form form, GameSet gameSet) { this.board = board; this.color = color; this.gameSet = gameSet; pawns = new Pawn[8]; rooks = new Rook[2]; knights = new Knight[2]; bishops = new Bishop[2]; initPawns(color == DeskColors.Black ? 1 : 6, board, form); initRooks(color == DeskColors.Black ? 0 : 7, board, form); initKnights(color == DeskColors.Black ? 0 : 7, board, form); initBishops(color == DeskColors.Black ? 0 : 7, board, form); queen = new Queen(color, color == DeskColors.Black ? new Coordinates(0, 4) : new Coordinates(7, 4), board, form, gameSet); king = new King(color, color == DeskColors.Black ? new Coordinates(0, 3) : new Coordinates(7, 3), board, form, gameSet); }
public King(DeskColors color, Coordinates position, Board board, Form form, GameSet gameSet) : base(color, board, position, gameSet) { currentcell.cell.Image = color == DeskColors.White ? Properties.Resources.wK : Properties.Resources.bK; }
public static void Generate(bool ispos, HashSet <Cell> cells, Board board, Coordinates current) { bool ok = true; DeskColors desk = board[current].figure.color; Coordinates move = new Coordinates(current.X, current.Y); if (ispos) { do { current.X += (int)desk; current.Y += (int)desk; if (Board.IsCorrectCoordinates(current)) { if (board[current].figure == null) { cells.Add(board[current]); board[current].condition = Condition.EmptyWaiting; } else { if (board[current].figure.color != desk) { cells.Add(board[current]); board[current].condition = Condition.FilledWaiting; } ok = false; } } else { ok = false; } } while (ok); ok = true; do { move.X -= (int)desk; move.Y -= (int)desk; if (Board.IsCorrectCoordinates(move)) { if (board[move].figure == null) { cells.Add(board[move]); board[move].condition = Condition.EmptyWaiting; } else { if (board[move].figure.color != desk) { cells.Add(board[move]); board[move].condition = Condition.FilledWaiting; } ok = false; } } else { ok = false; } } while (ok); } else { do { current.X -= (int)desk; current.Y += (int)desk; if (Board.IsCorrectCoordinates(current)) { if (board[current].figure == null) { cells.Add(board[current]); board[current].condition = Condition.EmptyWaiting; } else { if (board[current].figure.color != desk) { cells.Add(board[current]); board[current].condition = Condition.FilledWaiting; } ok = false; } } else { ok = false; } } while (ok); ok = true; do { move.X += (int)desk; move.Y -= (int)desk; if (Board.IsCorrectCoordinates(move)) { if (board[move].figure == null) { cells.Add(board[move]); board[move].condition = Condition.EmptyWaiting; } else { if (board[move].figure.color != desk) { cells.Add(board[move]); board[move].condition = Condition.FilledWaiting; } ok = false; } } else { ok = false; } } while (ok); } }
public Pawn(DeskColors color, Coordinates position, Board board, Form form, GameSet gameSet) : base(color, board, position, gameSet) { isFirstStep = true; currentcell.cell.Image = color == DeskColors.White ? Properties.Resources.wP : Properties.Resources.bP; }
public Cell(Point point, DeskColors color, Coordinates coordinates, Form form, Board board) : this(point, color, coordinates.X, coordinates.Y, form, board) { }