aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam <adammegarules1@gmail.com>2026-07-28 10:42:53 +0200
committerAdam <adammegarules1@gmail.com>2026-07-28 10:42:53 +0200
commitbb30752226c59148ae36beb248c8e4ed6eac39d1 (patch)
treec34a10d563f3c37f2c388de1cc00db3704e862ca
parentbc20789325250b1ca6b5b06a8021a99d91a5dc20 (diff)
again fixing memory bugs
-rw-r--r--moves.txt71
-rw-r--r--src/board.hpp22
-rw-r--r--src/moves.cpp1
3 files changed, 11 insertions, 83 deletions
diff --git a/moves.txt b/moves.txt
deleted file mode 100644
index 998bbcd..0000000
--- a/moves.txt
+++ /dev/null
@@ -1,71 +0,0 @@
-a2b3
-b2a3
-b2c3
-c2b3
-c2d3
-d2c3
-e2e3
-e2e4
-e2d3
-f2f3
-f2g3
-g2h3
-h2g3
-b1c3
-b1a3
-g1h3
-g1f3
-a2a3
-a2a4
-a2b3
-b2c3
-c2b3
-c2d3
-d2c3
-d2e3
-e2d3
-f2f3
-f2e3
-g2g3
-h2h3
-b1c3
-b1a3
-g1h3
-g1f3
-a2a3
-a2a4
-a2b3
-b2c3
-c2b3
-c2d3
-d2c3
-d2e3
-e2d3
-f2f3
-f2e3
-g2g3
-h2h3
-b1c3
-b1a3
-g1h3
-g1f3
-a2a3
-a2a4
-b2b3
-b2b4
-c2c3
-c2c4
-d2d3
-d2d4
-e2e3
-e2e4
-f2f3
-f2f4
-g2g3
-g2g4
-h2h3
-h2h4
-b1c3
-b1a3
-g1h3
-g1f3
diff --git a/src/board.hpp b/src/board.hpp
index 5e4e777..1c53827 100644
--- a/src/board.hpp
+++ b/src/board.hpp
@@ -23,27 +23,27 @@ enum GameState {
std::string toChar(PieceType type, bool white);
struct Piece {
- bool color;
- PieceType type;
- bool moved;
+ bool color = 0;
+ PieceType type = NONE;
+ bool moved = false;
};
struct Position {
- uint8_t rank;
- uint8_t file;
+ uint8_t rank = 0;
+ uint8_t file = 0;
bool operator==(const Position &) const = default;
};
struct Game {
Piece pieces[64];
- bool turn; // 1 white; 0 black
- std::string castle;
- uint8_t halfMoveClock;
- uint16_t MoveClock;
+ bool turn = 1; // 1 white; 0 black
+ std::string castle = "";
+ uint8_t halfMoveClock = 0;
+ uint16_t MoveClock = 0;
Position enPassant;
- bool canEnpassant;
- GameState state;
+ bool canEnpassant = 0;
+ GameState state = TURN;
};
struct Move {
diff --git a/src/moves.cpp b/src/moves.cpp
index 00cd437..3463fe8 100644
--- a/src/moves.cpp
+++ b/src/moves.cpp
@@ -1,7 +1,6 @@
#include <array>
#include <cassert>
#include <cstdint>
-#include <iostream>
#include <sys/types.h>
#include <vector>