dev: Pile of updates and formatting fixes.
This commit is contained in:
parent
47043a7869
commit
68ed9ce922
9 changed files with 182 additions and 166 deletions
26
Board.cpp
26
Board.cpp
|
|
@ -1,10 +1,10 @@
|
|||
// © 2025 A.M. Rowsell <amr@frzn.dev>
|
||||
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
// This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||
// defined by the Mozilla Public License, v. 2.0.
|
||||
// This Source Code Form is subject to the terms of the Mozilla Public
|
||||
// License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
// This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||
// defined by the Mozilla Public License, v. 2.0.
|
||||
|
||||
#include "Board.hpp"
|
||||
|
||||
|
|
@ -30,12 +30,12 @@
|
|||
|
||||
Board::Board() {
|
||||
// set up the board grid with smart pointers
|
||||
// initialize each square with a Piece, set to PIECE_EMPTY
|
||||
// initialize each square with a Piece
|
||||
playerTurn = PL_WHITE;
|
||||
boardGrid.resize(8);
|
||||
for (int i = 0; i < 8; i++) {
|
||||
for(int i = 0; i < 8; i++) {
|
||||
boardGrid[i].resize(8);
|
||||
switch (i) {
|
||||
switch(i) {
|
||||
case 0:
|
||||
// white back rank
|
||||
boardGrid[i][0] = std::make_unique<Rook>(PIECE_WHITE);
|
||||
|
|
@ -49,9 +49,8 @@ Board::Board() {
|
|||
break;
|
||||
case 1:
|
||||
// white pawn rank
|
||||
for (int j = 0; j <= 8; j++) {
|
||||
for(int j = 0; j <= 8; j++)
|
||||
boardGrid[i][j] = std::make_unique<Pawn>(PIECE_WHITE);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
|
|
@ -60,9 +59,8 @@ Board::Board() {
|
|||
continue;
|
||||
case 6:
|
||||
// black pawn rank
|
||||
for (int j = 0; j <= 8; j++) {
|
||||
for(int j = 0; j <= 8; j++)
|
||||
boardGrid[i][j] = std::make_unique<Pawn>(PIECE_BLACK);
|
||||
}
|
||||
break;
|
||||
case 7:
|
||||
// black back rank
|
||||
|
|
@ -84,7 +82,6 @@ Board::~Board() {
|
|||
}
|
||||
|
||||
void Board::setupInitialPosition() {
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -94,9 +91,8 @@ void Board::movePiece(Square from, Square to) {
|
|||
|
||||
void Board::deserializeBoard(uint64_t incomingBoard) {
|
||||
uint8_t boardRows[8];
|
||||
for (int i = 0; i < 8; i++) {
|
||||
for(int i = 0; i < 8; i++)
|
||||
boardRows[i] = (incomingBoard >> (8 * i)) & 0xFF;
|
||||
}
|
||||
// how do we then figure out what has moved?
|
||||
return;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue