-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLeaderboard.h
More file actions
39 lines (31 loc) · 894 Bytes
/
Leaderboard.h
File metadata and controls
39 lines (31 loc) · 894 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
Leaderboard.h
Author: [Your Name]
Roll Number: [Your Roll Number]
Project Title: Xonix Game - DSA Project
Description:
This file contains the Leaderboard class that manages player scores
using a MinHeap data structure.
*/
#ifndef LEADERBOARD_H
#define LEADERBOARD_H
#include "MinHeap.h"
#include <string>
class Leaderboard {
private:
MinHeap scoreHeap;
std::string leaderboardFile;
// Helper methods
void saveToFile();
void loadFromFile();
public:
// Constructor
Leaderboard(const std::string& filename = "leaderboard.dat");
// Core operations
void updateScore(const std::string& username, int score);
PlayerScore* getTopScores(int& count) const;
bool isTopScore(int score) const;
void displayLeaderboard() const;
void clearLeaderboard();
};
#endif // LEADERBOARD_H