#pragma once #include #include #include // Persistent best times, stored as a GKeyFile under the user config dir: // ~/.config/minesweeper/leaderboard.ini (gitignored) class Leaderboard { public: // Records a finished game. Returns true when it is a new best time // for the difficulty; the file is saved immediately. bool record(const std::string& difficulty, int seconds); // Best time in seconds for the difficulty, if one exists. std::optional best_time(const std::string& difficulty) const; private: void load(); void save(); std::map times_; bool loaded_ = false; };