Hey guys, I'm trying to recreate the classic game Minesweeper in Java for an assignment. At the moment I'm not planning on making a GUI, I just want to output into the command prompt. The game plays through perfectly so far; at the moment I'm up to creating a high score table, displaying a list of the five best completion times along with the names of the players who achieved them. I was able to get the times to display correctly using a basic array sort but I couldn't figure out how to get the names to change positions along with the scores.
Thus I am attempting a different method of sorting the high scores but so far, it isn't outputting correctly. Here is the method so far:
completionTime is a float which holds the player's time taken from the most recent game.Code:public void addEasyHighScore(String playerName)
{
for (int i = 4; i >= 0; i--)
{
if (scoresTableEasy[i] > completionTime)
{
if (i > 0)
{
scoresTableEasy[i] = completionTime;
scoresTableEasy[i] = scoresTableEasy[(i - 1)];
}
if (i == 0)
{
scoresTableEasy[i] = completionTime;
}
}
}
}
playerName is input just before calling the Method.
scoresTableEasy is a float array which holds the score times.
I also have an String array namesTableEasy instantiated to hold the scorers' names.
It puts the first two scores in correctly but it fails to correctly insert scores that are in between two existing ones.
Sooooo can anyone give me some hints as to where I'm going wrong or what alternative methods I could use to complete this task? I'm not after full solutions, just a nudge in the right direction.

