Hey guys, I'm making a ASCII character 'game engine' persay.
I want flexibility for other programmers and ease of making and generating new areas.
So I have a function with 5 params; the character you want to generate, the width and height of the generation, a boolean which determines if you want an array with data of the characters and their positions, and the name of the array.
The problem is, I don't know how to actually take the name that they input into the code and turn it into the array's name.
I am not sure the need to have a variable name dynamically. What is the purpose of doing so. If you have something to do with the name given as input and the array, why can you not go for Map. This seems to be weird solution, hoping to get something better.
Ashwin Sridhar wrote:I am not sure the need to have a variable name dynamically. What is the purpose of doing so. If you have something to do with the name given as input and the array, why can you not go for Map. This seems to be weird solution, hoping to get something better.
I'm trying to make an ASCII game engine so that other developers can easily render multiple things and be able to keep track of them in an array.
It's just for flexibility and ease of use within the program.
That is a very peculiar design you are trying to achieve. The only thing I can think of is that you create a Map<String, Foo> and you can put names in as the keys and the arrays as the values. You cannot change the names of variables unless you create a program which emits the code and compiles it later.
As well as naming conventions, please avoid such long lines and use spaces, not tabs, for indentation.
Also avoid == true and == false like the plague, as already suggested.