Skip to content

Commit

Permalink
refactor: remove unused color info (#789)
Browse files Browse the repository at this point in the history
  • Loading branch information
Disservin authored Jan 19, 2025
1 parent 8709df5 commit 5ac56ed
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 21 deletions.
8 changes: 2 additions & 6 deletions app/src/matchmaking/match/match.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,6 @@ void Match::start(engine::UciEngine& white, engine::UciEngine& black, const std:
Player white_player = Player(white);
Player black_player = Player(black);

white_player.color = Color::WHITE;
black_player.color = Color::BLACK;

if (!white_player.engine.start()) {
Logger::trace<true>("Failed to start engines, stopping tournament.");
atomic::stop = true;
Expand Down Expand Up @@ -183,9 +180,8 @@ void Match::start(engine::UciEngine& white, engine::UciEngine& black, const std:
data_.end_time = util::time::datetime("%Y-%m-%dT%H:%M:%S %z");
data_.duration = util::time::duration(chrono::duration_cast<chrono::seconds>(end - start));

data_.players =
GamePair(MatchData::PlayerInfo{white_player.engine.getConfig(), white_player.getResult(), white_player.color},
MatchData::PlayerInfo{black_player.engine.getConfig(), black_player.getResult(), black_player.color});
data_.players = GamePair(MatchData::PlayerInfo{white_player.engine.getConfig(), white_player.getResult()},
MatchData::PlayerInfo{black_player.engine.getConfig(), black_player.getResult()});
}

bool Match::playMove(Player& us, Player& them) {
Expand Down
2 changes: 0 additions & 2 deletions app/src/matchmaking/player.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ class Player {

engine::UciEngine &engine;

chess::Color color = chess::Color::NONE;

private:
chess::GameResult result = chess::GameResult::NONE;
TimeControl time_control_;
Expand Down
1 change: 0 additions & 1 deletion app/src/types/match_data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ struct MatchData {
struct PlayerInfo {
EngineConfiguration config;
chess::GameResult result = chess::GameResult::NONE;
chess::Color color = chess::Color::NONE;
};

MatchData() {}
Expand Down
12 changes: 0 additions & 12 deletions app/tests/pgn_builder_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ TEST_SUITE("PGN Builder Tests") {
TEST_CASE("PGN Creation") {
MatchData match_data;
match_data.players.white.config.name = "engine1";
match_data.players.white.color = chess::Color::WHITE;
match_data.players.white.result = chess::GameResult::WIN;

match_data.players.black.config.name = "engine2";
match_data.players.black.color = chess::Color::BLACK;
match_data.players.black.result = chess::GameResult::LOSE;

match_data.moves = {MoveData("e2e4", "+1.00", 1321, 15, 4, 0, 0), MoveData("e7e5", "+1.23", 430, 15, 3, 0, 0),
Expand Down Expand Up @@ -49,11 +47,9 @@ Nf6 {+10.15/18 1.821s, engine2 got checkmated} 1-0
TEST_CASE("PGN Creation Black Win") {
MatchData match_data;
match_data.players.white.config.name = "engine1";
match_data.players.white.color = chess::Color::WHITE;
match_data.players.white.result = chess::GameResult::LOSE;

match_data.players.black.config.name = "engine2";
match_data.players.black.color = chess::Color::BLACK;
match_data.players.black.result = chess::GameResult::WIN;

match_data.moves = {MoveData("e2e4", "+1.00", 1321, 15, 4, 0, 0), MoveData("e7e5", "+1.23", 430, 15, 3, 0, 0),
Expand Down Expand Up @@ -91,11 +87,9 @@ Nf6 {+10.15/18 1.821s, engine1 got checkmated} 0-1
TEST_CASE("PGN Creation Black Start") {
MatchData match_data;
match_data.players.black.config.name = "engine1";
match_data.players.black.color = chess::Color::BLACK;
match_data.players.black.result = chess::GameResult::NONE;

match_data.players.white.config.name = "engine2";
match_data.players.white.color = chess::Color::WHITE;
match_data.players.white.result = chess::GameResult::NONE;

match_data.moves = {MoveData("e8g8", "+1.00", 1321, 15, 4, 0, 0), MoveData("e1g1", "+1.23", 430, 15, 3, 0, 0),
Expand Down Expand Up @@ -130,12 +124,10 @@ Nf6 {+10.15/18 1.821s, engine1 got checkmated} 0-1
TEST_CASE("PGN Creation Fixed Time per Move") {
MatchData match_data;
match_data.players.black.config.name = "engine1";
match_data.players.black.color = chess::Color::BLACK;
match_data.players.black.result = chess::GameResult::NONE;
match_data.players.black.config.limit.tc.fixed_time = 1000;

match_data.players.white.config.name = "engine2";
match_data.players.white.color = chess::Color::WHITE;
match_data.players.white.result = chess::GameResult::NONE;
match_data.players.white.config.limit.tc.fixed_time = 1000;

Expand Down Expand Up @@ -171,13 +163,11 @@ Nf6 {+10.15/18 1.821s, engine1 got checkmated} 0-1
TEST_CASE("PGN Creation TC") {
MatchData match_data;
match_data.players.black.config.name = "engine1";
match_data.players.black.color = chess::Color::BLACK;
match_data.players.black.result = chess::GameResult::NONE;
match_data.players.black.config.limit.tc.time = 0;
match_data.players.black.config.limit.tc.increment = 5;

match_data.players.white.config.name = "engine2";
match_data.players.white.color = chess::Color::WHITE;
match_data.players.white.result = chess::GameResult::NONE;
match_data.players.white.config.limit.tc.time = 1;
match_data.players.white.config.limit.tc.increment = 5;
Expand Down Expand Up @@ -219,12 +209,10 @@ Nc5 {+1.45/16 0.310s, n=0, sd=24, aborted} *
TEST_CASE("PGN Creation Multiple Fixed Time per Move") {
MatchData match_data;
match_data.players.black.config.name = "engine1";
match_data.players.black.color = chess::Color::BLACK;
match_data.players.black.result = chess::GameResult::NONE;
match_data.players.black.config.limit.tc.fixed_time = 200;

match_data.players.white.config.name = "engine2";
match_data.players.white.color = chess::Color::WHITE;
match_data.players.white.result = chess::GameResult::NONE;
match_data.players.white.config.limit.tc.fixed_time = 1000;

Expand Down

0 comments on commit 5ac56ed

Please sign in to comment.