mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:07:36 +00:00
Everywhere: Run clang-format
This commit is contained in:
parent
0376c127f6
commit
086969277e
1665 changed files with 8479 additions and 8479 deletions
|
@ -49,7 +49,7 @@ struct Piece {
|
|||
}
|
||||
Color color : 4;
|
||||
Type type : 4;
|
||||
bool operator==(const Piece& other) const { return color == other.color && type == other.type; }
|
||||
bool operator==(Piece const& other) const { return color == other.color && type == other.type; }
|
||||
};
|
||||
|
||||
constexpr Piece EmptyPiece = { Color::None, Type::None };
|
||||
|
@ -58,12 +58,12 @@ struct Square {
|
|||
i8 rank; // zero indexed;
|
||||
i8 file;
|
||||
Square(StringView name);
|
||||
Square(const int& rank, const int& file)
|
||||
Square(int const& rank, int const& file)
|
||||
: rank(rank)
|
||||
, file(file)
|
||||
{
|
||||
}
|
||||
bool operator==(const Square& other) const { return rank == other.rank && file == other.file; }
|
||||
bool operator==(Square const& other) const { return rank == other.rank && file == other.file; }
|
||||
|
||||
template<typename Callback>
|
||||
static void for_each(Callback callback)
|
||||
|
@ -94,15 +94,15 @@ struct Move {
|
|||
bool is_ambiguous : 1 = false;
|
||||
Square ambiguous { 50, 50 };
|
||||
Move(StringView long_algebraic);
|
||||
Move(const Square& from, const Square& to, const Type& promote_to = Type::None)
|
||||
Move(Square const& from, Square const& to, Type const& promote_to = Type::None)
|
||||
: from(from)
|
||||
, to(to)
|
||||
, promote_to(promote_to)
|
||||
{
|
||||
}
|
||||
bool operator==(const Move& other) const { return from == other.from && to == other.to && promote_to == other.promote_to; }
|
||||
bool operator==(Move const& other) const { return from == other.from && to == other.to && promote_to == other.promote_to; }
|
||||
|
||||
static Move from_algebraic(StringView algebraic, const Color turn, const Board& board);
|
||||
static Move from_algebraic(StringView algebraic, const Color turn, Board const& board);
|
||||
String to_long_algebraic() const;
|
||||
String to_algebraic() const;
|
||||
};
|
||||
|
@ -111,16 +111,16 @@ class Board {
|
|||
public:
|
||||
Board();
|
||||
|
||||
Piece get_piece(const Square&) const;
|
||||
Piece set_piece(const Square&, const Piece&);
|
||||
Piece get_piece(Square const&) const;
|
||||
Piece set_piece(Square const&, Piece const&);
|
||||
|
||||
bool is_legal(const Move&, Color color = Color::None) const;
|
||||
bool is_legal(Move const&, Color color = Color::None) const;
|
||||
bool in_check(Color color) const;
|
||||
|
||||
bool is_promotion_move(const Move&, Color color = Color::None) const;
|
||||
bool is_promotion_move(Move const&, Color color = Color::None) const;
|
||||
|
||||
bool apply_move(const Move&, Color color = Color::None);
|
||||
const Optional<Move>& last_move() const { return m_last_move; }
|
||||
bool apply_move(Move const&, Color color = Color::None);
|
||||
Optional<Move> const& last_move() const { return m_last_move; }
|
||||
|
||||
String to_fen() const;
|
||||
|
||||
|
@ -151,14 +151,14 @@ public:
|
|||
int material_imbalance() const;
|
||||
|
||||
Color turn() const { return m_turn; }
|
||||
const Vector<Move>& moves() const { return m_moves; }
|
||||
Vector<Move> const& moves() const { return m_moves; }
|
||||
|
||||
bool operator==(const Board& other) const;
|
||||
bool operator==(Board const& other) const;
|
||||
|
||||
private:
|
||||
bool is_legal_no_check(const Move&, Color color) const;
|
||||
bool is_legal_promotion(const Move&, Color color) const;
|
||||
bool apply_illegal_move(const Move&, Color color);
|
||||
bool is_legal_no_check(Move const&, Color color) const;
|
||||
bool is_legal_promotion(Move const&, Color color) const;
|
||||
bool apply_illegal_move(Move const&, Color color);
|
||||
|
||||
Piece m_board[8][8];
|
||||
Optional<Move> m_last_move;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue