Skip to content

Conversation

@octopoulos
Copy link

@octopoulos octopoulos commented Feb 21, 2021

  1. live.pgn is created more intelligently: only the necessary bytes are written instead of a full rewrite each time.
  2. color is added to crosstable.json, which is important to colorize the crosstable without having to look at the schedule.json file.
{
	"Game" : 10,
	"Result" : 0.5,
        "Color": 0,
	"Winner" : "None"
},

I haven't tested it.

@octopoulos octopoulos changed the title add Color to crosstable.json Improvements (continuous) May 21, 2021
Copy link
Collaborator

@skiminki skiminki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure this is the cleanest way

Comment on lines -765 to +769
if (!tab.m_tournament
&& !game->pgn()->isNull()
&& ( !game->pgn()->moves().isEmpty() // ignore empty games
|| !game->pgn()->result().isNone())) // without adjudication
auto pgn = game->pgn();

if (!tab.m_tournament && !pgn->isNull()
&& (!pgn->moves().isEmpty() // ignore empty games
|| !pgn->result().isNone())) // without adjudication
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indentation changes look unnecessary

&& !game->pgn()->isNull()
&& ( !game->pgn()->moves().isEmpty() // ignore empty games
|| !game->pgn()->result().isNone())) // without adjudication
auto pgn = game->pgn();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This probably should be a reference (auto const &pgn, for example), although I wouldn't make this change unless necessary


QString evalString(const MoveEvaluation& eval, const Chess::Move& move);
QString statusString(const Chess::Move& move, bool doMove);
QString statusString(const Chess::Move& move, bool doMove);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change looks unnecessary

m_restart_score(0),
m_strikes(0),
m_cuteseal(false)
m_restart_score(0),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless there were warnings related to ordering, I wouldn't change anything here. (And if these fix warnings, better to isolate in a separate commit.)

m_strikes(0),
m_cuteseal(false)
m_restart_score(0),
m_cuteseal(false)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above

int secondScore = pair->secondScore() + Tournament::playerAt(iBlack).builder()->resumescore();
int leadScore = qMax(firstScore, secondScore);
int pointsInProgress = pair->gamesInProgress() * 2;
// int pointsInProgress = pair->gamesInProgress() * 2;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above

}

QTextStream& operator<<(QTextStream& out, const PgnGame& game)
QTextStream& operator<<(QTextStream& out, PgnGame& game)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't remove the const. It's confusing when operator << modifies its input parameters.

const EngineConfiguration& config = m_engineManager->engineAt(engineIndex);

for (auto player : m_players)
for (auto &player : m_players)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary change

file.resize(0);
}
// remove the "\n*\n\n" at the end of the file
else if (m_last_result == "*") {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC, the PGN standard says that an unterminated game ends in '*'

{
lockCurrentGame();
bool ok = m_tabs.at(m_tabBar->currentIndex()).m_pgn->write(fileName);
auto pgn = m_tabs.at(m_tabBar->currentIndex()).m_pgn;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indent changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants