I've been trying to build an Elo style ranking system for myself and a few friends so that we could keep track of our performance in just our games together. But I've been having some trouble with what to call the references to both the players and the game objects to keep it as readable as possible. Intuitively, it seems that the reference to the game should be the game number, and the reference to the player should be the playername. Yet as the specifics of each change every game, I can't hardwire these things into the code. So, is there a way to make the object references a user input?
Here are a few things I've tried that have made the compiler yell at me:
Scanner input = new Scanner(System.in);
Game input.next() = new Game(); //doesn't work
String playername;
for(int i = 0; i < numberOfPlayers; ++i){
System.out.print("Player name: ");
playerName = input.next();
Player playerName = new Player(); //compiler still isn't happy
}
//then there's also this-
String playerName = input.next();
Player /* ????? */ = new Player(Playername);
//it seems like a good idea at first, but it doesn't solve the problem at all.
If there is a way to do what I'm trying to get at here, I have no clue how to do it. And if there isn't a way to do this, what am I supposed to call the variables that isn't a completely ambiguous/unreadable reference name?
EDIT: This question was apparently marked as a duplicate of another question asking how to use System.in with the scanner correctly for a variety of things, not including reference names. As this question is asking a completely different thing(this question is asking primarily about reference names, not System.in or Scanner), I assume that the duplicate mark is either an amusing troll or a misunderstanding of my question.