This code implements a game leaderboard of a chosen size with fields player-name, score (templated/generic), and a date/time. There are two versions. One is in C++ and another is in Java, which can use serialization.
git clone https://github.com/17livincent/Leaderboard.git
Or
git clone [email protected]:17livincent/Leaderboard.git
For the C++ version, simply #include "leaderboard.h"
and use the various methods to interact with it. run.cpp
implements leaderboard.h
for testing purposes.
For the Java version, simply reference the Leaderboard
class in your code. Run.java
is also a testing program for Leaderboard.java
.
-
A
ranking
struct/class with player name, score, and time parameters. -
A choosable and updatable
size
for the leaderboard, as well as the option to clear the leaderboard. -
A templated/generic
score
field in the ranking to be able to hold any type of data (int, double, string, ...). However, for C++, it must be a primitive. For Java, thecompareTo(T A, T B)
method must be updated for thescore
type. - The capability of specifying the hierarchy of the scoring, such as whether a numerically greater/lesser score is higher or lower.
- For the Java version, the ability to save the current leaderboard info to a text file in order to reload it in the future.